fix(session): 跨产线会话串扰根治——历史/项目上下文按产线隔离
根因: 各产线页面默认tab共用session_id='default', 对话历史只按session_id过滤 (写入未存pipeline_id), 投标页加载了开发页历史导致LLM答错产线。 - _save_turn: 写入pipeline_id(generic存空串防污染开发产线) - _load_history: session级读取加pipeline_id过滤 - get_session_project_id: 加pipeline_id参数, 跨产线项目不生效(不删记录)
This commit is contained in:
parent
2d913c1d12
commit
a7d522b15f
@ -1352,6 +1352,10 @@ class AgentExecutor:
|
||||
|
||||
db = DBPools()
|
||||
async with db.sqlorContext("pipeline") as sor:
|
||||
# 产线隔离(2026-08-31):generic 会话不挂产线标签——generic 的
|
||||
# pipeline_id 会回退 DEFAULT_ABILITY_ID(sdlc_general),若落库会污染
|
||||
# 开发产线历史。存空串 = 通用对话,各产线读取时按产线过滤自然排除。
|
||||
store_pl = "" if self.generic else (self.pipeline_id or "")
|
||||
# 用户消息
|
||||
await sor.C("pipeline_conversations", {
|
||||
"id": getID(),
|
||||
@ -1360,7 +1364,7 @@ class AgentExecutor:
|
||||
"created_by": self.user_id or "",
|
||||
"iteration_id": self.project_id or "",
|
||||
"session_id": self.session_id or "",
|
||||
"pipeline_id": self.pipeline_id or "",
|
||||
"pipeline_id": store_pl,
|
||||
})
|
||||
# 助手回复(不含 tool_call JSON!)
|
||||
reply_clean = reply
|
||||
@ -1373,7 +1377,7 @@ class AgentExecutor:
|
||||
"created_by": self.user_id or "",
|
||||
"iteration_id": self.project_id or "",
|
||||
"session_id": self.session_id or "",
|
||||
"pipeline_id": self.pipeline_id or "",
|
||||
"pipeline_id": store_pl,
|
||||
})
|
||||
except Exception as e:
|
||||
logger.warning(f"Session save failed: {e}")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user