pbl_evidence/wwwroot/api/pbl_artifact_options.dspy

16 lines
861 B
Plaintext
Raw 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.

debug(f'pbl_artifact_options.dspy: START params_kw={dict(params_kw)}')
# 下拉数据源json/pbl_evidence.json -> browserfields.alters.artifact_id.dataurl
# 契约:必须返回**裸 JSON 数组** [{value,text},...],异常/空数据返回 []
# 不许包 status/datacrud-definition-spec Pitfall包了会让下拉静默不渲染
# 后端函数 pbl_artifact_options 由 load_pbl_evidence() 注册到 ServerEnvinit.py ③)。
try:
_rows = await pbl_artifact_options(**dict(params_kw))
if not isinstance(_rows, list):
_rows = []
debug(f'pbl_artifact_options.dspy: OK rows={len(_rows)}')
return json.dumps(_rows, ensure_ascii=False)
except Exception as e:
debug(f'pbl_artifact_options.dspy: FAIL {e}')
debug(f'pbl_artifact_options.dspy: TRACE {format_exc()}')
return json.dumps([], ensure_ascii=False)