Compare commits

..

No commits in common. "27a846c3c9f7e941974876be4d0dba8eec1c799c" and "522425051d10898dc307b819779de2dcc860dd98" have entirely different histories.

View File

@ -169,11 +169,9 @@ 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.*, c.ppid sql = """select a.*, b.ppid
from llmusage a, llm b, llm_api_map c from llmusage a, llm b
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'"""
@ -198,7 +196,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 env.buffered_charging(r.ppid, r.usages) d = await llm_charging(r.ppid, r)
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}')