Compare commits
2 Commits
522425051d
...
27a846c3c9
| Author | SHA1 | Date | |
|---|---|---|---|
| 27a846c3c9 | |||
| 6a430112f4 |
@ -169,9 +169,11 @@ async def get_accounting_llmusages(luid=None):
|
|||||||
dt = datetime.fromtimestamp(t)
|
dt = datetime.fromtimestamp(t)
|
||||||
tsstr = dt.strftime('%Y-%m-%d %H:%M:%S.') + f'{dt.microsecond // 1000:03d}'
|
tsstr = dt.strftime('%Y-%m-%d %H:%M:%S.') + f'{dt.microsecond // 1000:03d}'
|
||||||
async with get_sor_context(env, 'llmage') as sor:
|
async with get_sor_context(env, 'llmage') as sor:
|
||||||
sql = """select a.*, b.ppid
|
sql = """select a.*, c.ppid
|
||||||
from llmusage a, llm b
|
from llmusage a, llm b, llm_api_map c
|
||||||
where a.llmid = b.id
|
where a.llmid = b.id
|
||||||
|
and a.llmid = c.llmid
|
||||||
|
and c.isdefaultcatelog = '1'
|
||||||
and a.status = 'SUCCEEDED'
|
and a.status = 'SUCCEEDED'
|
||||||
and a.use_time < ${tsstr}$
|
and a.use_time < ${tsstr}$
|
||||||
and a.accounting_status='created'"""
|
and a.accounting_status='created'"""
|
||||||
@ -196,7 +198,7 @@ where a.llmid = b.id
|
|||||||
try:
|
try:
|
||||||
if isinstance(r.usages, str):
|
if isinstance(r.usages, str):
|
||||||
r.usages = json.loads(r.usages)
|
r.usages = json.loads(r.usages)
|
||||||
d = await llm_charging(r.ppid, r)
|
d = await env.buffered_charging(r.ppid, r.usages)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await llm_accoung_failed(r.id)
|
await llm_accoung_failed(r.id)
|
||||||
exception(f'{r.ppid=}, {r.usages=} llm_charging() failed,{e}')
|
exception(f'{r.ppid=}, {r.usages=} llm_charging() failed,{e}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user