tui: render reasoning parts with syntax highlighting instead of plain text
This commit is contained in:
parent
c56b407e1d
commit
2fbb49ac30
1 changed files with 11 additions and 2 deletions
|
|
@ -945,7 +945,8 @@ const PART_MAPPING = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ReasoningPart(props: { part: ReasoningPart; message: AssistantMessage }) {
|
function ReasoningPart(props: { part: ReasoningPart; message: AssistantMessage }) {
|
||||||
const { theme } = useTheme()
|
const { theme, syntax } = useTheme()
|
||||||
|
const ctx = use()
|
||||||
return (
|
return (
|
||||||
<Show when={props.part.text.trim()}>
|
<Show when={props.part.text.trim()}>
|
||||||
<box
|
<box
|
||||||
|
|
@ -957,7 +958,15 @@ function ReasoningPart(props: { part: ReasoningPart; message: AssistantMessage }
|
||||||
borderColor={theme.backgroundPanel}
|
borderColor={theme.backgroundPanel}
|
||||||
>
|
>
|
||||||
<box paddingTop={1} paddingBottom={1} paddingLeft={2} backgroundColor={theme.backgroundPanel}>
|
<box paddingTop={1} paddingBottom={1} paddingLeft={2} backgroundColor={theme.backgroundPanel}>
|
||||||
<text fg={theme.text}>{props.part.text.trim()}</text>
|
<code
|
||||||
|
filetype="markdown"
|
||||||
|
drawUnstyledText={false}
|
||||||
|
streaming={true}
|
||||||
|
syntaxStyle={syntax()}
|
||||||
|
content={props.part.text.trim()}
|
||||||
|
conceal={ctx.conceal()}
|
||||||
|
fg={theme.text}
|
||||||
|
/>
|
||||||
</box>
|
</box>
|
||||||
</box>
|
</box>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue