baodan/docs/schemas/field-value.schema.json
wsb1224 7a3e2870dc 主要成果:
海报确认、文案生成、海报生成增加服务端失败关闭门禁,绑定文件哈希、解析快照哈希和确认数据哈希,并返回 422 业务错误。[validators.py (line 65)](D:/work/code/python/coding/baodanagent/api/insurance/plan_data/validators.py:65)
缺失金额不再转换为 0;删除错误字段兜底和“年缴×年期=合同总保费”事实推导;里程碑冲突会阻断确认。[normalizer.py (line 14)](D:/work/code/python/coding/baodanagent/api/insurance/ppt/normalizer.py:14)
PPT 渲染器支持可空金额和实际币种,缺失值显示“待确认”,避免 float(None)、空值除法等异常。
模板必须覆盖全部输入保司和产品;自动选择排序确定化,同优先级歧义时阻断。[template_selection.py (line 4)](D:/work/code/python/coding/baodanagent/api/insurance/ppt/template_selection.py:4)
场景判定写入 scenarioOverrideTrace,记录请求、模板、服务端及 Worker 最终判定。[routes.py (line 555)](D:/work/code/python/coding/baodanagent/api/insurance/ppt/routes.py:555)
前端增加哈希提交、人工调整原因、模板歧义提示及真实能力说明。
冻结三份核心 Schema,并建立 Goldens manifest、说明和评估脚本。
验证结果:
后端目标回归:111 passed, 1 skipped
PPT 运行时回归:81 passed
前端生产构建和 vue-tsc:通过
Python compileall:通过
三份 Schema JSON:解析通过
git diff --check:通过,仅有换行符提示
2026-08-02 12:58:41 +08:00

71 lines
2.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://baodan.example/schemas/field-value-v1.json",
"title": "Insurance FieldValue v1",
"type": "object",
"additionalProperties": false,
"required": ["status", "value", "evidence"],
"properties": {
"status": {
"enum": ["missing", "extracted", "conflict", "confirmed", "derived"]
},
"value": {
"type": ["string", "number", "integer", "boolean", "null"]
},
"currency": {
"type": ["string", "null"],
"enum": ["USD", "HKD", "CNY", "SGD", "EUR", "GBP", null]
},
"unit": {"type": ["string", "null"]},
"confidence": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
"evidence": {
"type": "array",
"items": {"$ref": "#/$defs/evidenceRef"}
},
"derivedBy": {"type": ["string", "null"]},
"overrideReason": {"type": ["string", "null"], "minLength": 1},
"conflictCandidates": {
"type": "array",
"items": {"type": ["string", "number", "integer", "boolean", "null"]}
}
},
"allOf": [
{
"if": {"properties": {"status": {"const": "missing"}}},
"then": {"properties": {"value": {"type": "null"}}}
},
{
"if": {"properties": {"status": {"const": "derived"}}},
"then": {"required": ["derivedBy"]}
},
{
"if": {"required": ["overrideReason"]},
"then": {"properties": {"status": {"const": "confirmed"}}}
}
],
"$defs": {
"evidenceRef": {
"type": "object",
"additionalProperties": false,
"required": ["documentId", "pageNumber"],
"properties": {
"documentId": {"type": "integer", "minimum": 1},
"pageNumber": {"type": "integer", "minimum": 1},
"bbox": {
"type": ["array", "null"],
"prefixItems": [
{"type": "number"}, {"type": "number"},
{"type": "number"}, {"type": "number"}
],
"minItems": 4,
"maxItems": 4
},
"tableId": {"type": ["string", "null"]},
"rowId": {"type": ["string", "null"]},
"columnId": {"type": ["string", "null"]},
"textHash": {"type": ["string", "null"], "pattern": "^[0-9a-f]{64}$"}
}
}
}
}