feat(billing): enhance task billing process with video input detection and updated pricing logic

- Added `EstimateBilling` function to check for video input in request metadata and return corresponding discount ratios.
- Updated `ModelPriceHelperPerCall` to incorporate new pricing logic based on model ratios and video input.
- Enhanced task billing logs to include model ratio information and adjusted calculations for actual quota based on additional multipliers.
- Introduced `renderTaskBillingProcess` to improve rendering of task billing information in the UI.
This commit is contained in:
CaIon
2026-04-05 20:07:48 +08:00
parent 677d02f2ab
commit 8fc0eb78e2
7 changed files with 123 additions and 21 deletions
+12
View File
@@ -1620,6 +1620,18 @@ function renderPriceSimpleCore({
return result;
}
export function renderTaskBillingProcess(other, content) {
if (other?.task_id != null) {
return renderBillingArticle(
[content].filter(Boolean),
{ showReferenceNote: false },
);
}
return renderBillingArticle([
buildBillingText('任务预扣费(将在任务完成后按实际token重算)'),
]);
}
export function renderModelPrice(
inputTokens,
completionTokens,
+5 -1
View File
@@ -36,6 +36,7 @@ import {
renderAudioModelPrice,
renderClaudeModelPrice,
renderModelPrice,
renderTaskBillingProcess,
} from '../../helpers';
import { ITEMS_PER_PAGE } from '../../constants';
import { useTableCompactMode } from '../common/useTableCompactMode';
@@ -497,7 +498,10 @@ export const useLogsData = () => {
let content = '';
if (!isViolationFeeLog) {
if (other?.ws || other?.audio) {
const isTaskLog = other?.is_task === true || other?.task_id != null;
if (isTaskLog && other?.model_price === -1) {
content = renderTaskBillingProcess(other, logs[i].content);
} else if (other?.ws || other?.audio) {
content = renderAudioModelPrice(
other?.text_input,
other?.text_output,