fix: 修复check_*.dspy的false/False错误和pricingdata表查询

This commit is contained in:
Hermes Agent 2026-06-16 17:19:03 +08:00
parent cef9e0bc52
commit ab83f05d63
8 changed files with 37 additions and 31 deletions

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ 日期与状态: 缺少llmid参数", "i18n": false}
"options": {"text": "❌ 日期与状态: 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -13,7 +13,7 @@ async with get_sor_context(request._run_ns, 'llmage') as sor:
if not recs:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ 日期与状态: 模型不存在", "i18n": false}
"options": {"text": "❌ 日期与状态: 模型不存在", "i18n": False}
}, ensure_ascii=False)
llm = recs[0]
@ -27,5 +27,5 @@ else:
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ 能力映射(llm_api_map): 缺少llmid参数", "i18n": false}
"options": {"text": "❌ 能力映射(llm_api_map): 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -18,5 +18,5 @@ else:
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ 模型记录: 缺少llmid参数", "i18n": false}
"options": {"text": "❌ 模型记录: 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -18,5 +18,5 @@ else:
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ 定价数据(pricingdata): 缺少llmid参数", "i18n": false}
"options": {"text": "❌ 定价数据: 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -12,25 +12,31 @@ async with get_sor_context(request._run_ns, 'llmage') as sor:
ppids = [m.ppid for m in maps if m.ppid] if maps else []
if not ppids:
text = "❌ 定价数据(pricingdata): 无定价项目"
text = "❌ 定价数据: 无定价项目"
else:
ppid = ppids[0]
async with get_sor_context(request._run_ns, 'pricing') as psor:
# First check if pricing_program exists
pregs = await psor.sqlExe(
"select * from pricing_program where id=${ppid}$", {'ppid': ppid})
if not pregs:
text = "❌ 定价数据(pricingdata): 依赖定价项目未通过"
else:
datas = await psor.sqlExe(
"select count(*) as cnt from pricingdata where ppid=${ppid}$", {'ppid': ppid})
cnt = datas[0].cnt if datas else 0
if cnt > 0:
text = f"✅ 定价数据(pricingdata): {cnt}条记录"
try:
async with get_sor_context(request._run_ns, 'pricing') as psor:
pregs = await psor.sqlExe(
"select * from pricing_program where id=${ppid}$", {'ppid': ppid})
if not pregs:
text = "❌ 定价数据: 依赖定价项目未通过"
else:
text = "❌ 定价数据(pricingdata): 无定价数据"
# 检查 pricing_program_timing 表
try:
timings = await psor.sqlExe(
"select count(*) as cnt from pricing_program_timing where ppid=${ppid}$", {'ppid': ppid})
cnt = timings[0].cnt if timings else 0
if cnt > 0:
text = f"✅ 定价数据(pricing_program_timing): {cnt}条记录"
else:
text = "❌ 定价数据: pricing_program_timing 无记录"
except Exception as e:
text = f"❌ 定价数据: {e}"
except Exception as e:
text = f"❌ 定价数据: {e}"
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ 定价项目(pricing_program): 缺少llmid参数", "i18n": false}
"options": {"text": "❌ 定价项目(pricing_program): 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -25,5 +25,5 @@ else:
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ API映射(uapi): 缺少llmid参数", "i18n": false}
"options": {"text": "❌ API映射(uapi): 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -26,5 +26,5 @@ else:
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ IO定义(uapiio): 缺少llmid参数", "i18n": false}
"options": {"text": "❌ IO定义(uapiio): 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -29,5 +29,5 @@ async with get_sor_context(request._run_ns, 'llmage') as sor:
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)

View File

@ -3,7 +3,7 @@ llmid = params_kw.get('llmid', '')
if not llmid:
return json.dumps({
"widgettype": "Text",
"options": {"text": "❌ 上位系统(upapp): 缺少llmid参数", "i18n": false}
"options": {"text": "❌ 上位系统(upapp): 缺少llmid参数", "i18n": False}
}, ensure_ascii=False)
async with get_sor_context(request._run_ns, 'llmage') as sor:
@ -23,5 +23,5 @@ async with get_sor_context(request._run_ns, 'llmage') as sor:
return json.dumps({
"widgettype": "Text",
"options": {"text": text, "i18n": false}
"options": {"text": text, "i18n": False}
}, ensure_ascii=False)