File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
apps/sim/stores/panel/copilot Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -1001,14 +1001,23 @@ function beginThinkingBlock(context: StreamingContext) {
10011001 context . currentTextBlock = null
10021002}
10031003
1004+ /**
1005+ * Removes thinking tags from streamed content.
1006+ */
1007+ function stripThinkingTags ( text : string ) : string {
1008+ return text . replace ( / < \/ ? t h i n k i n g > / g, '' )
1009+ }
1010+
10041011function appendThinkingContent ( context : StreamingContext , text : string ) {
10051012 if ( ! text ) return
1013+ const cleanedText = stripThinkingTags ( text )
1014+ if ( ! cleanedText ) return
10061015 if ( context . currentThinkingBlock ) {
1007- context . currentThinkingBlock . content += text
1016+ context . currentThinkingBlock . content += cleanedText
10081017 } else {
10091018 context . currentThinkingBlock = contentBlockPool . get ( )
10101019 context . currentThinkingBlock . type = THINKING_BLOCK_TYPE
1011- context . currentThinkingBlock . content = text
1020+ context . currentThinkingBlock . content = cleanedText
10121021 context . currentThinkingBlock . timestamp = Date . now ( )
10131022 context . currentThinkingBlock . startTime = Date . now ( )
10141023 context . contentBlocks . push ( context . currentThinkingBlock )
You can’t perform that action at this time.
0 commit comments