Files
ai-contract-platform/project-docs/V2-contract-main-flow-api-integration-2026-06-23.md
T
yuqei a3bb78e06b
Security Quality Gate / npm audit, Bandit, pip-audit, detect-secrets (pull_request) Failing after 16m35s
release: freeze V2 release candidate
2026-07-12 15:32:24 +08:00

55 lines
1.9 KiB
Markdown
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.
# AI 合同平台 V2 合同主流程 API 接入记录
时间:2026-06-23
## 本轮目标
按照《AI 合同平台 V2 重构版开发方案》,把简化后的主流程从前端 mock 数据切到 Contract API:
- 工作台“待我处理”来自真实 API 边界。
- 合同列表来自 Contract API。
- 合同详情“下一步操作”和审批时间线来自 Contract API。
## 已完成
### 1. Contract API
新增合同主流程 MVP:
- `GET /api/v1/workspace`
- `GET /api/v1/contracts`
- `GET /api/v1/contracts/{contract_id}`
当前实现采用内存仓储,先固定 API 边界和页面行为,后续再替换为数据库持久化。
### 2. Contract Web
- 工作台从 `getWorkspaceTasks()` 读取待办。
- 合同列表从 `getContracts()` 读取。
- 合同详情从 `getContractDetail()` 读取。
- 服务端渲染时直连 `CONTRACT_API_BASE_URL`。
- 客户端需要时保留 `/api/contract-platform/*` 代理。
- Contract API 不可用时临时 fallback 到现有 mock 数据,避免开发环境白屏。
### 3. 契约同步
更新 `yuqei-contract-platform/packages/contract-openapi/openapi.yaml`:
- 补充 `WorkspaceTask.summary/tone/contract_id`
- 补充合同列表的 `code/status_label/status_tone/next_action/updated_label/amount/owner`
- 合同详情补充 `approval_timeline`
## 验证命令
```powershell
python -m pytest yuqei-contract-platform\services\contract-api\tests -q
python -c "import yaml, pathlib; yaml.safe_load(pathlib.Path('yuqei-contract-platform/packages/contract-openapi/openapi.yaml').read_text(encoding='utf-8')); print('contract openapi ok')"
npm --prefix yuqei-contract-platform/apps/contract-web run build
```
## 下一步建议
1. 给 Contract API 增加 SQLite/PostgreSQL 仓储和迁移,替换内存仓储。
2. 增加合同创建草稿接口,让“快速起草”真正落库。
3. 工作台按角色过滤待办:业务提交人、法务、审批人、观察者看到不同任务。