bugfix
This commit is contained in:
parent
230d6d8198
commit
db8571d8da
@ -159,6 +159,7 @@ async def query_task_status(request, upappid, apiname, luid, userid, taskid):
|
|||||||
apinames = apiname.split(',')
|
apinames = apiname.split(',')
|
||||||
for apiname in apinames:
|
for apiname in apinames:
|
||||||
status = 'unknown'
|
status = 'unknown'
|
||||||
|
changed = None
|
||||||
while status != 'SUCCEEDED':
|
while status != 'SUCCEEDED':
|
||||||
ns = {'taskid': taskid}
|
ns = {'taskid': taskid}
|
||||||
d = None
|
d = None
|
||||||
@ -167,6 +168,10 @@ async def query_task_status(request, upappid, apiname, luid, userid, taskid):
|
|||||||
if isinstance(b, bytes):
|
if isinstance(b, bytes):
|
||||||
b = b.decode('utf-8')
|
b = b.decode('utf-8')
|
||||||
d = json.loads(b)
|
d = json.loads(b)
|
||||||
|
changed = DictObject(**{
|
||||||
|
'status': d['status'],
|
||||||
|
'output': d
|
||||||
|
})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
changed = {
|
changed = {
|
||||||
@ -175,12 +180,8 @@ async def query_task_status(request, upappid, apiname, luid, userid, taskid):
|
|||||||
}
|
}
|
||||||
await add_new_llmusage_output(luid, changed)
|
await add_new_llmusage_output(luid, changed)
|
||||||
return
|
return
|
||||||
changed = DictObject(**{
|
if changed.status == 'SUCCEEDED':
|
||||||
'status': rzt['status'],
|
llmusage.usage = changed.output.usage
|
||||||
'output': rzt
|
|
||||||
})
|
|
||||||
if rzt.status == 'SUCCEEDED':
|
|
||||||
llmusage.usage = rzt['usage']
|
|
||||||
llms = await sor.R('llm', {'id': llmusage.llmid})
|
llms = await sor.R('llm', {'id': llmusage.llmid})
|
||||||
if len(llms) == 0:
|
if len(llms) == 0:
|
||||||
e = Exception(f'{llmusage.llmid=} not found in llm')
|
e = Exception(f'{llmusage.llmid=} not found in llm')
|
||||||
@ -206,8 +207,7 @@ async def query_task_status(request, upappid, apiname, luid, userid, taskid):
|
|||||||
await add_new_llmusage_output(luid, changed)
|
await add_new_llmusage_output(luid, changed)
|
||||||
if llmusage.accounting_status != 'accounted' and changed.amount > 0.00001:
|
if llmusage.accounting_status != 'accounted' and changed.amount > 0.00001:
|
||||||
await llm_accounting(request, llmusage)
|
await llm_accounting(request, llmusage)
|
||||||
status = rzt.status
|
if changed.status == 'FAILED':
|
||||||
if rzt.status == 'FAILED':
|
|
||||||
return
|
return
|
||||||
await asyncio.sleep(0.1)
|
await asyncio.sleep(0.1)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user