海报确认、文案生成、海报生成增加服务端失败关闭门禁,绑定文件哈希、解析快照哈希和确认数据哈希,并返回 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:通过,仅有换行符提示
96 lines
3.6 KiB
JSON
96 lines
3.6 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://baodan.example/schemas/document-ir-v1.json",
|
|
"title": "Insurance Document IR v1",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["schemaVersion", "document", "pages", "tables", "quality"],
|
|
"properties": {
|
|
"schemaVersion": {"const": "document-ir-v1"},
|
|
"document": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["sha256", "mimeType", "pageCount", "pdfKind", "status"],
|
|
"properties": {
|
|
"sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
|
|
"mimeType": {"const": "application/pdf"},
|
|
"pageCount": {"type": "integer", "minimum": 1},
|
|
"pdfKind": {"enum": ["native", "scanned", "mixed"]},
|
|
"status": {"enum": ["queued", "processing", "partial", "parsed", "blocked", "failed"]},
|
|
"parserVersion": {"type": "string"},
|
|
"ocrVersion": {"type": ["string", "null"]},
|
|
"profileCode": {"type": ["string", "null"]},
|
|
"profileVersion": {"type": ["string", "null"]}
|
|
}
|
|
},
|
|
"pages": {
|
|
"type": "array",
|
|
"items": {"$ref": "#/$defs/page"}
|
|
},
|
|
"tables": {
|
|
"type": "array",
|
|
"items": {"$ref": "#/$defs/table"}
|
|
},
|
|
"quality": {
|
|
"type": "object",
|
|
"required": ["nativePageCount", "ocrPageCount", "lowQualityPages"],
|
|
"properties": {
|
|
"nativePageCount": {"type": "integer", "minimum": 0},
|
|
"ocrPageCount": {"type": "integer", "minimum": 0},
|
|
"lowQualityPages": {"type": "array", "items": {"type": "integer", "minimum": 1}},
|
|
"warnings": {"type": "array", "items": {"type": "string"}}
|
|
}
|
|
}
|
|
},
|
|
"$defs": {
|
|
"bbox": {
|
|
"type": "array",
|
|
"prefixItems": [{"type": "number"}, {"type": "number"}, {"type": "number"}, {"type": "number"}],
|
|
"minItems": 4,
|
|
"maxItems": 4
|
|
},
|
|
"block": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["id", "text", "bbox", "source"],
|
|
"properties": {
|
|
"id": {"type": "string"},
|
|
"text": {"type": "string"},
|
|
"bbox": {"$ref": "#/$defs/bbox"},
|
|
"source": {"enum": ["native", "ocr"]},
|
|
"confidence": {"type": ["number", "null"], "minimum": 0, "maximum": 1}
|
|
}
|
|
},
|
|
"page": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["pageNumber", "width", "height", "pageClass", "textBlocks", "ocrBlocks"],
|
|
"properties": {
|
|
"pageNumber": {"type": "integer", "minimum": 1},
|
|
"width": {"type": "number", "exclusiveMinimum": 0},
|
|
"height": {"type": "number", "exclusiveMinimum": 0},
|
|
"pageClass": {"type": "string"},
|
|
"nativeTextQuality": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
|
|
"ocrQuality": {"type": ["number", "null"], "minimum": 0, "maximum": 1},
|
|
"textBlocks": {"type": "array", "items": {"$ref": "#/$defs/block"}},
|
|
"ocrBlocks": {"type": "array", "items": {"$ref": "#/$defs/block"}}
|
|
}
|
|
},
|
|
"table": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["tableId", "scenarioType", "headers", "rows", "sourcePages"],
|
|
"properties": {
|
|
"tableId": {"type": "string"},
|
|
"scenarioType": {"type": "string"},
|
|
"headers": {"type": "array", "items": {"type": "object"}},
|
|
"rows": {"type": "array", "items": {"type": "object"}},
|
|
"sourcePages": {"type": "array", "items": {"type": "integer", "minimum": 1}},
|
|
"continuationOf": {"type": ["string", "null"]},
|
|
"bbox": {"anyOf": [{"$ref": "#/$defs/bbox"}, {"type": "null"}]},
|
|
"conflicts": {"type": "array", "items": {"type": "object"}}
|
|
}
|
|
}
|
|
}
|
|
}
|