- 新增 llmusage_history 表:定时备份已记账(use_date<today)的历史记录 - 新增 llmusage_accounting_failed 表:记录记账失败详情,支持检索 - 新增 backup_accounted_llmusage() 函数:备份+清理历史数据 - 新增 get_failed_accounting_records() 函数:按条件检索失败记录 - 更新 llm_accoung_failed():同时写入失败表记录 - 新增 failed_accounting.ui 页面和 failed_accounting_list.dspy API - 新增 llmusage CRUD API (create/update/delete) - 新增表索引优化查询性能 - 更新 setup_llmage_perms.sh 添加新端点权限 - 生成生产迁移SQL: scripts/migrate_llmusage_history.sql
142 lines
3.2 KiB
JSON
142 lines
3.2 KiB
JSON
{
|
|
"summary": [
|
|
{
|
|
"name": "llmusage_history",
|
|
"title": "模型使用历史记录",
|
|
"primary": ["id"],
|
|
"catelog": "entity"
|
|
}
|
|
],
|
|
"fields": [
|
|
{
|
|
"name": "id",
|
|
"title": "id",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "llmid",
|
|
"title": "模型id",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "use_date",
|
|
"title": "使用日期",
|
|
"type": "date"
|
|
},
|
|
{
|
|
"name": "use_time",
|
|
"title": "使用时间",
|
|
"type": "timestamp"
|
|
},
|
|
{
|
|
"name": "userid",
|
|
"title": "用户id",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "usages",
|
|
"title": "使用信息",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "ioinfo",
|
|
"title": "交互内容",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"name": "transno",
|
|
"title": "交易号",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "responsed_seconds",
|
|
"title": "响应时间",
|
|
"type": "double",
|
|
"length": 18,
|
|
"dec": 3
|
|
},
|
|
{
|
|
"name": "finish_seconds",
|
|
"title": "结束时间",
|
|
"type": "double",
|
|
"length": 18,
|
|
"dec": 3
|
|
},
|
|
{
|
|
"name": "status",
|
|
"title": "状态",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "taskid",
|
|
"title": "任务号",
|
|
"type": "str",
|
|
"length": 256
|
|
},
|
|
{
|
|
"name": "amount",
|
|
"title": "交易金额",
|
|
"type": "double",
|
|
"length": 18,
|
|
"dec": 5
|
|
},
|
|
{
|
|
"name": "cost",
|
|
"title": "交易成本",
|
|
"type": "double",
|
|
"length": 18,
|
|
"dec": 5
|
|
},
|
|
{
|
|
"name": "userorgid",
|
|
"title": "用户机构id",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "ownerid",
|
|
"title": "模型机构id",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "accounting_status",
|
|
"title": "记账状态",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "backup_time",
|
|
"title": "备份时间",
|
|
"type": "timestamp"
|
|
}
|
|
],
|
|
"indexes": [
|
|
{
|
|
"name": "idx_lh_use_date",
|
|
"idxtype": "index",
|
|
"idxfields": ["use_date"]
|
|
},
|
|
{
|
|
"name": "idx_lh_userorgid",
|
|
"idxtype": "index",
|
|
"idxfields": ["userorgid"]
|
|
},
|
|
{
|
|
"name": "idx_lh_llmid",
|
|
"idxtype": "index",
|
|
"idxfields": ["llmid"]
|
|
},
|
|
{
|
|
"name": "idx_lh_backup_time",
|
|
"idxtype": "index",
|
|
"idxfields": ["backup_time"]
|
|
}
|
|
]
|
|
}
|