mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-28 18:19:28 +00:00
refactor(desktop): memoize the directive image-segment filter
Matches the two derived values above it and fixes the indentation.
This commit is contained in:
parent
ffbcfa1597
commit
3d2033db6b
1 changed files with 8 additions and 4 deletions
|
|
@ -354,10 +354,14 @@ export function DirectiveContent({ text }: { text: string }) {
|
|||
// `@image:<path>` directives render as a block-level thumbnail row (like
|
||||
// embedded base64 images below), not inline mid-text — otherwise a large
|
||||
// thumbnail gets wedged between words and breaks the text's line flow.
|
||||
const imageSegments = segments.filter(
|
||||
(segment): segment is Extract<Unstable_DirectiveSegment, { kind: 'mention' }> =>
|
||||
segment.kind === 'mention' && segment.type === 'image'
|
||||
)
|
||||
const imageSegments = useMemo(
|
||||
() =>
|
||||
segments.filter(
|
||||
(segment): segment is Extract<Unstable_DirectiveSegment, { kind: 'mention' }> =>
|
||||
segment.kind === 'mention' && segment.type === 'image'
|
||||
),
|
||||
[segments]
|
||||
)
|
||||
|
||||
return (
|
||||
<span className="whitespace-pre-line" data-slot="aui_directive-text">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue