mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-12 04:01:20 +00:00
Merge pull request #3680 from deepseek-harness/turtle/strip-think-summary-bold-markers
fix(web): strip bold markers from think summaries
This commit is contained in:
@@ -17,7 +17,9 @@ function latestLine(text: string): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* Render one assistant reasoning block as the Think disclosure row.
|
||||
* Render one assistant reasoning block as the Think disclosure row. The
|
||||
* collapsed summary omits double-asterisk markers; expanded content preserves
|
||||
* the complete text.
|
||||
* @param props.text - complete or streaming reasoning text.
|
||||
* @param props.running - whether this block is the streaming tail.
|
||||
* @param props.t - conversation locale seat for the running status.
|
||||
@@ -25,7 +27,7 @@ function latestLine(text: string): string {
|
||||
*/
|
||||
export function ReasoningRow({ text, running, t }: { text: string; running: boolean; t: ChatViewSlotProps['t'] }) {
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const summary = running ? latestLine(text) : firstLine(text)
|
||||
const summary = (running ? latestLine(text) : firstLine(text)).replaceAll('**', '')
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
@@ -70,6 +70,34 @@ describe('ReasoningRow', () => {
|
||||
expect(row.getAttribute('aria-expanded')).toBe('false')
|
||||
})
|
||||
|
||||
it.each([
|
||||
{
|
||||
label: 'settled',
|
||||
text: '**Comparing checkout and merge bases**\nKeep **reviewing**',
|
||||
streaming: false,
|
||||
},
|
||||
{
|
||||
label: 'streaming',
|
||||
text: 'Inspect the session\n**Comparing checkout and merge bases**',
|
||||
streaming: true,
|
||||
},
|
||||
])('strips double-asterisk markers from the $label summary without changing the reasoning body', ({ text, streaming }) => {
|
||||
const view = render(
|
||||
<AssistantMarkdown
|
||||
t={t}
|
||||
blocks={[{ kind: 'reasoning', text }]}
|
||||
streaming={streaming}
|
||||
renderMessageImages={renderMessageImages}
|
||||
/>,
|
||||
)
|
||||
|
||||
expect(view.getByText('Comparing checkout and merge bases')).toBeTruthy()
|
||||
expect(view.queryByText('**Comparing checkout and merge bases**')).toBeNull()
|
||||
|
||||
fireEvent.click(view.getByText('思考'))
|
||||
expect(view.container.querySelector('[class*="thinkBody"]')?.textContent).toBe(text)
|
||||
})
|
||||
|
||||
it('expanded Think drops the inline summary and renders plain prose, no IN card', () => {
|
||||
const view = render(
|
||||
<AssistantMarkdown
|
||||
|
||||
Reference in New Issue
Block a user