mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 21:13:50 +00:00
model
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
| 知识库 - 索引 | 0.001 |
|
||||
| chatgpt - 对话 | 0.015 |
|
||||
| chatgpt16K - 对话 | 0.03 |
|
||||
| 窝牛 GPT4 不稳定 - 对话 | 0.015 |
|
||||
| gpt4 - 对话 | 0.45 |
|
||||
| 文件拆分 | 0.03 |
|
||||
|
||||
|
@@ -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',
|
||||
|
@@ -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, {
|
||||
|
@@ -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 (
|
||||
<Box
|
||||
pb={3}
|
||||
@@ -240,7 +238,7 @@ const Settings = ({ modelId }: { modelId: string }) => {
|
||||
对话模型
|
||||
</Box>
|
||||
<MySelect
|
||||
width={['90%', '280px']}
|
||||
width={['100%', '300px']}
|
||||
value={getValues('chat.chatModel')}
|
||||
list={chatModelList.map((item) => ({
|
||||
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}
|
||||
|
@@ -40,7 +40,7 @@ const BillTable = () => {
|
||||
<Tr>
|
||||
<Th>时间</Th>
|
||||
<Th>类型</Th>
|
||||
<Th>底层模型</Th>
|
||||
<Th>模型</Th>
|
||||
<Th>内容长度</Th>
|
||||
<Th>Tokens 长度</Th>
|
||||
<Th>金额</Th>
|
||||
|
2
client/src/types/user.d.ts
vendored
2
client/src/types/user.d.ts
vendored
@@ -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;
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user