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)
|
||||
tsstr = dt.strftime('%Y-%m-%d %H:%M:%S.') + f'{dt.microsecond // 1000:03d}'
|
||||
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
|
||||
where a.llmid = b.id
|
||||
and a.llmid = c.llmid
|
||||
@ -332,7 +332,7 @@ async def backend_accounting():
|
||||
tpac = await get_user_tpac(lu.userid)
|
||||
if 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:
|
||||
debug(f'{lu.id=},{lu.userid=}, {tpac=}, go local')
|
||||
await llm_accounting(lu)
|
||||
|
||||
@ -93,13 +93,14 @@ async def get_tpac_balance(tpac, userid):
|
||||
exception(f'{url=}, {userid=}, error:{e}')
|
||||
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
|
||||
hc = StreamHttpClient()
|
||||
d = {
|
||||
'userid': userid,
|
||||
'llmid': llmid,
|
||||
'amount': amount,
|
||||
'model': model,
|
||||
'usage': usage
|
||||
}
|
||||
status = 'failed'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user