fix(driveragent): prefix thinking tokens with [THINKING] when forwarding streaming chunks to onToken
This commit is contained in:
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user