MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / cleanupCalledTools

Function cleanupCalledTools

packages/ui/src/views/chatmessage/ChatMessage.jsx:786–803  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

784 }
785
786 const cleanupCalledTools = () => {
787 setMessages((prevMessages) => {
788 let allMessages = [...cloneDeep(prevMessages)]
789 if (allMessages[allMessages.length - 1].type === 'userMessage') return allMessages
790
791 // Remove any remaining calledTools when the stream ends
792 const lastMessage = allMessages[allMessages.length - 1]
793 if (lastMessage && lastMessage.calledTools && lastMessage.calledTools.length > 0) {
794 // Only remove if there are still calledTools and no matching usedTools
795 const hasUsedTools = lastMessage.usedTools && lastMessage.usedTools.length > 0
796 if (!hasUsedTools) {
797 allMessages[allMessages.length - 1].calledTools = undefined
798 }
799 }
800
801 return allMessages
802 })
803 }
804
805 const updateLastMessageFileAnnotations = (fileAnnotations) => {
806 setMessages((prevMessages) => {

Callers 3

onmessageFunction · 0.85
oncloseFunction · 0.85
closeResponseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected