Skip to content

Commit 2f21a1e

Browse files
jlongstervaur94
authored andcommitted
fix(tui): render all non-synthetic text parts of a user message (anomalyco#24009)
(cherry picked from commit bbf67d0)
1 parent a02bde1 commit 2f21a1e

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
@@ -1247,7 +1247,17 @@ function UserMessage(props: {
12471247
}) {
12481248
const ctx = use()
12491249
const local = useLocal()
1250-
const text = createMemo(() => props.parts.flatMap((x) => (x.type === "text" && !x.synthetic ? [x] : []))[0])
1250+
const text = createMemo(() => {
1251+
const texts = props.parts
1252+
.map((x) => {
1253+
if (x.type === "text" && !x.synthetic) {
1254+
return x.text
1255+
}
1256+
return null
1257+
})
1258+
.filter(Boolean)
1259+
return texts.join("\n\n")
1260+
})
12511261
const files = createMemo(() => props.parts.flatMap((x) => (x.type === "file" ? [x] : [])))
12521262
const { theme } = useTheme()
12531263
const [hover, setHover] = createSignal(false)
@@ -1282,7 +1292,7 @@ function UserMessage(props: {
12821292
backgroundColor={hover() ? theme.backgroundElement : theme.backgroundPanel}
12831293
flexShrink={0}
12841294
>
1285-
<text fg={theme.text}>{text()?.text}</text>
1295+
<text fg={theme.text}>{text()}</text>
12861296
<Show when={files().length}>
12871297
<box flexDirection="row" paddingBottom={metadataVisible() ? 1 : 0} paddingTop={1} gap={1} flexWrap="wrap">
12881298
<For each={files()}>

0 commit comments

Comments
 (0)