fix(agent): 在passthrough模式下添加direct参数以绕过超时检查

当启用passthrough模式时,通过direct参数跳过60秒超时检查,确保消息直接发送而不受限制
This commit is contained in:
Yuyao Huang (Sam) 2026-03-30 01:19:40 +08:00
parent 1b2bb8cdc2
commit f4249e5b0d
2 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ class SessionManager:
) )
return session return session
async def send(self, conv_id: str, message: str, user_id: Optional[str] = None) -> str: async def send(self, conv_id: str, message: str, user_id: Optional[str] = None, direct: bool = False) -> str:
async with self._lock: async with self._lock:
session = self._sessions.get(conv_id) session = self._sessions.get(conv_id)
if session is None: if session is None:
@ -108,7 +108,7 @@ class SessionManager:
session.started = True session.started = True
self._save() self._save()
if cc_timeout > 60: if not direct and cc_timeout > 60:
from agent.task_runner import task_runner from agent.task_runner import task_runner
from orchestrator.tools import get_current_chat, set_current_chat, set_current_user from orchestrator.tools import get_current_chat, set_current_chat, set_current_user

View File

@ -159,7 +159,7 @@ class OrchestrationAgent:
# Passthrough mode: if enabled and active session, bypass LLM # Passthrough mode: if enabled and active session, bypass LLM
if self._passthrough[user_id] and active_conv: if self._passthrough[user_id] and active_conv:
try: try:
reply = await manager.send(active_conv, text, user_id=user_id) reply = await manager.send(active_conv, text, user_id=user_id, direct=True)
logger.info("<<< [passthrough] reply: %r", reply[:120]) logger.info("<<< [passthrough] reply: %r", reply[:120])
return reply return reply
except KeyError: except KeyError: