mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-06-02 07:12:02 +00:00
update
This commit is contained in:
parent
5c2226ff8b
commit
f6b408ae8a
2 changed files with 5 additions and 12 deletions
|
|
@ -17,7 +17,8 @@ import contextvars
|
|||
import json
|
||||
import os
|
||||
import platform
|
||||
from threading import Event, Lock
|
||||
import time
|
||||
from threading import Event, Lock, current_thread
|
||||
import traceback
|
||||
from typing import Any, Callable, Dict, List, Tuple
|
||||
import uuid
|
||||
|
|
@ -556,16 +557,8 @@ class ListenChatAgent(ChatAgent):
|
|||
with set_process_task(self.process_task_id):
|
||||
# Try different invocation paths in order of preference
|
||||
if hasattr(tool, "func") and hasattr(tool.func, "async_call"):
|
||||
# Case: FunctionTool wrapping an MCP tool
|
||||
# Check if the wrapped tool is sync to avoid run_in_executor
|
||||
if hasattr(tool, "is_async") and not tool.is_async:
|
||||
# Sync tool: call directly to preserve ContextVar
|
||||
result = tool(**args)
|
||||
if asyncio.iscoroutine(result):
|
||||
result = await result
|
||||
else:
|
||||
# Async tool: use async_call
|
||||
result = await tool.func.async_call(**args)
|
||||
# MCP FunctionTool: always use async_call (sync wrapper can timeout)
|
||||
result = await tool.func.async_call(**args)
|
||||
|
||||
elif hasattr(tool, "async_call") and callable(tool.async_call):
|
||||
# Case: tool itself has async_call
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ const chatStore = (initial?: Partial<ChatStore>) => createStore<ChatStore>()(
|
|||
api_key: apiModel.api_key,
|
||||
api_url: apiModel.api_url,
|
||||
extra_params: apiModel.extra_params,
|
||||
installed_mcp: { mcpServers: {} },
|
||||
installed_mcp: (mcpLocal && Object.keys(mcpLocal).length > 0) ? mcpLocal : { mcpServers: {} },
|
||||
language: systemLanguage,
|
||||
allow_local_system: true,
|
||||
attaches: (messageAttaches || targetChatStore.getState().tasks[newTaskId]?.attaches || []).map(f => f.filePath),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue