bugfix
This commit is contained in:
parent
f56141c4db
commit
d487da7803
@ -203,7 +203,6 @@ async def backend_accounting():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'{e}')
|
exception(f'{e}')
|
||||||
lus = []
|
lus = []
|
||||||
debug(f'get accounting {len(lus)} lus')
|
|
||||||
for lu in lus:
|
for lu in lus:
|
||||||
try:
|
try:
|
||||||
debug(f'backend_accounting(): {lu.id=} handleing...')
|
debug(f'backend_accounting(): {lu.id=} handleing...')
|
||||||
|
|||||||
@ -128,30 +128,6 @@ async def uapi_request(request, llm, sor, callerid, callerorgid, params_kw=None)
|
|||||||
# await write_llmusage(luid, llm, callerid, None, params_kw, outlines, sor)
|
# await write_llmusage(luid, llm, callerid, None, params_kw, outlines, sor)
|
||||||
return
|
return
|
||||||
|
|
||||||
def b64media2url(request, mediafile):
|
|
||||||
env = request._run_ns
|
|
||||||
entire_url = env.entire_url
|
|
||||||
if mediafile.startswith('data:'):
|
|
||||||
try:
|
|
||||||
fs = FileStorage()
|
|
||||||
fname = getFilenameFromBase64(mediafile)
|
|
||||||
fpath = fs._name2path(fname)
|
|
||||||
base64_to_file(mediafile, fpath)
|
|
||||||
path = fs.webpath(fpath)
|
|
||||||
return entire_url('/idfile?path=') + env.quote(path)
|
|
||||||
except Exception as e:
|
|
||||||
e = Exception(f'{e}\n{format_exc()}')
|
|
||||||
exception(f'{e}')
|
|
||||||
return ''
|
|
||||||
elif len(mediafile) > 8000:
|
|
||||||
e = Exception(f'mediafile is not a media file')
|
|
||||||
exception(f'{e}')
|
|
||||||
return ''
|
|
||||||
if mediafile.startswith('http://') or mediafile.startswith('https://'):
|
|
||||||
return mediafile
|
|
||||||
url = entire_url('/idfile?path=') + env.quote(mediafile)
|
|
||||||
return url
|
|
||||||
|
|
||||||
async def inference_generator(request, *args, params_kw=None, **kw):
|
async def inference_generator(request, *args, params_kw=None, **kw):
|
||||||
env = request._run_ns.copy()
|
env = request._run_ns.copy()
|
||||||
callerorgid = await env.get_userorgid()
|
callerorgid = await env.get_userorgid()
|
||||||
|
|||||||
@ -14,6 +14,30 @@ from uapi.appapi import UAPI, sor_get_callerid, sor_get_uapi
|
|||||||
from ahserver.serverenv import get_serverenv, ServerEnv
|
from ahserver.serverenv import get_serverenv, ServerEnv
|
||||||
from ahserver.filestorage import FileStorage
|
from ahserver.filestorage import FileStorage
|
||||||
|
|
||||||
|
def b64media2url(request, mediafile):
|
||||||
|
env = request._run_ns
|
||||||
|
entire_url = env.entire_url
|
||||||
|
if mediafile.startswith('data:'):
|
||||||
|
try:
|
||||||
|
fs = FileStorage()
|
||||||
|
fname = getFilenameFromBase64(mediafile)
|
||||||
|
fpath = fs._name2path(fname)
|
||||||
|
base64_to_file(mediafile, fpath)
|
||||||
|
path = fs.webpath(fpath)
|
||||||
|
return entire_url('/idfile?path=') + env.quote(path)
|
||||||
|
except Exception as e:
|
||||||
|
e = Exception(f'{e}\n{format_exc()}')
|
||||||
|
exception(f'{e}')
|
||||||
|
return ''
|
||||||
|
elif len(mediafile) > 8000:
|
||||||
|
e = Exception(f'mediafile is not a media file')
|
||||||
|
exception(f'{e}')
|
||||||
|
return ''
|
||||||
|
if mediafile.startswith('http://') or mediafile.startswith('https://'):
|
||||||
|
return mediafile
|
||||||
|
url = entire_url('/idfile?path=') + env.quote(mediafile)
|
||||||
|
return url
|
||||||
|
|
||||||
async def llm_query_orders(userorgid, page, pagerows=80):
|
async def llm_query_orders(userorgid, page, pagerows=80):
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
async with get_sor_context(env, 'llmage') as sor:
|
async with get_sor_context(env, 'llmage') as sor:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user