cleanup: 删除冗余status端点(realesrgan/synth),统一走query_apiname
This commit is contained in:
parent
6c030b0a01
commit
a61e60deff
@ -1,34 +0,0 @@
|
|||||||
# KTV Media API - realesrgan-status
|
|
||||||
# /v1/media/realesrgan-status
|
|
||||||
|
|
||||||
debug_params('params_kw', params_kw)
|
|
||||||
|
|
||||||
userid = await get_user()
|
|
||||||
userorgid = await get_userorgid()
|
|
||||||
if userid is None:
|
|
||||||
return openai_403()
|
|
||||||
|
|
||||||
catelogid = 'ktv_pipeline'
|
|
||||||
model_name = 'realesrgan-status'
|
|
||||||
params_kw.model = model_name
|
|
||||||
params_kw.catelogid = catelogid
|
|
||||||
|
|
||||||
env = request._run_ns
|
|
||||||
async with get_sor_context(env, 'llmage') as sor:
|
|
||||||
sql = """select distinct a.* from llm a
|
|
||||||
join llm_api_map m on a.id = m.llmid
|
|
||||||
join llmcatelog b on m.llmcatelogid = b.id
|
|
||||||
where (b.id = ${catelogid}$ OR b.name = ${catelogid}$)
|
|
||||||
and a.model=${model}$
|
|
||||||
and a.status = 'published'"""
|
|
||||||
recs = await sor.sqlExe(sql, {'catelogid': catelogid, 'model': model_name})
|
|
||||||
if len(recs) == 0:
|
|
||||||
return openai_400()
|
|
||||||
params_kw.llmid = recs[0].id
|
|
||||||
params_kw.llmcatelogid = catelogid
|
|
||||||
|
|
||||||
f = await checkCustomerBalance(params_kw.llmid, userid, userorgid)
|
|
||||||
if not f:
|
|
||||||
return openai_429()
|
|
||||||
|
|
||||||
return await inference(request, env=env)
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
# KTV Media API - synth-status
|
|
||||||
# /v1/media/synth-status
|
|
||||||
|
|
||||||
debug_params('params_kw', params_kw)
|
|
||||||
|
|
||||||
userid = await get_user()
|
|
||||||
userorgid = await get_userorgid()
|
|
||||||
if userid is None:
|
|
||||||
return openai_403()
|
|
||||||
|
|
||||||
catelogid = 'ktv_pipeline'
|
|
||||||
model_name = 'synth-status'
|
|
||||||
params_kw.model = model_name
|
|
||||||
params_kw.catelogid = catelogid
|
|
||||||
|
|
||||||
env = request._run_ns
|
|
||||||
async with get_sor_context(env, 'llmage') as sor:
|
|
||||||
sql = """select distinct a.* from llm a
|
|
||||||
join llm_api_map m on a.id = m.llmid
|
|
||||||
join llmcatelog b on m.llmcatelogid = b.id
|
|
||||||
where (b.id = ${catelogid}$ OR b.name = ${catelogid}$)
|
|
||||||
and a.model=${model}$
|
|
||||||
and a.status = 'published'"""
|
|
||||||
recs = await sor.sqlExe(sql, {'catelogid': catelogid, 'model': model_name})
|
|
||||||
if len(recs) == 0:
|
|
||||||
return openai_400()
|
|
||||||
params_kw.llmid = recs[0].id
|
|
||||||
params_kw.llmcatelogid = catelogid
|
|
||||||
|
|
||||||
f = await checkCustomerBalance(params_kw.llmid, userid, userorgid)
|
|
||||||
if not f:
|
|
||||||
return openai_429()
|
|
||||||
|
|
||||||
return await inference(request, env=env)
|
|
||||||
Loading…
x
Reference in New Issue
Block a user