bugfix
This commit is contained in:
parent
27503c8f1c
commit
0d36537044
@ -1,20 +1,25 @@
|
|||||||
debug(f'{params_kw=}')
|
debug(f'{params_kw=}')
|
||||||
ns = params_kw.copy()
|
ns = params_kw.copy()
|
||||||
if not ns.page:
|
if not ns.page:
|
||||||
ns.page = 1
|
ns.page = 1
|
||||||
ns.sort = "use_date desc"
|
ns.sort = "use_date desc"
|
||||||
if not ns.use_date:
|
if not ns.use_date:
|
||||||
ns.use_date = curDateString()
|
ns.use_date = curDateString()
|
||||||
|
|
||||||
async with get_sor_context(request._run_ns, 'llmage') as sor:
|
async with get_sor_context(request._run_ns, 'llmage') as sor:
|
||||||
sql = """select a.id, a.llmid, a.use_date, a.usages, b.name, b.model, b.ppid
|
sql = """select a.id, a.llmid, a.use_date, a.usages, b.name, b.model, b.ppid
|
||||||
from llmusage a, llm b
|
from llmusage a, llm b
|
||||||
where a.llmid = b.id
|
where a.llmid = b.id
|
||||||
and use_date=${use_date}$
|
and use_date=${use_date}$
|
||||||
"""
|
"""
|
||||||
d = await sor.sqlExe(sql, ns)
|
d = await sor.sqlExe(sql, ns)
|
||||||
for r in d['rows']:
|
for r in d['rows']:
|
||||||
if r.ppid:
|
if r.ppid:
|
||||||
r.amount = await pricing_program_charging(sor, r.ppid, r.usages)
|
try:
|
||||||
return d
|
usages = json.loads(r.usages)
|
||||||
|
usages['biz_date'] = r.use_date
|
||||||
|
r.amount = await pricing_program_charging(sor, r.ppid, usages)
|
||||||
|
except Exception as e:
|
||||||
|
exception(f'{e=},{r.usages=}, {r.use_date=}')
|
||||||
|
return d
|
||||||
return None
|
return None
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user