feat: Add renderModelPriceSimple function and update LogsTable component
- Introduced a new helper function `renderModelPriceSimple` to simplify the rendering of model price information. - Updated the `LogsTable` component to utilize `renderModelPriceSimple`, enhancing the display of model pricing and grouping information. - Removed the previous implementation of `renderModelPrice` from the `LogsTable` for cleaner code.
This commit is contained in:
@@ -25,7 +25,7 @@ import {
|
|||||||
import { ITEMS_PER_PAGE } from '../constants';
|
import { ITEMS_PER_PAGE } from '../constants';
|
||||||
import {
|
import {
|
||||||
renderAudioModelPrice,
|
renderAudioModelPrice,
|
||||||
renderModelPrice,
|
renderModelPrice, renderModelPriceSimple,
|
||||||
renderNumber,
|
renderNumber,
|
||||||
renderQuota,
|
renderQuota,
|
||||||
stringToColor
|
stringToColor
|
||||||
@@ -386,14 +386,11 @@ const LogsTable = () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// let content = renderModelPrice(
|
let content = renderModelPriceSimple(
|
||||||
// record.prompt_tokens,
|
other.model_ratio,
|
||||||
// record.completion_tokens,
|
other.model_price,
|
||||||
// other.model_ratio,
|
other.group_ratio,
|
||||||
// other.model_price,
|
);
|
||||||
// other.completion_ratio,
|
|
||||||
// other.group_ratio,
|
|
||||||
// );
|
|
||||||
return (
|
return (
|
||||||
<Paragraph
|
<Paragraph
|
||||||
ellipsis={{
|
ellipsis={{
|
||||||
@@ -401,7 +398,7 @@ const LogsTable = () => {
|
|||||||
}}
|
}}
|
||||||
style={{ maxWidth: 240 }}
|
style={{ maxWidth: 240 }}
|
||||||
>
|
>
|
||||||
调用消费
|
{content}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -175,6 +175,19 @@ export function renderModelPrice(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function renderModelPriceSimple(
|
||||||
|
modelRatio,
|
||||||
|
modelPrice = -1,
|
||||||
|
groupRatio,
|
||||||
|
) {
|
||||||
|
// 1 ratio = $0.002 / 1K tokens
|
||||||
|
if (modelPrice !== -1) {
|
||||||
|
return '价格:$' + modelPrice + ' * 分组:' + groupRatio;
|
||||||
|
} else {
|
||||||
|
return '模型: ' + modelRatio + ' * 分组: ' + groupRatio;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function renderAudioModelPrice(
|
export function renderAudioModelPrice(
|
||||||
inputTokens,
|
inputTokens,
|
||||||
completionTokens,
|
completionTokens,
|
||||||
|
|||||||
Reference in New Issue
Block a user