chore: align V2 into final four-project layout
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Contract OpenAPI
|
||||
|
||||
This package is the source of truth for the V2 contract platform HTTP contract.
|
||||
|
||||
Primary file:
|
||||
|
||||
```text
|
||||
openapi.yaml
|
||||
```
|
||||
|
||||
Rules:
|
||||
|
||||
- Contract Web should consume this contract through generated or typed clients.
|
||||
- Contract API implementation must match this contract.
|
||||
- Contract API calls AI Platform only through SDK/OpenAPI clients, not direct provider adapters.
|
||||
@@ -0,0 +1,559 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: Yuqei Contract Platform API
|
||||
version: 0.1.0
|
||||
description: V2 contract platform contract for enterprise contract drafting, review, workflow, repository, and audit.
|
||||
servers:
|
||||
- url: http://localhost:8100
|
||||
description: Local contract API
|
||||
paths:
|
||||
/health:
|
||||
get:
|
||||
operationId: getHealth
|
||||
summary: Health check
|
||||
responses:
|
||||
"200":
|
||||
description: Service health
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/HealthResponse"
|
||||
/api/v1/auth/login:
|
||||
post:
|
||||
operationId: login
|
||||
summary: Login
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/LoginRequest"
|
||||
responses:
|
||||
"200":
|
||||
description: Login result
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/LoginResponse"
|
||||
/api/v1/workspace:
|
||||
get:
|
||||
operationId: getWorkspace
|
||||
summary: Get current user's workspace summary
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TraceIdHeader"
|
||||
responses:
|
||||
"200":
|
||||
description: Workspace summary
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/WorkspaceSummary"
|
||||
/api/v1/contracts:
|
||||
get:
|
||||
operationId: listContracts
|
||||
summary: List contracts
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/Page"
|
||||
- $ref: "#/components/parameters/PageSize"
|
||||
- name: status
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- name: keyword
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Contract page
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ContractPage"
|
||||
post:
|
||||
operationId: createContract
|
||||
summary: Create a contract draft
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/CreateContractRequest"
|
||||
responses:
|
||||
"200":
|
||||
description: Created contract
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ContractDetail"
|
||||
/api/v1/contracts/{contract_id}:
|
||||
get:
|
||||
operationId: getContractDetail
|
||||
summary: Get contract detail
|
||||
parameters:
|
||||
- name: contract_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Contract detail
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ContractDetail"
|
||||
/api/v1/contracts/{contract_id}/review:
|
||||
post:
|
||||
operationId: startContractReview
|
||||
summary: Start AI-assisted contract review
|
||||
parameters:
|
||||
- name: contract_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Review task
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ReviewTask"
|
||||
/api/v1/contracts/{contract_id}/approval/submit:
|
||||
post:
|
||||
operationId: submitApproval
|
||||
summary: Submit contract for approval
|
||||
parameters:
|
||||
- name: contract_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
required: false
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/SubmitApprovalRequest"
|
||||
responses:
|
||||
"200":
|
||||
description: Approval timeline
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/ApprovalTimeline"
|
||||
/api/v1/legal/qa:
|
||||
post:
|
||||
operationId: proxyLegalQa
|
||||
summary: Answer a legal question through the shared AI platform
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/TraceIdHeader"
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/LegalQaRequest"
|
||||
responses:
|
||||
"200":
|
||||
description: Legal QA answer
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/LegalQaResponse"
|
||||
/api/v1/search:
|
||||
get:
|
||||
operationId: search
|
||||
summary: Unified search
|
||||
parameters:
|
||||
- name: keyword
|
||||
in: query
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: type
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
enum: [contract, review, file, template]
|
||||
- name: sort
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
enum: [updated_at_desc, relevance]
|
||||
default: updated_at_desc
|
||||
responses:
|
||||
"200":
|
||||
description: Search results
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/SearchResultPage"
|
||||
/api/v1/files:
|
||||
get:
|
||||
operationId: listFiles
|
||||
summary: List repository files
|
||||
parameters:
|
||||
- $ref: "#/components/parameters/Page"
|
||||
- $ref: "#/components/parameters/PageSize"
|
||||
- name: keyword
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: File page
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/FilePage"
|
||||
components:
|
||||
parameters:
|
||||
TraceIdHeader:
|
||||
name: X-Trace-Id
|
||||
in: header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
Page:
|
||||
name: page
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
default: 1
|
||||
PageSize:
|
||||
name: page_size
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 100
|
||||
default: 20
|
||||
schemas:
|
||||
HealthResponse:
|
||||
type: object
|
||||
required:
|
||||
- status
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
enum: [ok]
|
||||
service:
|
||||
type: string
|
||||
LoginRequest:
|
||||
type: object
|
||||
required:
|
||||
- email
|
||||
- password
|
||||
properties:
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
password:
|
||||
type: string
|
||||
LoginResponse:
|
||||
type: object
|
||||
required:
|
||||
- access_token
|
||||
- user
|
||||
properties:
|
||||
access_token:
|
||||
type: string
|
||||
user:
|
||||
$ref: "#/components/schemas/UserProfile"
|
||||
UserProfile:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- email
|
||||
- role
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
nullable: true
|
||||
role:
|
||||
type: string
|
||||
enum: [admin, legal, business_submitter, approver, observer]
|
||||
WorkspaceSummary:
|
||||
type: object
|
||||
required:
|
||||
- pending_tasks
|
||||
- quick_actions
|
||||
properties:
|
||||
pending_tasks:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/WorkspaceTask"
|
||||
quick_actions:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
WorkspaceTask:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- title
|
||||
- type
|
||||
- target_url
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
target_url:
|
||||
type: string
|
||||
ContractListItem:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- title
|
||||
- status
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
enum: [draft, reviewing, approval_pending, approved, signed, archived, rejected]
|
||||
counterparty:
|
||||
type: string
|
||||
nullable: true
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
ContractPage:
|
||||
type: object
|
||||
required:
|
||||
- items
|
||||
- page
|
||||
- page_size
|
||||
- total
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/ContractListItem"
|
||||
page:
|
||||
type: integer
|
||||
page_size:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
CreateContractRequest:
|
||||
type: object
|
||||
required:
|
||||
- title
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
contract_type:
|
||||
type: string
|
||||
nullable: true
|
||||
counterparty:
|
||||
type: string
|
||||
nullable: true
|
||||
source_text:
|
||||
type: string
|
||||
nullable: true
|
||||
ContractDetail:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- title
|
||||
- status
|
||||
- next_actions
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
title:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
body_preview:
|
||||
type: string
|
||||
nullable: true
|
||||
next_actions:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
ReviewTask:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- status
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
enum: [queued, running, succeeded, failed]
|
||||
SubmitApprovalRequest:
|
||||
type: object
|
||||
properties:
|
||||
comment:
|
||||
type: string
|
||||
nullable: true
|
||||
ApprovalTimeline:
|
||||
type: object
|
||||
required:
|
||||
- items
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/ApprovalTimelineItem"
|
||||
ApprovalTimelineItem:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- action
|
||||
- actor_name
|
||||
- created_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
action:
|
||||
type: string
|
||||
actor_name:
|
||||
type: string
|
||||
comment:
|
||||
type: string
|
||||
nullable: true
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
LegalCitation:
|
||||
type: object
|
||||
required:
|
||||
- source_type
|
||||
- title
|
||||
- reference
|
||||
- quote
|
||||
properties:
|
||||
source_type:
|
||||
type: string
|
||||
enum: [law, regulation, judicial_interpretation, internal_policy, contract_clause, knowledge_document]
|
||||
title:
|
||||
type: string
|
||||
reference:
|
||||
type: string
|
||||
quote:
|
||||
type: string
|
||||
url:
|
||||
type: string
|
||||
nullable: true
|
||||
LegalQaRequest:
|
||||
type: object
|
||||
required:
|
||||
- question
|
||||
properties:
|
||||
question:
|
||||
type: string
|
||||
matter_context:
|
||||
type: string
|
||||
nullable: true
|
||||
knowledge_base_ids:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
LegalQaResponse:
|
||||
type: object
|
||||
required:
|
||||
- answer
|
||||
- citations
|
||||
properties:
|
||||
answer:
|
||||
type: string
|
||||
citations:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/LegalCitation"
|
||||
confidence:
|
||||
type: number
|
||||
format: float
|
||||
nullable: true
|
||||
SearchResult:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- type
|
||||
- title
|
||||
- url
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
enum: [contract, review, file, template]
|
||||
title:
|
||||
type: string
|
||||
snippet:
|
||||
type: string
|
||||
nullable: true
|
||||
url:
|
||||
type: string
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
SearchResultPage:
|
||||
type: object
|
||||
required:
|
||||
- items
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/SearchResult"
|
||||
FileItem:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- file_name
|
||||
- status
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
file_name:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
enum: [uploaded, processing, ready, failed]
|
||||
related_contract_id:
|
||||
type: string
|
||||
nullable: true
|
||||
FilePage:
|
||||
type: object
|
||||
required:
|
||||
- items
|
||||
- page
|
||||
- page_size
|
||||
- total
|
||||
properties:
|
||||
items:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/FileItem"
|
||||
page:
|
||||
type: integer
|
||||
page_size:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
@@ -0,0 +1,5 @@
|
||||
# Yuqei Design System
|
||||
|
||||
Shared V2 design tokens and workflow primitives.
|
||||
|
||||
This package starts intentionally small. It holds product language, layout constants, tokens, and workflow metadata before it grows into a component library.
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "@yuqei/design-system",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"types": "./src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"files": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./tokens";
|
||||
export * from "./workflow";
|
||||
@@ -0,0 +1,33 @@
|
||||
export const brandTokens = {
|
||||
color: {
|
||||
ink: "#172033",
|
||||
muted: "#667085",
|
||||
line: "#d9e0ea",
|
||||
canvas: "#f6f8fb",
|
||||
surface: "#ffffff",
|
||||
primary: "#2457d6",
|
||||
primarySoft: "#eaf0ff",
|
||||
success: "#16794c",
|
||||
successSoft: "#e7f6ef",
|
||||
warning: "#b35b00",
|
||||
warningSoft: "#fff3df",
|
||||
danger: "#bd2d2d",
|
||||
dangerSoft: "#fdecec",
|
||||
accent: "#0b7a75",
|
||||
accentSoft: "#e4f5f3"
|
||||
},
|
||||
radius: {
|
||||
sm: "6px",
|
||||
md: "8px"
|
||||
},
|
||||
shadow: {
|
||||
panel: "0 10px 30px rgba(16, 24, 40, 0.08)"
|
||||
},
|
||||
layout: {
|
||||
sidebarWidth: "248px",
|
||||
topbarHeight: "64px",
|
||||
contentMaxWidth: "1440px"
|
||||
}
|
||||
} as const;
|
||||
|
||||
export type BrandTokens = typeof brandTokens;
|
||||
@@ -0,0 +1,24 @@
|
||||
export const mainFlow = [
|
||||
{
|
||||
key: "draft",
|
||||
title: "合同起草",
|
||||
description: "从模板或智能问答快速生成合同初稿。"
|
||||
},
|
||||
{
|
||||
key: "review",
|
||||
title: "法律审查",
|
||||
description: "审查风险、补齐依据、形成处理意见。"
|
||||
},
|
||||
{
|
||||
key: "approve",
|
||||
title: "协同审批",
|
||||
description: "按条件触发审批,不默认压迫所有用户。"
|
||||
},
|
||||
{
|
||||
key: "archive",
|
||||
title: "归档履约",
|
||||
description: "沉淀文件、审计、版本和履约证据。"
|
||||
}
|
||||
] as const;
|
||||
|
||||
export type MainFlowStep = (typeof mainFlow)[number];
|
||||
Reference in New Issue
Block a user