fix(ui): render thinking/reasoning block content as markdown (#24611)
* fix(ui): render thinking/reasoning block content as markdown * feat(ui): add toggle setting for thinking block markdown rendering
This commit is contained in:
@@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
const showToolCallInProgress = $derived(config().showToolCallInProgress as boolean);
|
const showToolCallInProgress = $derived(config().showToolCallInProgress as boolean);
|
||||||
const showThoughtInProgress = $derived(config().showThoughtInProgress as boolean);
|
const showThoughtInProgress = $derived(config().showThoughtInProgress as boolean);
|
||||||
|
const renderThinkingAsMarkdown = $derived(config().renderThinkingAsMarkdown as boolean);
|
||||||
|
|
||||||
const hasReasoningError = $derived(
|
const hasReasoningError = $derived(
|
||||||
isLastAssistantMessage ? !!agenticLastError(message.convId) : false
|
isLastAssistantMessage ? !!agenticLastError(message.convId) : false
|
||||||
@@ -316,9 +317,13 @@
|
|||||||
onToggle={() => toggleExpanded(index, section)}
|
onToggle={() => toggleExpanded(index, section)}
|
||||||
>
|
>
|
||||||
<div class="pt-3">
|
<div class="pt-3">
|
||||||
|
{#if renderThinkingAsMarkdown}
|
||||||
|
<MarkdownContent content={section.content} attachments={message?.extra} />
|
||||||
|
{:else}
|
||||||
<div class="text-xs leading-relaxed break-words whitespace-pre-wrap">
|
<div class="text-xs leading-relaxed break-words whitespace-pre-wrap">
|
||||||
{section.content}
|
{section.content}
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</CollapsibleContentBlock>
|
</CollapsibleContentBlock>
|
||||||
{:else if section.type === AgenticSectionType.REASONING_PENDING}
|
{:else if section.type === AgenticSectionType.REASONING_PENDING}
|
||||||
@@ -336,9 +341,13 @@
|
|||||||
onToggle={() => toggleExpanded(index, section)}
|
onToggle={() => toggleExpanded(index, section)}
|
||||||
>
|
>
|
||||||
<div class="pt-3">
|
<div class="pt-3">
|
||||||
|
{#if renderThinkingAsMarkdown}
|
||||||
|
<MarkdownContent content={section.content} attachments={message?.extra} />
|
||||||
|
{:else}
|
||||||
<div class="text-xs leading-relaxed break-words whitespace-pre-wrap">
|
<div class="text-xs leading-relaxed break-words whitespace-pre-wrap">
|
||||||
{section.content}
|
{section.content}
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</CollapsibleContentBlock>
|
</CollapsibleContentBlock>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export const SETTINGS_KEYS = {
|
|||||||
SHOW_MODEL_TAGS: 'showModelTags',
|
SHOW_MODEL_TAGS: 'showModelTags',
|
||||||
SHOW_BUILD_VERSION: 'showBuildVersion',
|
SHOW_BUILD_VERSION: 'showBuildVersion',
|
||||||
SHOW_SYSTEM_MESSAGE: 'showSystemMessage',
|
SHOW_SYSTEM_MESSAGE: 'showSystemMessage',
|
||||||
|
RENDER_THINKING_AS_MARKDOWN: 'renderThinkingAsMarkdown',
|
||||||
// Sampling
|
// Sampling
|
||||||
TEMPERATURE: 'temperature',
|
TEMPERATURE: 'temperature',
|
||||||
DYNATEMP_RANGE: 'dynatemp_range',
|
DYNATEMP_RANGE: 'dynatemp_range',
|
||||||
|
|||||||
@@ -282,6 +282,18 @@ const SETTINGS_REGISTRY: Record<string, SettingsSectionEntry> = {
|
|||||||
paramType: SyncableParameterType.BOOLEAN
|
paramType: SyncableParameterType.BOOLEAN
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: SETTINGS_KEYS.RENDER_THINKING_AS_MARKDOWN,
|
||||||
|
label: 'Render thinking as Markdown',
|
||||||
|
help: 'Render the reasoning/thinking block content as formatted Markdown instead of plain text.',
|
||||||
|
defaultValue: true,
|
||||||
|
type: SettingsFieldType.CHECKBOX,
|
||||||
|
section: SETTINGS_SECTION_SLUGS.DISPLAY,
|
||||||
|
sync: {
|
||||||
|
serverKey: SETTINGS_KEYS.RENDER_THINKING_AS_MARKDOWN,
|
||||||
|
paramType: SyncableParameterType.BOOLEAN
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: SETTINGS_KEYS.FULL_HEIGHT_CODE_BLOCKS,
|
key: SETTINGS_KEYS.FULL_HEIGHT_CODE_BLOCKS,
|
||||||
label: 'Use full height code blocks',
|
label: 'Use full height code blocks',
|
||||||
|
|||||||
Reference in New Issue
Block a user