mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 23:01:09 +03:00
Updated ChatMessage component to display calledTools (#5365)
This commit is contained in:
@@ -1676,7 +1676,12 @@ class Agent_Agentflow implements INode {
|
||||
const sseStreamer: IServerSideEventStreamer = options.sseStreamer as IServerSideEventStreamer
|
||||
|
||||
if (response.tool_calls) {
|
||||
sseStreamer.streamCalledToolsEvent(chatId, response.tool_calls)
|
||||
const formattedToolCalls = response.tool_calls.map((toolCall: any) => ({
|
||||
tool: toolCall.name || 'tool',
|
||||
toolInput: toolCall.args,
|
||||
toolOutput: ''
|
||||
}))
|
||||
sseStreamer.streamCalledToolsEvent(chatId, flatten(formattedToolCalls))
|
||||
}
|
||||
|
||||
if (response.usage_metadata) {
|
||||
@@ -1736,7 +1741,12 @@ class Agent_Agentflow implements INode {
|
||||
|
||||
// Stream tool calls if available
|
||||
if (sseStreamer) {
|
||||
sseStreamer.streamCalledToolsEvent(chatId, JSON.stringify(response.tool_calls))
|
||||
const formattedToolCalls = response.tool_calls.map((toolCall: any) => ({
|
||||
tool: toolCall.name || 'tool',
|
||||
toolInput: toolCall.args,
|
||||
toolOutput: ''
|
||||
}))
|
||||
sseStreamer.streamCalledToolsEvent(chatId, flatten(formattedToolCalls))
|
||||
}
|
||||
|
||||
// Remove tool calls with no id
|
||||
@@ -2045,7 +2055,12 @@ class Agent_Agentflow implements INode {
|
||||
|
||||
// Stream tool calls if available
|
||||
if (sseStreamer) {
|
||||
sseStreamer.streamCalledToolsEvent(chatId, JSON.stringify(response.tool_calls))
|
||||
const formattedToolCalls = response.tool_calls.map((toolCall: any) => ({
|
||||
tool: toolCall.name || 'tool',
|
||||
toolInput: toolCall.args,
|
||||
toolOutput: ''
|
||||
}))
|
||||
sseStreamer.streamCalledToolsEvent(chatId, flatten(formattedToolCalls))
|
||||
}
|
||||
|
||||
// Remove tool calls with no id
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
updateFlowState
|
||||
} from '../utils'
|
||||
import { processTemplateVariables } from '../../../src/utils'
|
||||
import { flatten } from 'lodash'
|
||||
|
||||
class LLM_Agentflow implements INode {
|
||||
label: string
|
||||
@@ -892,7 +893,12 @@ class LLM_Agentflow implements INode {
|
||||
const sseStreamer: IServerSideEventStreamer = options.sseStreamer as IServerSideEventStreamer
|
||||
|
||||
if (response.tool_calls) {
|
||||
sseStreamer.streamCalledToolsEvent(chatId, response.tool_calls)
|
||||
const formattedToolCalls = response.tool_calls.map((toolCall: any) => ({
|
||||
tool: toolCall.name || 'tool',
|
||||
toolInput: toolCall.args,
|
||||
toolOutput: ''
|
||||
}))
|
||||
sseStreamer.streamCalledToolsEvent(chatId, flatten(formattedToolCalls))
|
||||
}
|
||||
|
||||
if (response.usage_metadata) {
|
||||
|
||||
Reference in New Issue
Block a user