bugfix
This commit is contained in:
parent
b2f4b283cf
commit
6afbc71b13
@ -18,6 +18,29 @@ if userid is None:
|
||||
'error': f'sor_get_callerid() error'
|
||||
}
|
||||
try:
|
||||
name = params_kw.name
|
||||
if name is None:
|
||||
return {
|
||||
"status": "FAILED",
|
||||
"error": "name is None"
|
||||
}
|
||||
if media_file is None:
|
||||
return {
|
||||
"status": "FAILED",
|
||||
"error": "media_file is None"
|
||||
}
|
||||
assetType = params_kw.assetType
|
||||
if assetType is None:
|
||||
typ = media_file.split('.')[-1]
|
||||
if typ in ['png', 'webp', 'jpg', 'gif']:
|
||||
assetType = 'Image'
|
||||
elif typ in ['mp4', 'mov', 'avi']:
|
||||
assetType = 'Video'
|
||||
elif type in ['mp3', 'wav', 'aac']:
|
||||
assetType = 'Audio'
|
||||
else:
|
||||
assetType = None
|
||||
params_kw.assetType = assetType
|
||||
b = await uapi.call(upappid, apiname, userid, params=params_kw)
|
||||
if isinstance(b, bytes):
|
||||
b = b.decode('utf-8')
|
||||
|
||||
@ -48,5 +48,5 @@ if not f:
|
||||
debug(f'{userid=} balance not enough')
|
||||
return openai_429()
|
||||
# debug(f'{tools=}, {request._run_ns.tools=}')
|
||||
return await env.stream_response(request, gen)
|
||||
return await env.stream_response(request, gen, context_type='application/json')
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user