mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
minor tool use fix
This commit is contained in:
parent
af41d6a439
commit
2bc3d67e39
1 changed files with 1 additions and 1 deletions
|
|
@ -326,12 +326,12 @@ class ChatThreadService extends Disposable implements IChatThreadService {
|
|||
this._setStreamState(threadId, { messageSoFar: fullText })
|
||||
},
|
||||
onFinalMessage: async ({ fullText, tools }) => {
|
||||
this._addMessageToThread(threadId, { role: 'assistant', content: fullText, displayContent: fullText, tool_calls: tools })
|
||||
|
||||
if ((tools?.length ?? 0) === 0) {
|
||||
this._finishStreamingTextMessage(threadId, fullText)
|
||||
}
|
||||
else {
|
||||
this._addMessageToThread(threadId, { role: 'assistant', content: fullText, displayContent: fullText, tool_calls: tools })
|
||||
for (const tool of tools ?? []) {
|
||||
if (!(tool.name in this._toolsService.toolFns)) {
|
||||
this._addMessageToThread(threadId, { role: 'tool', name: tool.name, params: tool.params, id: tool.id, content: `Error: This tool was not recognized, so it was not called.`, displayContent: `Error: tool not recognized.`, })
|
||||
|
|
|
|||
Loading…
Reference in a new issue