bugfix
This commit is contained in:
parent
186f64d544
commit
6876edae62
@ -160,7 +160,7 @@ 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.model, c.ppid
|
||||||
from llmusage a, llm b, llm_api_map c
|
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 a.llmid = c.llmid
|
||||||
@ -332,7 +332,7 @@ async def backend_accounting():
|
|||||||
tpac = await get_user_tpac(lu.userid)
|
tpac = await get_user_tpac(lu.userid)
|
||||||
if tpac:
|
if tpac:
|
||||||
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go tpac')
|
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go tpac')
|
||||||
await tpac_accounting(tpac, lu.userid, lu.llmid, lu.amount, lu.usages, lu.id)
|
await tpac_accounting(tpac, lu.userid, lu.llmid, lu.amount, lu.usages, lu.id, lu.model)
|
||||||
else:
|
else:
|
||||||
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local')
|
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local')
|
||||||
await llm_accounting(lu)
|
await llm_accounting(lu)
|
||||||
|
|||||||
@ -93,13 +93,14 @@ async def get_tpac_balance(tpac, userid):
|
|||||||
exception(f'{url=}, {userid=}, error:{e}')
|
exception(f'{url=}, {userid=}, error:{e}')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
async def tpac_accounting(tpac, userid, llmid, amount, usage, luid):
|
async def tpac_accounting(tpac, userid, llmid, amount, usage, luid, model):
|
||||||
url = tpac.tpac_accounting_url
|
url = tpac.tpac_accounting_url
|
||||||
hc = StreamHttpClient()
|
hc = StreamHttpClient()
|
||||||
d = {
|
d = {
|
||||||
'userid': userid,
|
'userid': userid,
|
||||||
'llmid': llmid,
|
'llmid': llmid,
|
||||||
'amount': amount,
|
'amount': amount,
|
||||||
|
'model': model,
|
||||||
'usage': usage
|
'usage': usage
|
||||||
}
|
}
|
||||||
status = 'failed'
|
status = 'failed'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user