fix: options dspy 补 sqlExe 的 ns 参数 + 修复 result 双序列化
This commit is contained in:
parent
3785622bac
commit
178ac2451a
@ -1,10 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
result = json.dumps([{'value': '', 'text': '缺省(用项目默认模型)'}], ensure_ascii=False)
|
|
||||||
try:
|
try:
|
||||||
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' order by name", {})
|
||||||
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:
|
||||||
debug(f'get_model_options error: {e}')
|
debug(f'get_model_options error: {e}')
|
||||||
return json.dumps(result, ensure_ascii=False)
|
return json.dumps([{'value': '', 'text': '缺省(用项目默认模型)'}], ensure_ascii=False)
|
||||||
|
|||||||
@ -1,10 +1,9 @@
|
|||||||
import json
|
import json
|
||||||
result = json.dumps([{'value': '', 'text': '请选择'}], ensure_ascii=False)
|
|
||||||
try:
|
try:
|
||||||
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 id as value, name as text from sd_projects order by created_at desc")
|
rows = await sor.sqlExe("select id as value, name as text from sd_projects order by created_at desc", {})
|
||||||
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:
|
||||||
debug(f'get_project_select_options error: {e}')
|
debug(f'get_project_select_options error: {e}')
|
||||||
return json.dumps(result, ensure_ascii=False)
|
return json.dumps([{'value': '', 'text': '请选择'}], ensure_ascii=False)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user