fix(isolation): session_search 通用会话只搜自身历史(与 _load_history 过滤对称)
第7层泄漏补刀:session_search 原按 iteration_id 过滤,通用会话 iteration_id='' 匹配到的是所有无项目对话;统一改为按 pipeline_id='' 过滤通用会话历史, 防止修复前落库的污染对话被搜出复述。
This commit is contained in:
parent
b93617feaf
commit
874a14b6bb
@ -1368,10 +1368,19 @@ class AgentExecutor:
|
||||
if not query:
|
||||
return "FAIL: 需要搜索关键词"
|
||||
try:
|
||||
recs = await sor.sqlExe(
|
||||
"SELECT role, content, created_at FROM pipeline_conversations "
|
||||
"WHERE created_by=${u}$ AND iteration_id=${pid}$ AND content LIKE ${q}$ "
|
||||
"ORDER BY created_at DESC LIMIT 10",
|
||||
# 产线隔离(2026-09-05 第7层):通用会话只搜自己的历史
|
||||
# (pipeline_id=''),与 _load_history 过滤对称;产线会话按
|
||||
# iteration_id(项目)过滤不变。
|
||||
if self.generic:
|
||||
sql = ("SELECT role, content, created_at FROM pipeline_conversations "
|
||||
"WHERE created_by=${u}$ AND (pipeline_id='' OR pipeline_id IS NULL) "
|
||||
"AND content LIKE ${q}$ "
|
||||
"ORDER BY created_at DESC LIMIT 10")
|
||||
else:
|
||||
sql = ("SELECT role, content, created_at FROM pipeline_conversations "
|
||||
"WHERE created_by=${u}$ AND iteration_id=${pid}$ AND content LIKE ${q}$ "
|
||||
"ORDER BY created_at DESC LIMIT 10")
|
||||
recs = await sor.sqlExe(sql,
|
||||
{"u": self.user_id, "pid": pid, "q": f"%{query}%"})
|
||||
if not recs:
|
||||
return f"未找到包含 '{query}' 的会话记录"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user