From 6876edae629b35860d8c0e13dd57f4f0aee3689d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 5 Jun 2026 16:58:09 +0800 Subject: [PATCH] bugfix --- llmage/accounting.py | 4 ++-- llmage/utils.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/llmage/accounting.py b/llmage/accounting.py index 8ab56a9..93a40fe 100644 --- a/llmage/accounting.py +++ b/llmage/accounting.py @@ -160,7 +160,7 @@ async def get_accounting_llmusages(luid=None): dt = datetime.fromtimestamp(t) tsstr = dt.strftime('%Y-%m-%d %H:%M:%S.') + f'{dt.microsecond // 1000:03d}' async with get_sor_context(env, 'llmage') as sor: - sql = """select a.*, c.ppid + sql = """select a.*, b.model, c.ppid from llmusage a, llm b, llm_api_map c where a.llmid = b.id and a.llmid = c.llmid @@ -332,7 +332,7 @@ async def backend_accounting(): tpac = await get_user_tpac(lu.userid) if tpac: debug(f'{lu.id=},{lu.userid=}, {tpac=}, go tpac') - await tpac_accounting(tpac, lu.userid, lu.llmid, lu.amount, lu.usages, lu.id) + await tpac_accounting(tpac, lu.userid, lu.llmid, lu.amount, lu.usages, lu.id, lu.model) else: debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local') await llm_accounting(lu) diff --git a/llmage/utils.py b/llmage/utils.py index 24b88d9..7d49ef0 100644 --- a/llmage/utils.py +++ b/llmage/utils.py @@ -93,13 +93,14 @@ async def get_tpac_balance(tpac, userid): exception(f'{url=}, {userid=}, error:{e}') return None -async def tpac_accounting(tpac, userid, llmid, amount, usage, luid): +async def tpac_accounting(tpac, userid, llmid, amount, usage, luid, model): url = tpac.tpac_accounting_url hc = StreamHttpClient() d = { 'userid': userid, 'llmid': llmid, 'amount': amount, + 'model': model, 'usage': usage } status = 'failed'