From bb29d6d63487e911710121c4826a7d25215f4f5d Mon Sep 17 00:00:00 2001 From: ymq Date: Mon, 17 Aug 2026 13:33:28 +0800 Subject: [PATCH] =?UTF-8?q?fix(gateway):=20resolve=5Fproject=20=E6=94=B9?= =?UTF-8?q?=E4=B8=A4=E6=AD=A5=E6=9F=A5=E8=AF=A2=E9=81=BF=E5=85=8D=20JOIN?= =?UTF-8?q?=20=E8=A7=A6=E5=8F=91=20collation=20=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/gateway.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pipeline_service/gateway.py b/pipeline_service/gateway.py index f2675f5..491fbcb 100644 --- a/pipeline_service/gateway.py +++ b/pipeline_service/gateway.py @@ -83,15 +83,18 @@ class Gateway: db = DBPools() async with db.sqlorContext("pipeline") as sor: recs = await sor.sqlExe( - "SELECT s.current_project_id, s.default_llm_id, l.name as llm_name " - "FROM pipeline_agent_settings s " - "LEFT JOIN llm l ON l.id = s.default_llm_id AND l.status='active' " - "WHERE s.user_id=${u}$", + "SELECT current_project_id, default_llm_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": user_id}) if recs: ctx["pid"] = getattr(recs[0], "current_project_id", "") or "" ctx["default_llm_id"] = getattr(recs[0], "default_llm_id", "") or "" - ctx["default_llm_name"] = getattr(recs[0], "llm_name", "") or "" + # 单独查 llm.name(避免 JOIN 触发两表字段 collation 不一致) + if ctx["default_llm_id"]: + llm_recs = await sor.sqlExe( + "SELECT name FROM llm WHERE id=${id}$ AND status='active'", + {"id": ctx["default_llm_id"]}) + if llm_recs: + ctx["default_llm_name"] = getattr(llm_recs[0], "name", "") or "" if ctx["pid"]: proj = await sor.sqlExe( "SELECT name, pipeline_id FROM sd_projects WHERE id=${p}$",