From 6a3cace0e8362ff4413d9b4817f624d638e892b2 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Mon, 22 Jun 2026 17:02:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AE=B0=E8=B4=A6=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E6=B8=85=E7=90=86llmusage=5Faccount?= =?UTF-8?q?ing=5Ffailed=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- llmage/accounting.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/llmage/accounting.py b/llmage/accounting.py index 93a40fe..a4acaed 100644 --- a/llmage/accounting.py +++ b/llmage/accounting.py @@ -336,6 +336,15 @@ async def backend_accounting(): else: debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local') await llm_accounting(lu) + # 记账成功,清理对应的失败记录 + try: + async with get_sor_context(env, 'llmage') as sor: + await sor.execute( + "DELETE FROM llmusage_accounting_failed WHERE llmusageid=${luid}$", + {'luid': lu.id} + ) + except Exception as e2: + debug(f'清理失败记录异常(不影响记账): {e2}') except Exception as e: exception(f'{e}, {lu.id=}') await llm_accoung_failed(lu.id, reason=str(e))