This commit is contained in:
yumoqing 2026-03-30 16:33:52 +08:00
parent c0bb34fc02
commit 657000178c

View File

@ -207,16 +207,20 @@ async def query_task_status(request, upappid, apiname, luid, userid, taskid):
else: else:
changed.amount = 0 changed.amount = 0
changed.cost = 0 changed.cost = 0
await add_new_llmusage_output(luid, changed)
if llmusage.accounting_status != 'accounted' and changed.amount > 0.00001:
llmusage.amount = changed.amount llmusage.amount = changed.amount
llmusage.cost = changed.cost llmusage.cost = changed.cost
await add_new_llmusage_output(luid, changed)
if changed.status == 'FAILED':
return
if changed.status == 'SUCCEEDED':
if llmusage.accounting_status != 'accounted' \
and changed.amount > 0.00001:
try: try:
await llm_accounting(request, llmusage) await llm_accounting(request, llmusage)
except Exception as e: except Exception as e:
debug(f'{changed=} accounting failed,{e=} ') debug(f'{changed=} accounting failed,{e=} ')
if changed.status in ['FAILED', 'SUCCEEDED']:
return return
await asyncio.sleep(llm.query_period or 30) await asyncio.sleep(llm.query_period or 30)
debug(f'{llm.query_period=} seconds will retry, {changed.status=}') debug(f'{llm.query_period=} seconds will retry, {changed.status=}')