File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -727,6 +727,7 @@ export class MCPAgent {
727727
728728 // Add user message to history if memory enabled
729729 if ( this . memoryEnabled ) {
730+ logger . info ( `🔄 Adding user message to history: ${ query } ` )
730731 this . addToHistory ( new HumanMessage ( query ) )
731732 }
732733
@@ -767,11 +768,8 @@ export class MCPAgent {
767768 // Capture final response from chain end event
768769 if ( event . event === 'on_chain_end' && event . data ?. output ) {
769770 const output = event . data . output
770- if ( typeof output === 'string' ) {
771- finalResponse = output
772- }
773- else if ( output ?. output && typeof output . output === 'string' ) {
774- finalResponse = output . output
771+ if ( Array . isArray ( output ) && output . length > 0 && output [ 0 ] ?. text ) {
772+ finalResponse = output [ 0 ] . text
775773 }
776774 }
777775 }
You can’t perform that action at this time.
0 commit comments