From f842d2e70f992d57f3a344217369c6872de189b8 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 17 Aug 2026 13:31:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(llm):=20agent=E6=A8=A1=E5=9E=8B=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E8=BF=94=E5=9B=9E=E4=B8=AA=E4=BA=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?selected=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/api/agent_model_options.dspy | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/wwwroot/api/agent_model_options.dspy b/wwwroot/api/agent_model_options.dspy index 535a197..f94bdbf 100644 --- a/wwwroot/api/agent_model_options.dspy +++ b/wwwroot/api/agent_model_options.dspy @@ -1,8 +1,10 @@ # agent_model_options.dspy - 返回 active 模型列表(供 AgentIO 模型选择下拉) # llm 表是 pipeline 库的通用配置,产线无关 # org_id 多租户隔离:非系统级机构只看到本机构的模型(不含系统级兜底) +# 返回每项带 selected 标记,标识个人之前选择的默认模型(default_llm_id) dbname = get_module_dbname('pipeline_core') +uid = await get_user() org_id = (await get_userorgid()) or '' async with DBPools().sqlorContext(dbname) as sor: @@ -14,6 +16,14 @@ async with DBPools().sqlorContext(dbname) as sor: sql += " ORDER BY name" recs = await sor.sqlExe(sql, params) + # 个人之前选择的默认模型 + current_llm_id = '' + if uid: + _s = await sor.sqlExe( + "SELECT default_llm_id FROM pipeline_agent_settings WHERE user_id=${u}$", {"u": uid}) + if _s: + current_llm_id = getattr(_s[0], 'default_llm_id', '') or '' + rows = [] for r in recs: rows.append({ @@ -22,6 +32,7 @@ for r in recs: 'provider': r.provider, 'model_id': r.model_id, 'capabilities': r.capabilities or 'text', + 'selected': r.id == current_llm_id, }) return rows