feat: qa must pay

This commit is contained in:
archer
2023-06-01 11:17:34 +08:00
parent c9ee6fabe4
commit 8817e4d2db
5 changed files with 7 additions and 8 deletions

View File

@@ -76,10 +76,11 @@ export async function generateQA(): Promise<any> {
const kbId = String(data.kbId);
// 余额校验并获取 openapi Key
const { userOpenAiKey, systemAuthKey } = await getApiKey({
const { systemAuthKey } = await getApiKey({
model: OpenAiChatEnum.GPT35,
userId,
type: 'training'
type: 'training',
mustPay: true
});
const startTime = Date.now();
@@ -89,7 +90,7 @@ export async function generateQA(): Promise<any> {
[data.q].map((text) =>
modelServiceToolMap[OpenAiChatEnum.GPT35]
.chatCompletion({
apiKey: userOpenAiKey || systemAuthKey,
apiKey: systemAuthKey,
temperature: 0.8,
messages: [
{
@@ -114,7 +115,7 @@ A2:
console.log(`split result length: `, result.length);
// 计费
pushSplitDataBill({
isPay: !userOpenAiKey && result.length > 0,
isPay: result.length > 0,
userId: data.userId,
type: BillTypeEnum.QA,
textLen: responseMessages.map((item) => item.value).join('').length,