tool responses are easy now too
This commit is contained in:
parent
5e41222c63
commit
9b34461c2d
1 changed files with 12 additions and 22 deletions
|
|
@ -211,28 +211,18 @@ export const useStreamResponse = ({
|
||||||
console.warn('Tool call event missing toolName:', event)
|
console.warn('Tool call event missing toolName:', event)
|
||||||
}
|
}
|
||||||
} else if (event.type === 'tool-result') {
|
} else if (event.type === 'tool-result') {
|
||||||
console.info(`TODO TOOL RESULT`, event)
|
if (event.toolName && event.toolCallId) {
|
||||||
// if (event.toolName && event.toolCallId) {
|
newMessage = {
|
||||||
// setConversations((prev) => {
|
role: 'tool-result',
|
||||||
// const updated = [...prev]
|
toolName: event.toolName,
|
||||||
// const conv = updated.find((c) => c.id === conversationId)
|
toolArgs: event.args || {},
|
||||||
// if (conv) {
|
toolResult: event.result,
|
||||||
// conv.messages.push({
|
callId: event.toolCallId,
|
||||||
// role: 'tool-result',
|
}
|
||||||
// toolName: event.toolName,
|
scrollToBottom(true)
|
||||||
// toolArgs: event.args || {},
|
} else {
|
||||||
// toolResult: event.result,
|
console.warn('Tool result event missing toolName or toolCallId:', event)
|
||||||
// callId: event.toolCallId,
|
}
|
||||||
// })
|
|
||||||
// debugMessages('Added new tool-result message:', event.toolName, 'callId:', event.toolCallId)
|
|
||||||
// debugMessages('Current messages:', JSON.stringify(conv.messages))
|
|
||||||
// }
|
|
||||||
// return updated
|
|
||||||
// })
|
|
||||||
// scrollToBottom(true)
|
|
||||||
// } else {
|
|
||||||
// console.warn('Tool result event missing toolName or toolCallId:', event)
|
|
||||||
// }
|
|
||||||
} else if (event.type === 'text-delta') {
|
} else if (event.type === 'text-delta') {
|
||||||
if (lastMessage?.role !== 'assistant' || lastMessage.type !== 'content') {
|
if (lastMessage?.role !== 'assistant' || lastMessage.type !== 'content') {
|
||||||
newMessage = {
|
newMessage = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue