mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-19 03:54:19 +00:00
Bugfix (#1482)
* Update modelscopechatcmpl.py tool_call 流式输出的最后一个参数是 None,需要判断一下 * Update mcp.py 问题:闭包(closure)对循环变量 tool 的捕获,导致最终注册到 self.functions 里的所有 func,都会引用 同一个(最后一个)tool 解决:在定义 func 时,通过函数参数的 默认值 把当下的 tool “冻结”住 * Update mcp.py
This commit is contained in:
@@ -82,8 +82,8 @@ class RuntimeMCPSession:
|
||||
|
||||
for tool in tools.tools:
|
||||
|
||||
async def func(query: core_entities.Query, **kwargs):
|
||||
result = await self.session.call_tool(tool.name, kwargs)
|
||||
async def func(query: core_entities.Query, *, _tool=tool, **kwargs):
|
||||
result = await self.session.call_tool(_tool.name, kwargs)
|
||||
if result.isError:
|
||||
raise Exception(result.content[0].text)
|
||||
return result.content[0].text
|
||||
|
||||
Reference in New Issue
Block a user