bugfix
This commit is contained in:
parent
3817955fa4
commit
0e2bf3fb80
@ -95,6 +95,7 @@ async def uapi_request(request, llm, sor):
|
|||||||
uapi = UAPI(request, sor=sor)
|
uapi = UAPI(request, sor=sor)
|
||||||
userid = await get_owner_userid(sor, llm)
|
userid = await get_owner_userid(sor, llm)
|
||||||
txt = ''
|
txt = ''
|
||||||
|
try:
|
||||||
async for l in uapi.stream_linify(llm.upappid, llm.apiname, userid,
|
async for l in uapi.stream_linify(llm.upappid, llm.apiname, userid,
|
||||||
params=env.params_kw):
|
params=env.params_kw):
|
||||||
if l and l != '[DONE]':
|
if l and l != '[DONE]':
|
||||||
@ -115,6 +116,11 @@ async def uapi_request(request, llm, sor):
|
|||||||
yield l
|
yield l
|
||||||
else:
|
else:
|
||||||
debug(f'{l} not yield')
|
debug(f'{l} not yield')
|
||||||
|
except Exception as e:
|
||||||
|
exception(f'{e=},{format_exc()}')
|
||||||
|
yield f'{{"content": f"ERROR:{e=}"}}\n'
|
||||||
|
return
|
||||||
|
|
||||||
debug(f'{txt=}')
|
debug(f'{txt=}')
|
||||||
|
|
||||||
async def async_uapi_request(request, llm, sor):
|
async def async_uapi_request(request, llm, sor):
|
||||||
@ -123,7 +129,13 @@ async def async_uapi_request(request, llm, sor):
|
|||||||
callerid = await env.get_user()
|
callerid = await env.get_user()
|
||||||
uapi = UAPI(request, sor=sor)
|
uapi = UAPI(request, sor=sor)
|
||||||
userid = await get_owner_userid(sor, llm)
|
userid = await get_owner_userid(sor, llm)
|
||||||
|
b = None
|
||||||
|
try:
|
||||||
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:
|
||||||
|
exception(f'{e=},{format_exc()}')
|
||||||
|
yield f'{{"content": f"ERROR:{e=}"}}\n'
|
||||||
|
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'task sumbited:{b}')
|
||||||
@ -134,11 +146,18 @@ async def async_uapi_request(request, llm, sor):
|
|||||||
return
|
return
|
||||||
uapi = UAPI(request, sor=sor)
|
uapi = UAPI(request, sor=sor)
|
||||||
while True:
|
while True:
|
||||||
|
b = None
|
||||||
|
try:
|
||||||
b = await uapi.call(llm.upappid, llm.query_apiname, userid,
|
b = await uapi.call(llm.upappid, llm.query_apiname, userid,
|
||||||
params={
|
params={
|
||||||
"taskid": d.get('taskid')
|
"taskid": d.get('taskid')
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
except Exception as e:
|
||||||
|
exception(f'{e=},{format_exc()}')
|
||||||
|
yield f'{{"content": f"ERROR:{e=}"}}\n'
|
||||||
|
return
|
||||||
|
|
||||||
if isinstance(b, bytes):
|
if isinstance(b, bytes):
|
||||||
b = b.decode('utf-8')
|
b = b.decode('utf-8')
|
||||||
b = ''.join(b.split('\n'))
|
b = ''.join(b.split('\n'))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user