fix: 记账成功后自动清理llmusage_accounting_failed记录
This commit is contained in:
parent
9b9e2a22d6
commit
6a3cace0e8
@ -336,6 +336,15 @@ async def backend_accounting():
|
|||||||
else:
|
else:
|
||||||
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local')
|
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local')
|
||||||
await llm_accounting(lu)
|
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:
|
except Exception as e:
|
||||||
exception(f'{e}, {lu.id=}')
|
exception(f'{e}, {lu.id=}')
|
||||||
await llm_accoung_failed(lu.id, reason=str(e))
|
await llm_accoung_failed(lu.id, reason=str(e))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user