Skip to content

Commit bbf67d0

Browse files
authored
fix(tui): render all non-synthetic text parts of a user message (#24009)
1 parent 38deb0f commit bbf67d0

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

  • packages/opencode/src/cli/cmd/tui/routes/session

packages/opencode/src/cli/cmd/tui/routes/session/index.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,17 @@ function UserMessage(props: {
12501250
}) {
12511251
const ctx = use()
12521252
const local = useLocal()
1253-
const text = createMemo(() => props.parts.flatMap((x) => (x.type === "text" && !x.synthetic ? [x] : []))[0])
1253+
const text = createMemo(() => {
1254+
const texts = props.parts
1255+
.map((x) => {
1256+
if (x.type === "text" && !x.synthetic) {
1257+
return x.text
1258+
}
1259+
return null
1260+
})
1261+
.filter(Boolean)
1262+
return texts.join("\n\n")
1263+
})
12541264
const files = createMemo(() => props.parts.flatMap((x) => (x.type === "file" ? [x] : [])))
12551265
const { theme } = useTheme()
12561266
const [hover, setHover] = createSignal(false)
@@ -1285,7 +1295,7 @@ function UserMessage(props: {
12851295
backgroundColor={hover() ? theme.backgroundElement : theme.backgroundPanel}
12861296
flexShrink={0}
12871297
>
1288-
<text fg={theme.text}>{text()?.text}</text>
1298+
<text fg={theme.text}>{text()}</text>
12891299
<Show when={files().length}>
12901300
<box flexDirection="row" paddingBottom={metadataVisible() ? 1 : 0} paddingTop={1} gap={1} flexWrap="wrap">
12911301
<For each={files()}>

0 commit comments

Comments
 (0)