pipeline-sdlc/wwwroot/api/get_model_options.dspy

10 lines
497 B
Plaintext

import json
try:
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", {})
r = [{'value': '', 'text': '缺省(用项目默认模型)'}] + list(rows)
return json.dumps(r, ensure_ascii=False)
except Exception as e:
debug(f'get_model_options error: {e}')
return json.dumps([{'value': '', 'text': '缺省(用项目默认模型)'}], ensure_ascii=False)