fix: ai chat node mcp (#3531)
This commit is contained in:
parent
2ba043e801
commit
c4293c34d1
@ -104,8 +104,9 @@ def write_context_stream(node_variable: Dict, workflow_variable: Dict, node: INo
|
|||||||
|
|
||||||
|
|
||||||
async def _yield_mcp_response(chat_model, message_list, mcp_servers):
|
async def _yield_mcp_response(chat_model, message_list, mcp_servers):
|
||||||
async with MultiServerMCPClient(json.loads(mcp_servers)) as client:
|
client = MultiServerMCPClient(json.loads(mcp_servers))
|
||||||
agent = create_react_agent(chat_model, client.get_tools())
|
tools = await client.get_tools()
|
||||||
|
agent = create_react_agent(chat_model, tools)
|
||||||
response = agent.astream({"messages": message_list}, stream_mode='messages')
|
response = agent.astream({"messages": message_list}, stream_mode='messages')
|
||||||
async for chunk in response:
|
async for chunk in response:
|
||||||
if isinstance(chunk[0], ToolMessage):
|
if isinstance(chunk[0], ToolMessage):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user