Skip to content

Commit 804b0f0

Browse files
committed
fix: should not include reasoning text in the chat completion request
1 parent 4727132 commit 804b0f0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

web-app/src/lib/messages.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,15 @@ export class CompletionMessagesBuilder {
102102
content = content.slice(splitIndex).trim()
103103
}
104104
}
105+
if (content.includes('<|channel|>analysis<|message|>')) {
106+
const match = content.match(
107+
/<\|channel\|>analysis<\|message\|>([\s\S]*?)<\|start\|>assistant<\|channel\|>final<\|message\|>/
108+
)
109+
if (match?.index !== undefined) {
110+
const splitIndex = match.index + match[0].length
111+
content = content.slice(splitIndex).trim()
112+
}
113+
}
105114
return content
106115
}
107116
}

0 commit comments

Comments
 (0)