mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00

Co-authored-by: Mufei <327958099@qq.com> Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
29 lines
556 B
TypeScript
29 lines
556 B
TypeScript
import { ModelTypeEnum, getModelMap } from '../../../core/ai/model';
|
|
|
|
export const formatModelChars2Points = ({
|
|
model,
|
|
tokens = 0,
|
|
modelType,
|
|
multiple = 1000
|
|
}: {
|
|
model: string;
|
|
tokens: number;
|
|
modelType: `${ModelTypeEnum}`;
|
|
multiple?: number;
|
|
}) => {
|
|
const modelData = getModelMap?.[modelType]?.(model);
|
|
if (!modelData) {
|
|
return {
|
|
totalPoints: 0,
|
|
modelName: ''
|
|
};
|
|
}
|
|
|
|
const totalPoints = (modelData.charsPointsPrice || 0) * (tokens / multiple);
|
|
|
|
return {
|
|
modelName: modelData.name,
|
|
totalPoints
|
|
};
|
|
};
|