规格:合同台账 AI 证据与混合业务统计
Problem Statement
合同台账尚未完整实现 v1.3 原型的模块 AI 标记、可追溯关键词证据、详情页来源标识与多原文件预览。综合检索也无法可靠处理口语化的“业务/业绩”问题:它需要按单项合同与已确认关联的框架订单计算金额,不能由模型猜测关联或跨库计算。
Solution
以合同模块命中作为台账 AI 标记和关键词解析的唯一事实来源,动态展示适用于合同的已启用模块;详情页提供六个业务页签、字段来源、人工关键词覆盖和多文件预览。为混合业务统计建立已确认合同—订单关联,由受控只读工具完成关联、去重、日期归属和金额计算;CoreMind 只抽取意图条件。页面展示业务步骤、公式、合同/订单明细和数据质量提示,不展示 SQL 或思维链。
User Stories
- As a 合同管理员, I want every enabled contract module displayed in the ledger as
AIor—, so that I can identify keyword-related contracts quickly. - As a 合同管理员, I want the list columns, filters and keyword cards to follow module configuration and sort order, so that newly enabled contract modules work without fixed front-end fields.
- As a 合同管理员, I want multi-module filters to use AND semantics, so that every returned contract meets all selected module conditions.
- As a 合同管理员, I want “维护状态” to mean the existing review status, so that no second competing status exists.
- As a 合同管理员, I want unreviewed contracts to show verify and reviewed contracts to show view, so that actions match review status.
- As a 合同管理员, I want contract-number clicks to open a detail page with basic information, amount and settlement, business clauses, risk, keyword analysis and original-file preview, so that I can review complete evidence.
- As a 合同管理员, I want each detail field marked AI, manual-confirmed or system, so that I understand its provenance.
- As a 合同管理员, I want authorised corrections of AI fields to preserve their AI candidate and audit trail, so that manual changes are traceable.
- As a 合同管理员, I want keyword analysis to display module hit count, keyword, category, source excerpt and location, so that every list marker has evidence.
- As a 合同管理员, I want manual keyword include/exclude to update markers, contract AI status and searches immediately, so that review does not require re-parsing.
- As a 合同管理员, I want the primary PDF previewed by default and all source files switchable, so that multi-file contracts are reviewable.
- As a 合同管理员, I want Word sources downloadable with converted Markdown shown when available, so that non-PDF sources remain useful.
- As a business user, I want oral expressions such as business, performance, framework contract and contract-plus-order recognised as mixed business statistics, so that I do not need database vocabulary.
- As a business user, I want AI business amount calculated as single-contract AI amount plus confirmed-framework-order AI amount, so that totals follow the agreed rule.
- As a business user, I want single contracts assigned by signing year and framework orders assigned by start date with created-date fallback, so that yearly statistics have a stable rule.
- As a business user, I want framework order amount counted only through confirmed effective contract-order links, so that guessed and duplicate amounts cannot affect totals.
- As a business user, I want results grouped by assessment line with both components and their sum, so that I can audit business amount.
- As a business user, I want expandable separate contract and order ledgers, so that totals are traceable to source records.
- As a business user, I want data-quality notices for unlinked frameworks, date fallback and assessment-line mismatches, so that exclusions are visible.
- As a system administrator, I want one order to have at most one confirmed effective contract link, so that it cannot be counted twice.
- As a system administrator, I want link imports validated against both ledgers with source IDs, confirmer, time, method and status, so that cross-database links are governable.
- As a customer, I want a business-step summary but no SQL, database errors or model chain-of-thought, so that results are transparent and safe.
Implementation Decisions
- Contract modules are configuration-driven; every enabled, contract-applicable module becomes a ledger marker, filter and keyword-analysis card. Default modules remain project name, service content, technical requirements and personnel requirements.
- Module AI marker is only
AIor—; module evidence belongs in keyword analysis, never the ledger cell. - Review status is the sole meaning of prototype maintenance status. Detail provenance is AI, manual-confirmed or system.
- Manual keyword overrides take immediate effect and do not re-split, re-parse or rebuild vectors.
- Source preview defaults to primary PDF, supports source switching and uses Word download plus Markdown fallback.
- Confirmed contract-order links are imported with readable identifiers, validated and stored with stable IDs. Only confirmed effective links count; one framework may have many orders, one order at most one confirmed link.
- Mixed business amount includes only single contracts and framework agreements. It equals single-contract keyword amount plus confirmed-framework-order keyword amount; supplemental, change and termination agreements are excluded by default.
- AI means aggregate AI tag; specified keyword/category filters concrete keywords and subwords. Missing year defaults to current year. Framework order grouping uses order assessment line and exposes conflicts with framework line.
- Dedicated read-only business-statistics tool owns cross-ledger validation, association, de-duplication and arithmetic. CoreMind supplies structured conditions only and never cross-database SQL.
- Customer-visible processing is fixed: recognise intent, filter single contracts, filter confirmed framework orders, group/de-duplicate, produce details and quality notices.
Testing Decisions
- Primary seam: authenticated gateway API behavior for ledger rows, detail provenance, keyword evidence, source selection, mixed statistics, references and quality notices.
- Tool tests: confirmed-link inclusion, unlinked exclusion, one-order-one-count, date fallback, assessment-line grouping and keyword filtering.
- Existing rich response, contract-module, confirm-draft and faithful-export tests are prior art.
- Assert externally visible records, totals, labels and exclusions; never assert SQL text, prompt wording or model reasoning.
Out of Scope
- Inferring contract-order links from contract numbers, customers, projects or model similarity.
- Counting draft, invalid or unconfirmed links in financial totals.
- Re-parsing, re-chunking or vector rebuild after manual keyword override.
- Exposing SQL, database errors or chain-of-thought.
- Default inclusion of supplemental, change or termination agreements.
Further Notes
The real dataset currently has no confirmed contract-order links. Until imported and confirmed, framework-order amount must be shown as pending association and excluded from mixed totals. Initial storage and controlled-tool work has started; this issue governs completion, UI integration and regression coverage.