Skip to content

Commit f444947

Browse files
committed
fix(copilot): options render inside thinking
1 parent bf616f8 commit f444947

File tree

1 file changed

+5
-0
lines changed
  • apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/thinking-block

1 file changed

+5
-0
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/copilot-message/components/thinking-block/thinking-block.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ import { CopilotMarkdownRenderer } from '../markdown-renderer'
77

88
/**
99
* Removes thinking tags (raw or escaped) from streamed content.
10+
* Also strips special tags (options, plan) that may have been accidentally included.
1011
*/
1112
function stripThinkingTags(text: string): string {
1213
return text
1314
.replace(/<\/?thinking[^>]*>/gi, '')
1415
.replace(/&lt;\/?thinking[^&]*&gt;/gi, '')
16+
.replace(/<options>[\s\S]*?<\/options>/gi, '') // Strip complete options tags
17+
.replace(/<options>[\s\S]*$/gi, '') // Strip incomplete/streaming options tags
18+
.replace(/<plan>[\s\S]*?<\/plan>/gi, '') // Strip complete plan tags
19+
.replace(/<plan>[\s\S]*$/gi, '') // Strip incomplete/streaming plan tags
1520
.trim()
1621
}
1722

0 commit comments

Comments
 (0)