bugfix
This commit is contained in:
parent
8ad9dc27c0
commit
0faa577447
@ -119,7 +119,7 @@ async def uapi_request(request, llm, sor):
|
|||||||
yield json.dumps(d) + '\n'
|
yield json.dumps(d) + '\n'
|
||||||
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'{{"error": f"ERROR:{e=}"}}\n'
|
||||||
return
|
return
|
||||||
|
|
||||||
debug(f'{txt=}')
|
debug(f'{txt=}')
|
||||||
@ -135,11 +135,11 @@ async def sync_uapi_request(request, llm, sor):
|
|||||||
b = await uapi.call(llm.upappid, llm.apiname, userid, params=env.params_kw)
|
b = await uapi.call(llm.upappid, llm.apiname, userid, params=env.params_kw)
|
||||||
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'{{"error": f"ERROR:{e=}"}}\n'
|
||||||
return
|
return
|
||||||
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'finished:{b}')
|
||||||
yield b
|
yield b
|
||||||
|
|
||||||
async def async_uapi_request(request, llm, sor):
|
async def async_uapi_request(request, llm, sor):
|
||||||
@ -153,7 +153,7 @@ async def async_uapi_request(request, llm, sor):
|
|||||||
b = await uapi.call(llm.upappid, llm.apiname, userid, params=env.params_kw)
|
b = await uapi.call(llm.upappid, llm.apiname, userid, params=env.params_kw)
|
||||||
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'{{"error": f"ERROR:{e=}"}}\n'
|
||||||
return
|
return
|
||||||
if isinstance(b, bytes):
|
if isinstance(b, bytes):
|
||||||
b = b.decode('utf-8')
|
b = b.decode('utf-8')
|
||||||
@ -161,7 +161,7 @@ async def async_uapi_request(request, llm, sor):
|
|||||||
d = DictObject(**json.loads(b))
|
d = DictObject(**json.loads(b))
|
||||||
if not d.get('context'):
|
if not d.get('context'):
|
||||||
debug(f'{b} error')
|
debug(f'{b} error')
|
||||||
yield '{"content":"server return no taskid"}\n'
|
yield '{"error":"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(',') ]
|
apinames = [ name.strip() for name in llm.query_apiname.split(',') ]
|
||||||
@ -172,7 +172,7 @@ async def async_uapi_request(request, llm, sor):
|
|||||||
b = await uapi.call(llm.upappid, apiname, userid, params=d.context)
|
b = await uapi.call(llm.upappid, apiname, userid, params=d.context)
|
||||||
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'{{"error": f"ERROR:{e=}"}}\n'
|
||||||
break
|
break
|
||||||
|
|
||||||
if isinstance(b, bytes):
|
if isinstance(b, bytes):
|
||||||
@ -183,7 +183,7 @@ async def async_uapi_request(request, llm, sor):
|
|||||||
yield b + '\n'
|
yield b + '\n'
|
||||||
if not rzt.status or rzt.status == 'FAILED':
|
if not rzt.status or rzt.status == 'FAILED':
|
||||||
debug(f'{b=} return error')
|
debug(f'{b=} return error')
|
||||||
yield f'{{"content": f"ERROR:{e=}"}}\n'
|
yield f'{{"error": f"ERROR:{e=}"}}\n'
|
||||||
return
|
return
|
||||||
if rzt.status == 'SUCCEEDED':
|
if rzt.status == 'SUCCEEDED':
|
||||||
debug(f'{b=} return successed')
|
debug(f'{b=} return successed')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user