🐳 feat: Deepseek Reasoning UI (#5440)

This commit is contained in:
Danny Avila 2025-01-24 10:52:08 -05:00 committed by GitHub
parent b8b7f40e98
commit 7818ae5c60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 55 additions and 1 deletions

View file

@ -1292,6 +1292,12 @@ ${convo}
let reasoningCompleted = false;
for await (const chunk of stream) {
if (chunk?.choices?.[0]?.delta?.reasoning_content) {
if (reasoningTokens.length === 0) {
const thinkingDirective = ':::thinking\n';
intermediateReply.push(thinkingDirective);
reasoningTokens.push(thinkingDirective);
onProgress(thinkingDirective);
}
const reasoning_content = chunk?.choices?.[0]?.delta?.reasoning_content || '';
intermediateReply.push(reasoning_content);
reasoningTokens.push(reasoning_content);
@ -1301,7 +1307,7 @@ ${convo}
const token = chunk?.choices?.[0]?.delta?.content || '';
if (!reasoningCompleted && reasoningTokens.length > 0 && token) {
reasoningCompleted = true;
const separatorTokens = '\n\n---\n';
const separatorTokens = '\n:::\n';
reasoningTokens.push(separatorTokens);
onProgress(separatorTokens);
}