pbl_evidence/wwwroot/api/pbl_evidence_collect_idempotent.dspy
2026-09-22 14:13:03 +08:00

16 lines
965 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.

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