Add AI batch reconciliation for accessibility bills

This commit is contained in:
2026-07-25 18:41:09 +08:00
parent eb8909a192
commit 7cca34b331
25 changed files with 2771 additions and 230 deletions
+35
View File
@@ -91,6 +91,41 @@ void main() {
expect(candidate.resultFingerprint, 'abc123');
});
test('AI 批次模型保留动作、原因与可恢复状态', () {
final batch = RecognitionBatch.fromJson({
'id': 'batch-1',
'state': 'ready',
'openedAt': DateTime.utc(2026, 7, 25, 8).millisecondsSinceEpoch,
'completedAt': DateTime.utc(2026, 7, 25, 8, 1).millisecondsSinceEpoch,
'summary': {
'kept': 1,
'updated': 1,
'created': 0,
'dropped': 1,
'fallback': false,
},
'items': [
{
'candidateId': 'candidate-1',
'action': 'drop',
'reason': '同一流程重复结果页',
'state': 'ai_dropped',
'type': 'expense',
'amount': 20,
'merchant': '张三',
'canRestore': true,
},
],
});
expect(batch.completedAt.isUtc, isTrue);
expect(batch.updated, 1);
expect(batch.dropped, 1);
expect(batch.items.single.action, 'drop');
expect(batch.items.single.reason, '同一流程重复结果页');
expect(batch.items.single.canRestore, isTrue);
});
test('智能识别诊断摘要能区分关键失败类型', () {
RecognitionDiagnostic diagnostic(String result, String reason) {
return RecognitionDiagnostic(