feat(platform): 记账verdict对齐NULL语义+模板method独立列写入(2026-09-06用户定夺)

- check_model_accounting: created必为SUCCEEDED真待记账;NULL行报充值对账/调用未成功(不计费),消灭21条失败行冒充待记账的误报
- 提交模板创建写method=POST独立列;查询/下载模板method入列,GET时request_template不再塞{method}
- 技能model-auto-config同步status统一枚举+NULL语义+method列(随core仓c27b6af)
This commit is contained in:
yumoqing 2026-09-06 17:15:53 +08:00
parent 62bc591f80
commit 9a4e3e87b8

View File

@ -738,6 +738,8 @@ async def _h_apply_llm_config(sor, params, ctx):
"id": pid, "name": "%s-%s-自动配置" % (protocol, cap),
"protocol": protocol, "capability": cap,
"path": tpl["path"],
# method 独立列2026-09-06 用户定夺):提交类模板恒 POST
"method": "POST",
"headers": json.dumps(tpl["headers"], ensure_ascii=False),
"request_template": tpl["req"], "response_template": tpl["resp"],
"param_schema": json.dumps(tpl["param_schema"], ensure_ascii=False),
@ -1529,11 +1531,11 @@ async def _ensure_step_profile(sor, protocol, cap, vmid, step, spec):
await sor.sqlExe("COMMIT", {})
# 旧骨架弃用——继续往下重建(不 return
headers = _headers_from_spec(spec)
# method 独立列2026-09-06 用户定夺):不再塞 request_template JSON
if method == "GET":
req = json.dumps({"method": method}, ensure_ascii=False)
req = ""
else:
req = json.dumps({"method": method,
"data": {"task_id": "{task_id}"}}, ensure_ascii=False)
req = json.dumps({"data": {"task_id": "{task_id}"}}, ensure_ascii=False)
# 查询步骤的响应解析在运行时由提交模板的 response_template 接管
# inference._async_inference 轮询后直接用提交模板渲染),这里存档即可
resp = json.dumps({
@ -1543,7 +1545,7 @@ async def _ensure_step_profile(sor, protocol, cap, vmid, step, spec):
pid = getID()
await sor.C("llm_api_profile", {
"id": pid, "name": shared_name, "protocol": protocol, "capability": cap,
"path": path,
"path": path, "method": method,
"headers": json.dumps(headers, ensure_ascii=False),
"request_template": req, "response_template": resp,
"param_schema": "", "status": "active"})
@ -1870,17 +1872,18 @@ async def _h_check_model_accounting(sor, params, ctx):
"模型未映射产品→产品管理导入产线模型;"
"定价无匹配档位→核对usages维度值与定价YAML是否一致")
elif st == "created":
# m0011 设计accounting_status 只对 status='ok' 行有意义——
# failed 调用行/recharge 充值行挂 created 是被出账循环天然排除(不计费),
# 不是「待记账」2026-09-06 实测:助手把 21 条 failed 行误报成待记账)
# 2026-09-06 用户定夺:只有 status='SUCCEEDED' 的行才写 accounting_status
# 非 SUCCEEDED 行为 NULL不再挂 created 冒充待记账)——
# 走到这里必然是 SUCCEEDED 成功调用的真待记账行
item["verdict"] = "待记账出账循环60秒一轮稍后复查持续不变查记账worker进程"
elif not st:
# accounting_status=NULL无记账意义调用失败行/充值对账行)
call_st = row.get("status", "")
if call_st == "recharge":
item["verdict"] = "充值对账流水(非计费用量,不参与出账)"
elif call_st != "ok":
item["verdict"] = "调用失败行(不计费,出账循环天然排除)"
item["reason"] = (row.get("note") or "")[:200]
item["verdict"] = "充值对账流水非计费用量accounting_status=NULL"
else:
item["verdict"] = "待记账出账循环60秒一轮稍后复查持续不变查记账worker进程"
item["verdict"] = "调用未成功行status=%s不计费accounting_status=NULL" % call_st
item["reason"] = (row.get("note") or "")[:200]
elif st == "accounted":
# 独立复算:用 usages 因子过定价引擎,对比 charge
item["verdict"] = "已记账"