pbl_evidence/wwwroot/api/pbl_evidence_collect_idempotent.dspy
2026-09-22 17:00:53 +08:00

18 lines
1.1 KiB
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.

# pbl_evidence/api/pbl_evidence_collect_idempotent.dspy
# M5b 契约①:四类证据(decision/action/observation/artifact_version)幂等采集。
# 重复采集(同 idempotency_key / 同唯一索引三元组)不报错,返回 created=false。
# dspy 铁律:无 import、无 ServerEnv()、无 f-string、显式 return;
# 函数由 load_pbl_evidence() 挂 ServerEnv;日志一律字符串拼接。
debug('pbl_evidence/api/pbl_evidence_collect_idempotent.dspy: START params_kw=' + str(dict(params_kw)))
try:
res = await pbl_evidence_collect_idempotent(**dict(params_kw))
status = 'OK' if res.get('ok') else 'ERROR'
debug('pbl_evidence_collect_idempotent.dspy: DONE created=' + str(res.get('created')) +
' deduped=' + str(res.get('deduped')) + ' id=' + str(res.get('id')))
result = {'status': status, 'data': res, 'message': res.get('message') or ''}
return result
except Exception as e:
error('pbl_evidence_collect_idempotent.dspy: FAIL ' + str(format_exc()))
return {'status': 'ERROR', 'data': None, 'message': str(e)}