feat: 模型下拉框按机构隔离(严格本机构,机构没配 llm 则下拉为空)
This commit is contained in:
parent
1e2710957c
commit
bebb8b2a87
@ -1,7 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
try:
|
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:
|
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)
|
r = [{'value': '', 'text': '缺省(用项目默认模型)'}] + list(rows)
|
||||||
return json.dumps(r, ensure_ascii=False)
|
return json.dumps(r, ensure_ascii=False)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user