fix: gpt35 4k

This commit is contained in:
archer
2023-06-14 20:54:34 +08:00
parent e4aeee7be3
commit 07f8e18c10
16 changed files with 74 additions and 22 deletions

View File

@@ -87,7 +87,7 @@ export async function generateQA(): Promise<any> {
// 请求 chatgpt 获取回答
const response = await Promise.all(
[data.q].map((text) =>
modelServiceToolMap[OpenAiChatEnum.GPT35]
modelServiceToolMap[OpenAiChatEnum.GPT3516k]
.chatCompletion({
apiKey: systemAuthKey,
temperature: 0.8,

View File

@@ -104,7 +104,7 @@ export const pushSplitDataBill = async ({
await connectToDatabase();
// 获取模型单价格, 都是用 gpt35 拆分
const unitPrice = ChatModelMap[OpenAiChatEnum.GPT35].price || 3;
const unitPrice = ChatModelMap[OpenAiChatEnum.GPT3516k].price || 3;
// 计算价格
const price = unitPrice * totalTokens;
@@ -112,7 +112,7 @@ export const pushSplitDataBill = async ({
const res = await Bill.create({
userId,
type,
modelName: OpenAiChatEnum.GPT35,
modelName: OpenAiChatEnum.GPT3516k,
textLen,
tokenLen: totalTokens,
price

View File

@@ -57,7 +57,7 @@ const ModelSchema = new Schema({
// 聊天时使用的模型
type: String,
enum: Object.keys(ChatModelMap),
default: OpenAiChatEnum.GPT35
default: OpenAiChatEnum.GPT3516k
}
},
share: {

View File

@@ -162,6 +162,10 @@ export const getApiKey = async ({
userOpenAiKey: user.openaiKey || '',
systemAuthKey: getSystemOpenAiKey(type) as string
},
[OpenAiChatEnum.GPT3516k]: {
userOpenAiKey: user.openaiKey || '',
systemAuthKey: getSystemOpenAiKey(type) as string
},
[OpenAiChatEnum.GPT4]: {
userOpenAiKey: user.openaiKey || '',
systemAuthKey: getGpt4Key() as string

View File

@@ -48,6 +48,15 @@ export const modelServiceToolMap: Record<
...data
})
},
[OpenAiChatEnum.GPT3516k]: {
chatCompletion: (data: ChatCompletionType) =>
chatResponse({ model: OpenAiChatEnum.GPT3516k, ...data }),
streamResponse: (data: StreamResponseType) =>
openAiStreamResponse({
model: OpenAiChatEnum.GPT3516k,
...data
})
},
[OpenAiChatEnum.GPT4]: {
chatCompletion: (data: ChatCompletionType) =>
chatResponse({ model: OpenAiChatEnum.GPT4, ...data }),