diff --git a/client/data/ChatModels.json b/client/data/ChatModels.json index d8aa6b8a7..324a3f9da 100644 --- a/client/data/ChatModels.json +++ b/client/data/ChatModels.json @@ -1,23 +1,23 @@ { - "Gpt35-4k": { + "FastAI-4k": { "model": "gpt-3.5-turbo", - "name": "Gpt35-4k", + "name": "FastAI-4k", "contextMaxToken": 4000, "systemMaxToken": 2400, "maxTemperature": 1.2, "price": 1.5 }, - "Gpt35-16k": { + "FastAI-16k": { "model": "gpt-3.5-turbo-16k", - "name": "Gpt35-16k", + "name": "FastAI-16k", "contextMaxToken": 16000, "systemMaxToken": 8000, "maxTemperature": 1.2, "price": 3 }, - "Gpt4": { + "FastAI-Plus": { "model": "gpt-4", - "name": "Gpt4", + "name": "FastAI-Plus", "contextMaxToken": 8000, "systemMaxToken": 4000, "maxTemperature": 1.2, diff --git a/client/data/QAModels.json b/client/data/QAModels.json index 42e96848f..525035ca1 100644 --- a/client/data/QAModels.json +++ b/client/data/QAModels.json @@ -1,7 +1,7 @@ { - "Gpt35-16k": { + "FastAI-16k": { "model": "gpt-3.5-turbo-16k", - "name": "Gpt35-16k", + "name": "FastAI-16k", "maxToken": 16000, "price": 3 } diff --git a/client/public/docs/chatProblem.md b/client/public/docs/chatProblem.md index f6e0fcf9d..0b4008c75 100644 --- a/client/public/docs/chatProblem.md +++ b/client/public/docs/chatProblem.md @@ -7,9 +7,9 @@ | 计费项 | 价格: 元/ 1K tokens(包含上下文)| | --- | --- | | 知识库 - 索引 | 0.001 | -| chatgpt - 对话 | 0.015 | -| chatgpt16K - 对话 | 0.03 | -| gpt4 - 对话 | 0.45 | +| FastAI4k - 对话 | 0.015 | +| FastAI16k - 对话 | 0.03 | +| FastAI-Plus - 对话 | 0.45 | | 文件拆分 | 0.03 | **其他问题** diff --git a/client/public/docs/intro.md b/client/public/docs/intro.md index bae0fb9c5..436c27a01 100644 --- a/client/public/docs/intro.md +++ b/client/public/docs/intro.md @@ -19,9 +19,9 @@ FastGpt 项目完全开源,可随意私有化部署,去除平台风险忧虑 | 计费项 | 价格: 元/ 1K tokens(包含上下文)| | --- | --- | | 知识库 - 索引 | 0.001 | -| chatgpt - 对话 | 0.015 | -| chatgpt16K - 对话 | 0.03 | -| gpt4 - 对话 | 0.45 | +| FastAI4k - 对话 | 0.015 | +| FastAI16k - 对话 | 0.03 | +| FastAI-Plus - 对话 | 0.45 | | 文件拆分 | 0.03 | ### 交流群/问题反馈 diff --git a/client/src/constants/app.ts b/client/src/constants/app.ts index c7e13c585..bc9a2ef6c 100644 --- a/client/src/constants/app.ts +++ b/client/src/constants/app.ts @@ -81,15 +81,15 @@ export const appTemplates: (AppItemType & { avatar: string; intro: string })[] = value: 'gpt-3.5-turbo-16k', list: [ { - label: 'Gpt35-4k', + label: 'FastAI-4k', value: 'gpt-3.5-turbo' }, { - label: 'Gpt35-16k', + label: 'FastAI-16k', value: 'gpt-3.5-turbo-16k' }, { - label: 'Gpt4', + label: 'FastAI-Plus', value: 'gpt-4' } ], @@ -344,15 +344,15 @@ export const appTemplates: (AppItemType & { avatar: string; intro: string })[] = value: 'gpt-3.5-turbo-16k', list: [ { - label: 'Gpt35-4k', + label: 'FastAI-4k', value: 'gpt-3.5-turbo' }, { - label: 'Gpt35-16k', + label: 'FastAI-16k', value: 'gpt-3.5-turbo-16k' }, { - label: 'Gpt4', + label: 'FastAI-Plus', value: 'gpt-4' } ], @@ -652,15 +652,15 @@ export const appTemplates: (AppItemType & { avatar: string; intro: string })[] = value: 'gpt-3.5-turbo-16k', list: [ { - label: 'Gpt35-4k', + label: 'FastAI-4k', value: 'gpt-3.5-turbo' }, { - label: 'Gpt35-16k', + label: 'FastAI-16k', value: 'gpt-3.5-turbo-16k' }, { - label: 'Gpt4', + label: 'FastAI-Plus', value: 'gpt-4' } ], @@ -979,15 +979,15 @@ export const appTemplates: (AppItemType & { avatar: string; intro: string })[] = value: 'gpt-3.5-turbo', list: [ { - label: 'Gpt35-16k', + label: 'FastAI-16k', value: 'gpt-3.5-turbo-16k' }, { - label: 'Gpt35-4k', + label: 'FastAI-4k', value: 'gpt-3.5-turbo' }, { - label: 'Gpt4-8k', + label: 'FastAI-Plus-8k', value: 'gpt-4' } ], diff --git a/client/src/constants/flow/ModuleTemplate.ts b/client/src/constants/flow/ModuleTemplate.ts index 145de3a65..d00fc4b9d 100644 --- a/client/src/constants/flow/ModuleTemplate.ts +++ b/client/src/constants/flow/ModuleTemplate.ts @@ -249,7 +249,7 @@ export const AnswerModule: AppModuleTemplateItemType = { { key: SpecificInputEnum.answerText, value: '', - type: FlowInputItemTypeEnum.input, + type: FlowInputItemTypeEnum.textarea, label: '回复的内容' } ], diff --git a/client/src/constants/model.ts b/client/src/constants/model.ts index b8ddf6f47..ef05efcbb 100644 --- a/client/src/constants/model.ts +++ b/client/src/constants/model.ts @@ -4,8 +4,8 @@ import type { AppSchema } from '@/types/mongoSchema'; export enum OpenAiChatEnum { 'GPT35' = 'gpt-3.5-turbo', 'GPT3516k' = 'gpt-3.5-turbo-16k', - 'GPT4' = 'gpt-4', - 'GPT432k' = 'gpt-4-32k' + 'FastAI-Plus' = 'gpt-4', + 'FastAI-Plus32k' = 'gpt-4-32k' } export const defaultApp: AppSchema = { diff --git a/client/src/pages/api/admin/initv4.ts b/client/src/pages/api/admin/initv4.ts index 57c3beade..e3516a074 100644 --- a/client/src/pages/api/admin/initv4.ts +++ b/client/src/pages/api/admin/initv4.ts @@ -69,15 +69,15 @@ const chatTemplate = ({ value: model, list: [ { - label: 'Gpt35-4k', + label: 'FastAI-4k', value: 'gpt-3.5-turbo' }, { - label: 'Gpt35-16k', + label: 'FastAI-16k', value: 'gpt-3.5-turbo-16k' }, { - label: 'Gpt4', + label: 'FastAI-Plus', value: 'gpt-4' } ], @@ -348,15 +348,15 @@ const kbTemplate = ({ value: model, list: [ { - label: 'Gpt35-4k', + label: 'FastAI-4k', value: 'gpt-3.5-turbo' }, { - label: 'Gpt35-16k', + label: 'FastAI-16k', value: 'gpt-3.5-turbo-16k' }, { - label: 'Gpt4', + label: 'FastAI-Plus', value: 'gpt-4' } ], diff --git a/client/src/pages/api/system/getInitData.ts b/client/src/pages/api/system/getInitData.ts index 1fb233ef9..1d746a0c1 100644 --- a/client/src/pages/api/system/getInitData.ts +++ b/client/src/pages/api/system/getInitData.ts @@ -18,25 +18,25 @@ export type InitDateResponse = { }; const defaultmodels = { - 'Gpt35-4k': { + 'FastAI-4k': { model: 'gpt-3.5-turbo', - name: 'Gpt35-4k', + name: 'FastAI-4k', contextMaxToken: 4000, systemMaxToken: 2400, maxTemperature: 1.2, price: 1.5 }, - 'Gpt35-16k': { + 'FastAI-16k': { model: 'gpt-3.5-turbo', - name: 'Gpt35-16k', + name: 'FastAI-16k', contextMaxToken: 16000, systemMaxToken: 8000, maxTemperature: 1.2, price: 3 }, - Gpt4: { + 'FastAI-Plus': { model: 'gpt-4', - name: 'Gpt4', + name: 'FastAI-Plus', contextMaxToken: 8000, systemMaxToken: 4000, maxTemperature: 1.2, @@ -44,9 +44,9 @@ const defaultmodels = { } }; const defaultQaModels = { - 'Gpt35-16k': { + 'FastAI-16k': { model: 'gpt-3.5-turbo', - name: 'Gpt35-16k', + name: 'FastAI-16k', maxToken: 16000, price: 3 } diff --git a/client/src/pages/app/detail/components/edit/index.tsx b/client/src/pages/app/detail/components/edit/index.tsx index 1e241e7b5..76948087a 100644 --- a/client/src/pages/app/detail/components/edit/index.tsx +++ b/client/src/pages/app/detail/components/edit/index.tsx @@ -227,8 +227,6 @@ const AppEdit = ({ app, fullScreen, onFullScreen }: Props) => { const { mutate: onclickSave, isLoading } = useRequest({ mutationFn: () => { - console.log(flow2Modules()); - return putAppById(app._id, { modules: flow2Modules() }); diff --git a/client/src/pages/number/components/PayModal.tsx b/client/src/pages/number/components/PayModal.tsx index f568368fc..afcb39589 100644 --- a/client/src/pages/number/components/PayModal.tsx +++ b/client/src/pages/number/components/PayModal.tsx @@ -32,13 +32,13 @@ const PayModal = ({ onClose }: { onClose: () => void }) => { try { // 获取支付二维码 const res = await getPayCode(inputVal); - new QRCode(document.getElementById('payQRCode'), { + new window.QRCode(document.getElementById('payQRCode'), { text: res.codeUrl, width: 128, height: 128, colorDark: '#000000', colorLight: '#ffffff', - correctLevel: QRCode.CorrectLevel.H + correctLevel: window.QRCode.CorrectLevel.H }); setPayId(res.payId); } catch (err) { @@ -114,9 +114,9 @@ const PayModal = ({ onClose }: { onClose: () => void }) => { | 计费项 | 价格: 元/ 1K tokens(包含上下文)| | --- | --- | | 知识库 - 索引 | 0.001 | -| chatgpt - 对话 | 0.015 | -| chatgpt16K - 对话 | 0.03 | -| gpt4 - 对话 | 0.45 | +| FastAI4k - 对话 | 0.015 | +| FastAI16k - 对话 | 0.03 | +| FastAI-Plus - 对话 | 0.45 | | 文件拆分 | 0.03 |`} /> diff --git a/client/src/types/mongoSchema.d.ts b/client/src/types/mongoSchema.d.ts index b5f43ad6f..a9eb5fbd2 100644 --- a/client/src/types/mongoSchema.d.ts +++ b/client/src/types/mongoSchema.d.ts @@ -44,7 +44,7 @@ export interface AppSchema { collection: number; }; modules: AppModuleItemType[]; - chat: { + chat?: { relatedKbs: string[]; searchSimilarity: number; searchLimit: number; diff --git a/client/src/utils/adapt.ts b/client/src/utils/adapt.ts index a85ea1562..b57e5e989 100644 --- a/client/src/utils/adapt.ts +++ b/client/src/utils/adapt.ts @@ -10,6 +10,7 @@ import type { FlowModuleItemType } from '@/types/flow'; import type { Edge, Node } from 'reactflow'; import { connectionLineStyle } from '@/constants/flow'; import { customAlphabet } from 'nanoid'; +import { ModuleTemplates } from '@/constants/flow/ModuleTemplate'; const nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz1234567890', 6); export const adaptBill = (bill: BillSchema): UserBillType => { @@ -89,11 +90,36 @@ export const appModule2FlowNode = ({ onChangeNode: FlowModuleItemType['onChangeNode']; onDelNode: FlowModuleItemType['onDelNode']; }): Node => { + // init some static data + const template = + ModuleTemplates.map((templates) => templates.list) + ?.flat() + .find((template) => template.flowType === item.flowType) || item; + + // replace item data + const moduleItem = { + ...item, + logo: template.logo, + name: template.name, + intro: template.intro, + type: template.type, + url: template.url, + inputs: template.inputs.map((templateInput) => ({ + ...templateInput, + value: + item.inputs.find((item) => item.key === templateInput.key)?.value || templateInput.value + })), + outputs: template.outputs.map((templateOutput) => ({ + ...templateOutput, + targets: item.outputs.find((item) => item.key === templateOutput.key)?.targets || [] + })) + }; + return { id: item.moduleId, type: item.flowType, data: { - ...item, + ...moduleItem, onChangeNode, onDelNode },