- 3 CRUD JSON files: customer_balance, accounting_records, sync_state - Build script with model validation, CRUD validation, DDL generation - DDL: db/schema.sql (72 lines, 7 tables) - Scripts: validate_models.py, validate_crud.py, generate_ddl.py
42 lines
2.7 KiB
JSON
42 lines
2.7 KiB
JSON
{
|
|
"accounting_records": {
|
|
"params": {
|
|
"title": "记账记录管理",
|
|
"dbname": "sageapi",
|
|
"page_size": 20
|
|
},
|
|
"fields": [
|
|
{"name": "id", "title": "记录ID", "type": "string", "readonly": true, "width": 120},
|
|
{"name": "customer_id", "title": "客户ID", "type": "string", "width": 120},
|
|
{"name": "llmid", "title": "模型ID", "type": "string", "width": 120},
|
|
{"name": "model_name", "title": "模型名称", "type": "string", "width": 140},
|
|
{"name": "pricing_id", "title": "定价ID", "type": "string", "width": 100},
|
|
{"name": "input_tokens", "title": "输入Token", "type": "int", "width": 90, "align": "right"},
|
|
{"name": "output_tokens", "title": "输出Token", "type": "int", "width": 90, "align": "right"},
|
|
{"name": "total_tokens", "title": "总Token", "type": "int", "width": 90, "align": "right"},
|
|
{"name": "quantity", "title": "用量", "type": "float", "width": 80, "align": "right"},
|
|
{"name": "amount", "title": "金额", "type": "float", "width": 90, "align": "right"},
|
|
{"name": "currency", "title": "货币", "type": "string", "width": 60},
|
|
{"name": "request_id", "title": "请求ID", "type": "string", "width": 120},
|
|
{"name": "transno", "title": "事务号", "type": "string", "width": 120},
|
|
{"name": "status", "title": "状态", "type": "select", "width": 80, "options": [{"value": "pending", "label": "待处理"}, {"value": "accounted", "label": "已记账"}, {"value": "failed", "label": "失败"}]},
|
|
{"name": "created_at", "title": "创建时间", "type": "datetime", "width": 160, "readonly": true},
|
|
{"name": "updated_at", "title": "更新时间", "type": "datetime", "width": 160, "readonly": true}
|
|
],
|
|
"list": {
|
|
"columns": ["id", "customer_id", "model_name", "amount", "total_tokens", "status", "created_at"],
|
|
"filters": [
|
|
{"field": "customer_id", "type": "text", "label": "客户ID"},
|
|
{"field": "status", "type": "select", "label": "状态", "options": [{"value": "", "label": "全部"}, {"value": "pending", "label": "待处理"}, {"value": "accounted", "label": "已记账"}, {"value": "failed", "label": "失败"}]},
|
|
{"field": "date_from", "type": "date", "label": "起始日期"},
|
|
{"field": "date_to", "type": "date", "label": "截止日期"}
|
|
],
|
|
"sort": {"field": "created_at", "order": "desc"}
|
|
},
|
|
"view": {"fields": ["id", "customer_id", "llmid", "model_name", "pricing_id", "input_tokens", "output_tokens", "total_tokens", "quantity", "amount", "currency", "request_id", "transno", "status", "created_at", "updated_at"]},
|
|
"create": {"enabled": false},
|
|
"update": {"enabled": false},
|
|
"delete": {"enabled": false}
|
|
}
|
|
}
|