pipeline-llm/wwwroot/api/get_llm_endpoint_pref_options.dspy

12 lines
578 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# get_llm_ep_pref_options.dspy — appcodes_kv 下拉选项parentid=llm_ep_pref
dbname = get_module_dbname('pipeline_llm')
try:
async with get_sor_context(request._run_ns, dbname) as sor:
recs = await sor.sqlExe(
"SELECT k, v FROM appcodes_kv WHERE parentid=${p}$ ORDER BY k",
{"p": "llm_ep_pref"})
await sor.sqlExe("COMMIT", {})
except Exception as e:
return {"success": False, "message": str(e), "data": []}
return [{"value": getattr(r, "k", ""), "text": getattr(r, "v", "") or getattr(r, "k", "")} for r in (recs or [])]