This commit is contained in:
yumoqing 2025-09-19 18:09:59 +08:00
parent 182f14776d
commit e5919ce4a5

View File

@ -142,24 +142,22 @@ async def async_uapi_request(request, llm, sor):
if isinstance(b, bytes): if isinstance(b, bytes):
b = b.decode('utf-8') b = b.decode('utf-8')
debug(f'task sumbited:{b}') debug(f'task sumbited:{b}')
d = json.loads(b) d = DictObject(**json.loads(b))
if not d.get('taskid'): if not d.get('context'):
debug(f'{b} error') debug(f'{b} error')
yield '{"content":"server return no taskid"}\n' yield '{"content":"server return no taskid"}\n'
return return
uapi = UAPI(request, sor=sor) uapi = UAPI(request, sor=sor)
apinames = [ name.strip() for name in llm.query_apiname.split(',') ]
for apiname in apinames:
while True: while True:
b = None b = None
try: try:
b = await uapi.call(llm.upappid, llm.query_apiname, userid, b = await uapi.call(llm.upappid, llm.query_apiname, userid, params=d.context)
params={
"taskid": d.get('taskid')
}
)
except Exception as e: except Exception as e:
exception(f'{e=},{format_exc()}') exception(f'{e=},{format_exc()}')
yield f'{{"content": f"ERROR:{e=}"}}\n' yield f'{{"content": f"ERROR:{e=}"}}\n'
return break
if isinstance(b, bytes): if isinstance(b, bytes):
b = b.decode('utf-8') b = b.decode('utf-8')
@ -173,7 +171,8 @@ async def async_uapi_request(request, llm, sor):
if rzt.status == 'SUCCEEDED': if rzt.status == 'SUCCEEDED':
debug(f'{b=} return successed') debug(f'{b=} return successed')
await asyncio.sleep(1) await asyncio.sleep(1)
return d = rzt
break
period = llm.query_period or 30 period = llm.query_period or 30
await asyncio.sleep(period) await asyncio.sleep(period)