交易流水对账明细 | AI引擎计价规则
This commit is contained in:
@@ -13,6 +13,7 @@ from app.config import settings
|
||||
from app.models.model_config import ModelConfig
|
||||
from app.models.token_usage import TokenUsage
|
||||
from app.utils.id_gen import generate_id
|
||||
from app.services.model_pricing.usage_normalizer import normalize_text_pricing_usage
|
||||
from app.services.log_config import is_enabled, LOG_DIR, LOG_DATE_FORMAT, encrypt_data
|
||||
|
||||
|
||||
@@ -385,7 +386,7 @@ async def _call_openai_compatible(
|
||||
await db.flush()
|
||||
|
||||
content = data["choices"][0]["message"]["content"].strip()
|
||||
token_usage = {
|
||||
token_usage = normalize_text_pricing_usage(usage, base={
|
||||
"token_usage_id": token_usage_id,
|
||||
"model_config_id": config.id,
|
||||
"model_config_name": config.name,
|
||||
@@ -394,5 +395,5 @@ async def _call_openai_compatible(
|
||||
"input_tokens": input_tokens,
|
||||
"output_tokens": output_tokens,
|
||||
"total_tokens": total_tokens,
|
||||
}
|
||||
})
|
||||
return content, token_usage
|
||||
|
||||
Reference in New Issue
Block a user