fix(tui): render all non-synthetic text parts of a user message (#24009)
This commit is contained in:
@@ -1250,7 +1250,17 @@ function UserMessage(props: {
|
|||||||
}) {
|
}) {
|
||||||
const ctx = use()
|
const ctx = use()
|
||||||
const local = useLocal()
|
const local = useLocal()
|
||||||
const text = createMemo(() => props.parts.flatMap((x) => (x.type === "text" && !x.synthetic ? [x] : []))[0])
|
const text = createMemo(() => {
|
||||||
|
const texts = props.parts
|
||||||
|
.map((x) => {
|
||||||
|
if (x.type === "text" && !x.synthetic) {
|
||||||
|
return x.text
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
.filter(Boolean)
|
||||||
|
return texts.join("\n\n")
|
||||||
|
})
|
||||||
const files = createMemo(() => props.parts.flatMap((x) => (x.type === "file" ? [x] : [])))
|
const files = createMemo(() => props.parts.flatMap((x) => (x.type === "file" ? [x] : [])))
|
||||||
const { theme } = useTheme()
|
const { theme } = useTheme()
|
||||||
const [hover, setHover] = createSignal(false)
|
const [hover, setHover] = createSignal(false)
|
||||||
@@ -1285,7 +1295,7 @@ function UserMessage(props: {
|
|||||||
backgroundColor={hover() ? theme.backgroundElement : theme.backgroundPanel}
|
backgroundColor={hover() ? theme.backgroundElement : theme.backgroundPanel}
|
||||||
flexShrink={0}
|
flexShrink={0}
|
||||||
>
|
>
|
||||||
<text fg={theme.text}>{text()?.text}</text>
|
<text fg={theme.text}>{text()}</text>
|
||||||
<Show when={files().length}>
|
<Show when={files().length}>
|
||||||
<box flexDirection="row" paddingBottom={metadataVisible() ? 1 : 0} paddingTop={1} gap={1} flexWrap="wrap">
|
<box flexDirection="row" paddingBottom={metadataVisible() ? 1 : 0} paddingTop={1} gap={1} flexWrap="wrap">
|
||||||
<For each={files()}>
|
<For each={files()}>
|
||||||
|
|||||||
Reference in New Issue
Block a user