refactor(platform_ability): 模型自动配置不再写价格四字段(模型表已删,定价走ppid)
This commit is contained in:
parent
8bb9a0c682
commit
495592dee5
@ -93,14 +93,12 @@ async def _h_platform_llm_status(sor, params, ctx):
|
||||
{"name": getattr(r, "name", ""), "balance": float(getattr(r, "balance", 0) or 0),
|
||||
"status": getattr(r, "status", "")} for r in (accs or [])]
|
||||
models = await sor.sqlExe(
|
||||
"SELECT name, vendor_model_id, capability, price_input, price_output, status "
|
||||
"SELECT name, vendor_model_id, capability, status "
|
||||
"FROM llm_model ORDER BY created_at DESC LIMIT 30", {})
|
||||
await sor.sqlExe("COMMIT", {})
|
||||
out["models"] = [
|
||||
{"name": getattr(r, "name", ""), "vendor_model_id": getattr(r, "vendor_model_id", ""),
|
||||
"capability": getattr(r, "capability", ""),
|
||||
"price_input": float(getattr(r, "price_input", 0) or 0),
|
||||
"price_output": float(getattr(r, "price_output", 0) or 0),
|
||||
"status": getattr(r, "status", "")} for r in (models or [])]
|
||||
return json.dumps(out, ensure_ascii=False)
|
||||
|
||||
@ -228,8 +226,6 @@ _EXTRACT_PROMPT = """你是大模型 API 配置专家。通读下面这份模型
|
||||
"async_steps": [{"purpose": "query|download", "path": "该步骤接口路径", "method": "GET|POST", "request_fields": ["请求字段名列表"], "response_format": "该步骤响应格式说明"}],
|
||||
"models": [{"vendor_model_id": "供应商侧模型ID", "capability": "t2t|t2i|i2t|t2v|embedding|rerank|tts|asr",
|
||||
"sync_mode": "sync|async(提交后需轮询查询结果的填 async)",
|
||||
"price_input": 输入价元/千token或null, "price_output": 输出价元/千token或null,
|
||||
"cost_input": 输入成本元/千token或null, "cost_output": 输出成本元/千token或null,
|
||||
"description": "一句话说明"}],
|
||||
"doc_notes": "文档中影响配置的关键注意点"
|
||||
}
|
||||
@ -391,14 +387,7 @@ async def _h_apply_llm_config(sor, params, ctx):
|
||||
continue
|
||||
cap = m.get("capability") or "t2t"
|
||||
sync_mode = "async" if str(m.get("sync_mode") or "").strip() == "async" else "sync"
|
||||
raw_pi, raw_po = m.get("price_input"), m.get("price_output")
|
||||
price_in, price_out = _f(raw_pi), _f(raw_po)
|
||||
cost_in = _f(m.get("cost_input"), price_in)
|
||||
cost_out = _f(m.get("cost_output"), price_out)
|
||||
desc = (m.get("description", "") or "").strip()
|
||||
# 文档未给价(null)→ 落 0 并显式标注,避免「0=免费」歧义
|
||||
if raw_pi is None or raw_po is None:
|
||||
desc = "⚠️文档未列定价(暂落0,需人工补录)。" + desc
|
||||
# 异步模型:后续步骤模板链(提交后顺序执行 query→[download])
|
||||
query_ids = []
|
||||
if sync_mode == "async":
|
||||
@ -417,12 +406,10 @@ async def _h_apply_llm_config(sor, params, ctx):
|
||||
if recs:
|
||||
mid = getattr(recs[0], "id", "")
|
||||
await sor.sqlExe(
|
||||
"UPDATE llm_model SET price_input=${pi}$, price_output=${po}$, "
|
||||
"cost_input=${ci}$, cost_output=${co}$, description=${d}$, "
|
||||
"UPDATE llm_model SET description=${d}$, "
|
||||
"sync_mode=${sm}$, query_profile_ids=${q}$, updated_at=NOW() "
|
||||
"WHERE id=${i}$",
|
||||
{"pi": price_in, "po": price_out, "ci": cost_in, "co": cost_out,
|
||||
"d": desc, "sm": sync_mode, "q": query_ids_json, "i": mid})
|
||||
{"d": desc, "sm": sync_mode, "q": query_ids_json, "i": mid})
|
||||
await sor.sqlExe("COMMIT", {})
|
||||
updated.append(vmid)
|
||||
continue
|
||||
@ -432,8 +419,7 @@ async def _h_apply_llm_config(sor, params, ctx):
|
||||
"name": vmid, "vendor_model_id": vmid, "capability": cap,
|
||||
"sync_mode": sync_mode, "profile_id": profile_ids.get(cap, ""),
|
||||
"query_profile_ids": query_ids_json,
|
||||
"ppid": "", "price_input": price_in, "price_output": price_out,
|
||||
"cost_input": cost_in, "cost_output": cost_out,
|
||||
"ppid": "",
|
||||
"default_params": "{}", "status": "active",
|
||||
"description": desc, "org_id": "0"})
|
||||
created.append(vmid)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user