Aiproxy (#3649)
* model config * feat: model config ui * perf: rename variable * feat: custom request url * perf: model buffer * perf: init model * feat: json model config * auto login * fix: ts * update packages * package * fix: dockerfile
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { UsageSourceEnum } from '@fastgpt/global/support/wallet/usage/constants';
|
||||
import { ModelTypeEnum } from '@fastgpt/service/core/ai/model';
|
||||
import { addLog } from '@fastgpt/service/common/system/log';
|
||||
import { createUsage, concatUsage } from './controller';
|
||||
import { formatModelChars2Points } from '@fastgpt/service/support/wallet/usage/utils';
|
||||
import { ChatNodeUsageType } from '@fastgpt/global/support/wallet/bill/type';
|
||||
import { i18nT } from '@fastgpt/web/i18n/utils';
|
||||
import { ModelTypeEnum } from '@fastgpt/global/core/ai/model';
|
||||
import { getFirstLLMModel, getFirstSTTModel } from '@fastgpt/service/core/ai/model';
|
||||
|
||||
export const pushChatUsage = ({
|
||||
appName,
|
||||
@@ -108,7 +109,7 @@ export const pushGenerateVectorUsage = ({
|
||||
extensionOutputTokens?: number;
|
||||
}) => {
|
||||
const { totalPoints: totalVector, modelName: vectorModelName } = formatModelChars2Points({
|
||||
modelType: ModelTypeEnum.vector,
|
||||
modelType: ModelTypeEnum.embedding,
|
||||
model,
|
||||
inputTokens
|
||||
});
|
||||
@@ -185,7 +186,7 @@ export const pushQuestionGuideUsage = ({
|
||||
teamId: string;
|
||||
tmbId: string;
|
||||
}) => {
|
||||
const qgModel = global.llmModels[0];
|
||||
const qgModel = getFirstLLMModel();
|
||||
const { totalPoints, modelName } = formatModelChars2Points({
|
||||
inputTokens,
|
||||
outputTokens,
|
||||
@@ -229,7 +230,7 @@ export function pushAudioSpeechUsage({
|
||||
const { totalPoints, modelName } = formatModelChars2Points({
|
||||
model,
|
||||
inputTokens: charsLength,
|
||||
modelType: ModelTypeEnum.audioSpeech
|
||||
modelType: ModelTypeEnum.tts
|
||||
});
|
||||
|
||||
createUsage({
|
||||
@@ -258,14 +259,14 @@ export function pushWhisperUsage({
|
||||
tmbId: string;
|
||||
duration: number;
|
||||
}) {
|
||||
const whisperModel = global.whisperModel;
|
||||
const whisperModel = getFirstSTTModel();
|
||||
|
||||
if (!whisperModel) return;
|
||||
|
||||
const { totalPoints, modelName } = formatModelChars2Points({
|
||||
model: whisperModel.model,
|
||||
inputTokens: duration,
|
||||
modelType: ModelTypeEnum.whisper,
|
||||
modelType: ModelTypeEnum.stt,
|
||||
multiple: 60
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user