From bd0cc6d5ad0064e34f0831f251279a09c4d00533 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 8 Apr 2026 17:07:32 +0800 Subject: [PATCH] bugfix --- llmage/accounting.py | 1 + wwwroot/test_llm_charging.dspy | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 wwwroot/test_llm_charging.dspy diff --git a/llmage/accounting.py b/llmage/accounting.py index e2fb0a1..92cf83e 100644 --- a/llmage/accounting.py +++ b/llmage/accounting.py @@ -181,6 +181,7 @@ where a.llmid = b.id await sor.U('llmusage', {'id': llmusage.id, 'accounting_status': 'failed'}) debug(f'{r.usages=} is None') continue + d = None try: if isinstance(r.usages, str): r.usages = json.loads(r.usages) diff --git a/wwwroot/test_llm_charging.dspy b/wwwroot/test_llm_charging.dspy new file mode 100644 index 0000000..5c5ac78 --- /dev/null +++ b/wwwroot/test_llm_charging.dspy @@ -0,0 +1,12 @@ +luid=params_kw.luid +env = ServerEnv() +async with get_sor_context(env, 'llmage') as sor: + sql = "select a.ppid, b.* from llm a, llmusage b where a.id=b.llmid and b.id=${id}$" + recs = await sor.sqlExe(sql, {'id': luid}) + if recs: + r = recs[0] + x = await llm_charging(r.ppid, r.usages) + return x + return {'sql': sql, 'luid': luid, 'error': 'llm not found'} +return { + 'error': 'error'}