This commit is contained in:
yumoqing 2026-03-29 20:12:11 +08:00
parent f52a0e824c
commit 28af0c1e37
3 changed files with 17 additions and 8 deletions

View File

@ -147,10 +147,13 @@ async def query_task_status(request, upappid, apinames, luid, userid, taskid):
if rzt.status == 'SUCCEEDED': if rzt.status == 'SUCCEEDED':
if llm.ppid: if llm.ppid:
try: try:
chargings = await llm_charging(sor, charging = await llm_charging(sor,
llm.ppid, llmusage) llm.ppid, llmusage)
llmusage.amount = chargings.amount if charging:
llmusage.cost = chargings.cost llmusage.amount = charging.amount
llmusage.cost = charging.cost
else:
llmusage.amount = cost = 0.0
except Exception as e: except Exception as e:
e = Exception(f'{llm.pid} charging error{e}') e = Exception(f'{llm.pid} charging error{e}')
exception(f'{e}') exception(f'{e}')

View File

@ -97,8 +97,11 @@ async def uapi_request(request, llm, sor, callerid, callerorgid, params_kw=None)
if llm.ppid and callerorgid: if llm.ppid and callerorgid:
try: try:
chargings = await llm_charging(sor, llm.ppid, llmusage) chargings = await llm_charging(sor, llm.ppid, llmusage)
if chargings:
llmusage.amount = chargings.amount llmusage.amount = chargings.amount
llmusage.cost = chargings.cost llmusage.cost = chargings.cost
else:
llmusage.amount = llmusage.cost = 0.00
except Exception as e: except Exception as e:
e = Exception(f'{llm.pid} charging error{e}') e = Exception(f'{llm.pid} charging error{e}')
exception(f'{e}') exception(f'{e}')

View File

@ -59,9 +59,12 @@ async def sync_uapi_request(request, llm, sor, callerid, callerorgid, params_kw=
llmusage.status = 'SUCCEEDED' llmusage.status = 'SUCCEEDED'
if llm.ppid: if llm.ppid:
try: try:
chargings = await llm_charging(sor, llm.ppid, llmusage) charging = await llm_charging(sor, llm.ppid, llmusage)
llmusage.amount = chargings.amount if charging:
llmusage.cost = chargings.cost llmusage.amount = charging.amount
llmusage.cost = charging.cost
else:
llmusage.amount = llmusage.cost = 0.0
except Exception as e: except Exception as e:
e = Exception(f'{llm.pid} charging error{e}') e = Exception(f'{llm.pid} charging error{e}')
exception(f'{e}') exception(f'{e}')