fix(driveragent): prefix thinking tokens with [THINKING] when forwarding streaming chunks to onToken

This commit is contained in:
2026-01-20 03:10:53 +00:00
parent 8bcf3257e2
commit 79efe8f6b8
3 changed files with 23 additions and 7 deletions

View File

@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@push.rocks/smartagent',
version: '1.5.2',
version: '1.5.3',
description: 'an agentic framework built on top of @push.rocks/smartai'
}

View File

@@ -491,10 +491,14 @@ Your complete output here
images: images,
tools: tools.length > 0 ? tools : undefined,
},
// Pass onToken callback through onChunk for streaming
// Pass onToken callback through onChunk for streaming with thinking markers
this.onToken ? (chunk: any) => {
if (chunk.thinking && this.onToken) this.onToken(chunk.thinking);
if (chunk.content && this.onToken) this.onToken(chunk.content);
if (chunk.thinking && this.onToken) {
this.onToken(`[THINKING] ${chunk.thinking}`);
}
if (chunk.content && this.onToken) {
this.onToken(chunk.content);
}
} : undefined
);
@@ -574,10 +578,14 @@ Your complete output here
messageHistory: historyForChat,
tools: tools.length > 0 ? tools : undefined,
},
// Pass onToken callback through onChunk for streaming
// Pass onToken callback through onChunk for streaming with thinking markers
this.onToken ? (chunk: any) => {
if (chunk.thinking && this.onToken) this.onToken(chunk.thinking);
if (chunk.content && this.onToken) this.onToken(chunk.content);
if (chunk.thinking && this.onToken) {
this.onToken(`[THINKING] ${chunk.thinking}`);
}
if (chunk.content && this.onToken) {
this.onToken(chunk.content);
}
} : undefined
);