feat: 模型下拉框按机构隔离(严格本机构,机构没配 llm 则下拉为空)

This commit is contained in:
ymq 2026-08-22 11:36:32 +08:00
parent 1e2710957c
commit bebb8b2a87

View File

@ -1,7 +1,10 @@
import json
try:
userorgid = await get_userorgid()
if not userorgid:
return json.dumps([{'value': '', 'text': '缺省(用项目默认模型)'}], ensure_ascii=False)
async with get_sor_context(request._run_ns, 'pipeline') as sor:
rows = await sor.sqlExe("select name as value, name as text from llm where status='active' order by name", {})
rows = await sor.sqlExe("select name as value, name as text from llm where status='active' and org_id=${org}$ order by name", {'org': userorgid})
r = [{'value': '', 'text': '缺省(用项目默认模型)'}] + list(rows)
return json.dumps(r, ensure_ascii=False)
except Exception as e: