mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(agent): force flush remaining text before call tools (#134)
This commit is contained in:
@@ -499,6 +499,20 @@ export const createAgent = (
|
||||
break
|
||||
}
|
||||
case 'tool-call':
|
||||
// Flush any remaining buffered content before ending the text stream.
|
||||
const remainder = attachmentsExtractor.flushRemainder()
|
||||
if (remainder.visibleText) {
|
||||
yield {
|
||||
type: 'text_delta',
|
||||
delta: remainder.visibleText,
|
||||
}
|
||||
}
|
||||
if (remainder.attachments.length) {
|
||||
yield {
|
||||
type: 'attachment_delta',
|
||||
attachments: remainder.attachments,
|
||||
}
|
||||
}
|
||||
yield {
|
||||
type: 'tool_call_start',
|
||||
toolName: chunk.toolName,
|
||||
|
||||
Reference in New Issue
Block a user