diff --git a/client/public/docs/chatProblem.md b/client/public/docs/chatProblem.md index e3c1498d5..b85cc12e7 100644 --- a/client/public/docs/chatProblem.md +++ b/client/public/docs/chatProblem.md @@ -9,6 +9,7 @@ | 知识库 - 索引 | 0.001 | | chatgpt - 对话 | 0.015 | | chatgpt16K - 对话 | 0.03 | +| 窝牛 GPT4 不稳定 - 对话 | 0.015 | | gpt4 - 对话 | 0.45 | | 文件拆分 | 0.03 | diff --git a/client/src/constants/model.ts b/client/src/constants/model.ts index 94d3c404c..89d51b8b2 100644 --- a/client/src/constants/model.ts +++ b/client/src/constants/model.ts @@ -1,4 +1,3 @@ -import { getSystemModelList } from '@/api/system'; import type { ShareChatEditType } from '@/types/model'; import type { ModelSchema } from '@/types/mongoSchema'; @@ -10,7 +9,8 @@ export enum OpenAiChatEnum { 'GPT35' = 'gpt-3.5-turbo', 'GPT3516k' = 'gpt-3.5-turbo-16k', 'GPT4' = 'gpt-4', - 'GPT432k' = 'gpt-4-32k' + 'GPT432k' = 'gpt-4-32k', + 'GPT4LOW' = 'gpt-4-0314' } export type ChatModelType = `${OpenAiChatEnum}`; @@ -25,6 +25,14 @@ export type ChatModelItemType = { }; export const ChatModelMap = { + [OpenAiChatEnum.GPT4LOW]: { + chatModel: OpenAiChatEnum.GPT4LOW, + name: '窝牛Gpt4不稳定', + contextMaxToken: 4000, + systemMaxToken: 2400, + maxTemperature: 1.2, + price: 1.5 + }, [OpenAiChatEnum.GPT35]: { chatModel: OpenAiChatEnum.GPT35, name: 'Gpt35-4k', @@ -59,15 +67,12 @@ export const ChatModelMap = { } }; -let chatModelList: ChatModelItemType[] = []; -export const getChatModelList = async () => { - if (chatModelList.length > 0) { - return chatModelList; - } - const list = await getSystemModelList(); - chatModelList = list; - return list; -}; +export const chatModelList: ChatModelItemType[] = [ + ChatModelMap[OpenAiChatEnum.GPT3516k], + ChatModelMap[OpenAiChatEnum.GPT35], + ChatModelMap[OpenAiChatEnum.GPT4LOW], + ChatModelMap[OpenAiChatEnum.GPT4] +]; export const defaultModel: ModelSchema = { _id: 'modelId', diff --git a/client/src/pages/api/system/getModels.ts b/client/src/pages/api/system/getModels.ts index 83767c63f..6cfdab9f3 100644 --- a/client/src/pages/api/system/getModels.ts +++ b/client/src/pages/api/system/getModels.ts @@ -9,6 +9,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT3516k]); chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT35]); + chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT4LOW]); chatModelList.push(ChatModelMap[OpenAiChatEnum.GPT4]); jsonRes(res, { diff --git a/client/src/pages/model/components/detail/components/Settings.tsx b/client/src/pages/model/components/detail/components/Settings.tsx index 0e20addd3..bf1850218 100644 --- a/client/src/pages/model/components/detail/components/Settings.tsx +++ b/client/src/pages/model/components/detail/components/Settings.tsx @@ -21,7 +21,7 @@ import { useSelectFile } from '@/hooks/useSelectFile'; import { compressImg } from '@/utils/file'; import { getErrText } from '@/utils/tools'; import { useConfirm } from '@/hooks/useConfirm'; -import { ChatModelMap, getChatModelList } from '@/constants/model'; +import { ChatModelMap, chatModelList } from '@/constants/model'; import { formatPrice } from '@/utils/user'; import type { ModelSchema } from '@/types/mongoSchema'; @@ -185,8 +185,6 @@ const Settings = ({ modelId }: { modelId: string }) => { } }); - const { data: chatModelList = [] } = useQuery(['initChatModelList'], getChatModelList); - return ( { 对话模型 ({ id: item.chatModel, @@ -265,7 +263,7 @@ const Settings = ({ modelId }: { modelId: string }) => { { label: '严谨', value: 0 }, { label: '发散', value: 10 } ]} - width={['90%', '260px']} + width={['95%', '280px']} min={0} max={10} activeVal={getValues('chat.temperature')} @@ -286,7 +284,7 @@ const Settings = ({ modelId }: { modelId: string }) => { { label: '100', value: 100 }, { label: `${tokenLimit}`, value: tokenLimit } ]} - width={['90%', '260px']} + width={['95%', '280px']} min={100} max={tokenLimit} step={50} diff --git a/client/src/pages/number/components/BillTable.tsx b/client/src/pages/number/components/BillTable.tsx index e078561af..3c48e02a0 100644 --- a/client/src/pages/number/components/BillTable.tsx +++ b/client/src/pages/number/components/BillTable.tsx @@ -40,7 +40,7 @@ const BillTable = () => { 时间 类型 - 底层模型 + 模型 内容长度 Tokens 长度 金额 diff --git a/client/src/types/user.d.ts b/client/src/types/user.d.ts index d36c618bf..421ab7734 100644 --- a/client/src/types/user.d.ts +++ b/client/src/types/user.d.ts @@ -19,7 +19,7 @@ export interface UserUpdateParams { export interface UserBillType { id: string; time: Date; - modelName: BillSchema['modelName']; + modelName: string; type: BillSchema['type']; textLen: number; tokenLen: number; diff --git a/client/src/utils/adapt.ts b/client/src/utils/adapt.ts index d87558df2..4a99e5be3 100644 --- a/client/src/utils/adapt.ts +++ b/client/src/utils/adapt.ts @@ -1,17 +1,17 @@ import { formatPrice } from './user'; -import dayjs from 'dayjs'; import type { BillSchema } from '../types/mongoSchema'; import type { UserBillType } from '@/types/user'; import { ChatItemType } from '@/types/chat'; import { ChatCompletionRequestMessageRoleEnum } from 'openai'; import { ChatRoleEnum } from '@/constants/chat'; import type { MessageItemType } from '@/pages/api/openapi/v1/chat/completions'; +import { ChatModelMap, OpenAiChatEnum } from '@/constants/model'; export const adaptBill = (bill: BillSchema): UserBillType => { return { id: bill._id, type: bill.type, - modelName: bill.modelName, + modelName: ChatModelMap[bill.modelName as `${OpenAiChatEnum}`]?.name || bill.modelName, time: bill.time, textLen: bill.textLen, tokenLen: bill.tokenLen,