From 74ab62a3b1e66229a296e74f674b60361449de18 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 30 Mar 2026 16:00:09 +0800 Subject: [PATCH] bugfix --- wwwroot/llmaccounting.dspy | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wwwroot/llmaccounting.dspy b/wwwroot/llmaccounting.dspy index e81331e..de668cb 100644 --- a/wwwroot/llmaccounting.dspy +++ b/wwwroot/llmaccounting.dspy @@ -4,6 +4,19 @@ async with get_sor_context(env, 'llmage') as sor: recs = await sor.sqlExe(sql, {}) for r in recs: try: + llms = await sor.R('llm', {'id': r.llmid}) + if len(llms) == 0: + e = Exception(f'{r.llmid=} not found in llm') + exception(f'{e}') + raise e + prices = await llm_charging(sor, llms[0].ppid, r) + if not prices: + e = Exception(f'{llms[0].ppid=}{r=} not price') + exception(f'{e}') + raise e + + r.amount = prices.amount + r.cost = prices.cost x = await llm_accounting(request, r) except Exception as e: exception(f'{r.id=} accounting error')