Add whisper and tts ui (#484)

Co-authored-by: heheer <71265218+newfish-cmyk@users.noreply.github.com>
This commit is contained in:
Archer
2023-11-17 00:03:05 +08:00
committed by GitHub
parent f6aea484ce
commit 4358b6de4d
34 changed files with 806 additions and 333 deletions

View File

@@ -1,4 +1,4 @@
import { BillSourceEnum } from '@fastgpt/global/support/wallet/bill/constants';
import { BillSourceEnum, PRICE_SCALE } from '@fastgpt/global/support/wallet/bill/constants';
import { getAudioSpeechModel, getQAModel } from '@/service/core/ai/model';
import type { ChatHistoryItemResType } from '@fastgpt/global/core/chat/api.d';
import { formatPrice } from '@fastgpt/global/support/wallet/bill/tools';
@@ -205,3 +205,37 @@ export function pushAudioSpeechBill({
]
});
}
export function pushWhisperBill({
teamId,
tmbId,
duration
}: {
teamId: string;
tmbId: string;
duration: number;
}) {
const modelData = global.whisperModel;
if (!modelData) return;
const total = ((modelData.price * duration) / 60) * PRICE_SCALE;
const name = 'wallet.bill.Whisper';
createBill({
teamId,
tmbId,
appName: name,
total,
source: BillSourceEnum.fastgpt,
list: [
{
moduleName: name,
amount: total,
model: modelData.name,
tokenLen: duration
}
]
});
}