feat: gateway.run_message加generic参数(纯通用模式跳过resolve_project+不装产线能力)

This commit is contained in:
ymq 2026-08-16 18:02:42 +08:00
parent 50c9220d2d
commit 6e61dbbbb9

View File

@ -98,7 +98,7 @@ class Gateway:
# ── 统一消息入口 ──
async def run_message(self, channel: str, user_id: str, content: str,
history=None, role: str = "") -> AsyncGenerator[str, None]:
history=None, role: str = "", generic: bool = False) -> AsyncGenerator[str, None]:
"""统一消息入口:解析上下文 → 加载产线能力 → AgentExecutor 执行 → yield 事件流。
Args:
@ -107,12 +107,16 @@ class Gateway:
content: 用户消息内容
history: 可选历史消息
role: 可选产线内角色驾驶舱 agent 为空
generic: True = 纯通用会话不解析项目不加载产线能力只用 GENERAL_TOOLS + 通用心智
"""
from pipeline_core.agent_config import load_agent_config
from .agent_loop_v2 import AgentExecutor
# 1. 解析项目上下文
ctx = await self.resolve_project(user_id)
# 1. 解析项目上下文(纯通用模式跳过,不挂任何产线插件)
if generic:
ctx = {"pid": "", "pipeline_id": "", "name": ""}
else:
ctx = await self.resolve_project(user_id)
# 2. 会话生命周期(跟踪 project 切换)
key = self._session_key(channel, user_id)