diff --git a/package.json b/package.json index 2f85071f4..569e870de 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@alicloud/tea-util": "^1.4.5", "@chakra-ui/icons": "^2.0.17", "@chakra-ui/react": "^2.5.1", + "@chakra-ui/system": "^2.5.5", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.6", "@next/font": "13.1.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f6308341..219348620 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,6 +6,7 @@ specifiers: '@alicloud/tea-util': ^1.4.5 '@chakra-ui/icons': ^2.0.17 '@chakra-ui/react': ^2.5.1 + '@chakra-ui/system': ^2.5.5 '@emotion/react': ^11.10.6 '@emotion/styled': ^11.10.6 '@next/font': 13.1.6 @@ -68,8 +69,9 @@ dependencies: '@alicloud/dysmsapi20170525': registry.npmmirror.com/@alicloud/dysmsapi20170525/2.0.23 '@alicloud/openapi-client': registry.npmmirror.com/@alicloud/openapi-client/0.4.5 '@alicloud/tea-util': registry.npmmirror.com/@alicloud/tea-util/1.4.5 - '@chakra-ui/icons': registry.npmmirror.com/@chakra-ui/icons/2.0.17_react@18.2.0 + '@chakra-ui/icons': registry.npmmirror.com/@chakra-ui/icons/2.0.17_lze4h7kxffpjhokvtqbtrlfkmq '@chakra-ui/react': registry.npmmirror.com/@chakra-ui/react/2.5.1_e6pzu3hsaqmql4fl7jx73ckiym + '@chakra-ui/system': registry.npmmirror.com/@chakra-ui/system/2.5.5_xqp3pgpqjlfxxa3zxu4zoc4fba '@emotion/react': registry.npmmirror.com/@emotion/react/11.10.6_pmekkgnqduwlme35zpnqhenc34 '@emotion/styled': registry.npmmirror.com/@emotion/styled/11.10.6_oouaibmszuch5k64ms7uxp2aia '@next/font': registry.npmmirror.com/@next/font/13.1.6 @@ -3085,6 +3087,20 @@ packages: react: registry.npmmirror.com/react/18.2.0 dev: false + registry.npmmirror.com/@chakra-ui/icon/3.0.16_lze4h7kxffpjhokvtqbtrlfkmq: + resolution: {integrity: sha512-RpA1X5Ptz8Mt39HSyEIW1wxAz2AXyf9H0JJ5HVx/dBdMZaGMDJ0HyyPBVci0m4RCoJuyG1HHG/DXJaVfUTVAeg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/icon/-/icon-3.0.16.tgz} + id: registry.npmmirror.com/@chakra-ui/icon/3.0.16 + name: '@chakra-ui/icon' + version: 3.0.16 + peerDependencies: + '@chakra-ui/system': '>=2.0.0' + react: '>=18' + dependencies: + '@chakra-ui/shared-utils': registry.npmmirror.com/@chakra-ui/shared-utils/2.0.5 + '@chakra-ui/system': registry.npmmirror.com/@chakra-ui/system/2.5.5_xqp3pgpqjlfxxa3zxu4zoc4fba + react: registry.npmmirror.com/react/18.2.0 + dev: false + registry.npmmirror.com/@chakra-ui/icon/3.0.16_n3dxrjldmk5gnycgnw7noyo5tu: resolution: {integrity: sha512-RpA1X5Ptz8Mt39HSyEIW1wxAz2AXyf9H0JJ5HVx/dBdMZaGMDJ0HyyPBVci0m4RCoJuyG1HHG/DXJaVfUTVAeg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/icon/-/icon-3.0.16.tgz} id: registry.npmmirror.com/@chakra-ui/icon/3.0.16 @@ -3099,20 +3115,7 @@ packages: react: registry.npmmirror.com/react/18.2.0 dev: false - registry.npmmirror.com/@chakra-ui/icon/3.0.16_react@18.2.0: - resolution: {integrity: sha512-RpA1X5Ptz8Mt39HSyEIW1wxAz2AXyf9H0JJ5HVx/dBdMZaGMDJ0HyyPBVci0m4RCoJuyG1HHG/DXJaVfUTVAeg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/icon/-/icon-3.0.16.tgz} - id: registry.npmmirror.com/@chakra-ui/icon/3.0.16 - name: '@chakra-ui/icon' - version: 3.0.16 - peerDependencies: - '@chakra-ui/system': '>=2.0.0' - react: '>=18' - dependencies: - '@chakra-ui/shared-utils': registry.npmmirror.com/@chakra-ui/shared-utils/2.0.5 - react: registry.npmmirror.com/react/18.2.0 - dev: false - - registry.npmmirror.com/@chakra-ui/icons/2.0.17_react@18.2.0: + registry.npmmirror.com/@chakra-ui/icons/2.0.17_lze4h7kxffpjhokvtqbtrlfkmq: resolution: {integrity: sha512-HMJP0WrJgAmFR9+Xh/CBH0nVnGMsJ4ZC8MK6tMgxPKd9/muvn0I4hsicHqdPlLpmB0TlxlhkBAKaVMtOdz6F0w==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/icons/-/icons-2.0.17.tgz} id: registry.npmmirror.com/@chakra-ui/icons/2.0.17 name: '@chakra-ui/icons' @@ -3121,7 +3124,8 @@ packages: '@chakra-ui/system': '>=2.0.0' react: '>=18' dependencies: - '@chakra-ui/icon': registry.npmmirror.com/@chakra-ui/icon/3.0.16_react@18.2.0 + '@chakra-ui/icon': registry.npmmirror.com/@chakra-ui/icon/3.0.16_lze4h7kxffpjhokvtqbtrlfkmq + '@chakra-ui/system': registry.npmmirror.com/@chakra-ui/system/2.5.5_xqp3pgpqjlfxxa3zxu4zoc4fba react: registry.npmmirror.com/react/18.2.0 dev: false @@ -3868,6 +3872,16 @@ packages: lodash.mergewith: registry.npmmirror.com/lodash.mergewith/4.6.2 dev: false + registry.npmmirror.com/@chakra-ui/styled-system/2.8.0: + resolution: {integrity: sha512-bmRv/8ACJGGKGx84U1npiUddwdNifJ+/ETklGwooS5APM0ymwUtBYZpFxjYNJrqvVYpg3mVY6HhMyBVptLS7iA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/styled-system/-/styled-system-2.8.0.tgz} + name: '@chakra-ui/styled-system' + version: 2.8.0 + dependencies: + '@chakra-ui/shared-utils': registry.npmmirror.com/@chakra-ui/shared-utils/2.0.5 + csstype: registry.npmmirror.com/csstype/3.1.1 + lodash.mergewith: registry.npmmirror.com/lodash.mergewith/4.6.2 + dev: false + registry.npmmirror.com/@chakra-ui/switch/2.0.22_6k64q2ggygf5zznlgufl3vff54: resolution: {integrity: sha512-+/Yy6y7VFD91uSPruF8ZvePi3tl5D8UNVATtWEQ+QBI92DLSM+PtgJ2F0Y9GMZ9NzMxpZ80DqwY7/kqcPCfLvw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/switch/-/switch-2.0.22.tgz} id: registry.npmmirror.com/@chakra-ui/switch/2.0.22 @@ -3907,6 +3921,28 @@ packages: react-fast-compare: registry.npmmirror.com/react-fast-compare/3.2.0 dev: false + registry.npmmirror.com/@chakra-ui/system/2.5.5_xqp3pgpqjlfxxa3zxu4zoc4fba: + resolution: {integrity: sha512-52BIp/Zyvefgxn5RTByfkTeG4J+y81LWEjWm8jCaRFsLVm8IFgqIrngtcq4I7gD5n/UKbneHlb4eLHo4uc5yDQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/system/-/system-2.5.5.tgz} + id: registry.npmmirror.com/@chakra-ui/system/2.5.5 + name: '@chakra-ui/system' + version: 2.5.5 + peerDependencies: + '@emotion/react': ^11.0.0 + '@emotion/styled': ^11.0.0 + react: '>=18' + dependencies: + '@chakra-ui/color-mode': registry.npmmirror.com/@chakra-ui/color-mode/2.1.12_react@18.2.0 + '@chakra-ui/object-utils': registry.npmmirror.com/@chakra-ui/object-utils/2.0.8 + '@chakra-ui/react-utils': registry.npmmirror.com/@chakra-ui/react-utils/2.0.12_react@18.2.0 + '@chakra-ui/styled-system': registry.npmmirror.com/@chakra-ui/styled-system/2.8.0 + '@chakra-ui/theme-utils': registry.npmmirror.com/@chakra-ui/theme-utils/2.0.15 + '@chakra-ui/utils': registry.npmmirror.com/@chakra-ui/utils/2.0.15 + '@emotion/react': registry.npmmirror.com/@emotion/react/11.10.6_pmekkgnqduwlme35zpnqhenc34 + '@emotion/styled': registry.npmmirror.com/@emotion/styled/11.10.6_oouaibmszuch5k64ms7uxp2aia + react: registry.npmmirror.com/react/18.2.0 + react-fast-compare: registry.npmmirror.com/react-fast-compare/3.2.1 + dev: false + registry.npmmirror.com/@chakra-ui/table/2.0.16_n3dxrjldmk5gnycgnw7noyo5tu: resolution: {integrity: sha512-vWDXZ6Ad3Aj66curp1tZBHvCfQHX2FJ4ijLiqGgQszWFIchfhJ5vMgEBJaFMZ+BN1draAjuRTZqaQefOApzvRg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/table/-/table-2.0.16.tgz} id: registry.npmmirror.com/@chakra-ui/table/2.0.16 @@ -3988,6 +4024,20 @@ packages: color2k: registry.npmmirror.com/color2k/2.0.2 dev: false + registry.npmmirror.com/@chakra-ui/theme-tools/2.0.17_wv7sq5bj4kx5i3evdevscgumbi: + resolution: {integrity: sha512-Auu38hnihlJZQcPok6itRDBbwof3TpXGYtDPnOvrq4Xp7jnab36HLt7KEXSDPXbtOk3ZqU99pvI1en5LbDrdjg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/theme-tools/-/theme-tools-2.0.17.tgz} + id: registry.npmmirror.com/@chakra-ui/theme-tools/2.0.17 + name: '@chakra-ui/theme-tools' + version: 2.0.17 + peerDependencies: + '@chakra-ui/styled-system': '>=2.0.0' + dependencies: + '@chakra-ui/anatomy': registry.npmmirror.com/@chakra-ui/anatomy/2.1.2 + '@chakra-ui/shared-utils': registry.npmmirror.com/@chakra-ui/shared-utils/2.0.5 + '@chakra-ui/styled-system': registry.npmmirror.com/@chakra-ui/styled-system/2.8.0 + color2k: registry.npmmirror.com/color2k/2.0.2 + dev: false + registry.npmmirror.com/@chakra-ui/theme-utils/2.0.11: resolution: {integrity: sha512-lBAay6Sq3/fl7exd3mFxWAbzgdQowytor0fnlHrpNStn1HgFjXukwsf6356XQOie2Vd8qaMM7qZtMh4AiC0dcg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/theme-utils/-/theme-utils-2.0.11.tgz} name: '@chakra-ui/theme-utils' @@ -3999,6 +4049,17 @@ packages: lodash.mergewith: registry.npmmirror.com/lodash.mergewith/4.6.2 dev: false + registry.npmmirror.com/@chakra-ui/theme-utils/2.0.15: + resolution: {integrity: sha512-UuxtEgE7gwMTGDXtUpTOI7F5X0iHB9ekEOG5PWPn2wWBL7rlk2JtPI7UP5Um5Yg6vvBfXYGK1ySahxqsgf+87g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/theme-utils/-/theme-utils-2.0.15.tgz} + name: '@chakra-ui/theme-utils' + version: 2.0.15 + dependencies: + '@chakra-ui/shared-utils': registry.npmmirror.com/@chakra-ui/shared-utils/2.0.5 + '@chakra-ui/styled-system': registry.npmmirror.com/@chakra-ui/styled-system/2.8.0 + '@chakra-ui/theme': registry.npmmirror.com/@chakra-ui/theme/3.0.1_wv7sq5bj4kx5i3evdevscgumbi + lodash.mergewith: registry.npmmirror.com/lodash.mergewith/4.6.2 + dev: false + registry.npmmirror.com/@chakra-ui/theme/2.2.5_es2flcfvdj7o2v4vs237ptvmhy: resolution: {integrity: sha512-hYASZMwu0NqEv6PPydu+F3I+kMNd44yR4TwjR/lXBz/LEh64L6UPY6kQjebCfgdVtsGdl3HKg+eLlfa7SvfRgw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/theme/-/theme-2.2.5.tgz} id: registry.npmmirror.com/@chakra-ui/theme/2.2.5 @@ -4013,6 +4074,20 @@ packages: '@chakra-ui/theme-tools': registry.npmmirror.com/@chakra-ui/theme-tools/2.0.17_es2flcfvdj7o2v4vs237ptvmhy dev: false + registry.npmmirror.com/@chakra-ui/theme/3.0.1_wv7sq5bj4kx5i3evdevscgumbi: + resolution: {integrity: sha512-92kDm/Ux/51uJqhRKevQo/O/rdwucDYcpHg2QuwzdAxISCeYvgtl2TtgOOl5EnqEP0j3IEAvZHZUlv8TTbawaw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/theme/-/theme-3.0.1.tgz} + id: registry.npmmirror.com/@chakra-ui/theme/3.0.1 + name: '@chakra-ui/theme' + version: 3.0.1 + peerDependencies: + '@chakra-ui/styled-system': '>=2.0.0' + dependencies: + '@chakra-ui/anatomy': registry.npmmirror.com/@chakra-ui/anatomy/2.1.2 + '@chakra-ui/shared-utils': registry.npmmirror.com/@chakra-ui/shared-utils/2.0.5 + '@chakra-ui/styled-system': registry.npmmirror.com/@chakra-ui/styled-system/2.8.0 + '@chakra-ui/theme-tools': registry.npmmirror.com/@chakra-ui/theme-tools/2.0.17_wv7sq5bj4kx5i3evdevscgumbi + dev: false + registry.npmmirror.com/@chakra-ui/toast/6.0.1_jgj3ekl54faqnu3nlobnfmds2q: resolution: {integrity: sha512-ej2kJXvu/d2h6qnXU5D8XTyw0qpsfmbiU7hUffo/sPxkz89AUOQ08RUuUmB1ssW/FZcQvNMJ5WgzCTKHGBxtxw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/@chakra-ui/toast/-/toast-6.0.1.tgz} id: registry.npmmirror.com/@chakra-ui/toast/6.0.1 @@ -10182,6 +10257,12 @@ packages: version: 3.2.0 dev: false + registry.npmmirror.com/react-fast-compare/3.2.1: + resolution: {integrity: sha512-xTYf9zFim2pEif/Fw16dBiXpe0hoy5PxcD8+OwBnTtNLfIm3g6WxhKNurY+6OmdH1u6Ta/W/Vl6vjbYP1MFnDg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/react-fast-compare/-/react-fast-compare-3.2.1.tgz} + name: react-fast-compare + version: 3.2.1 + dev: false + registry.npmmirror.com/react-focus-lock/2.9.4_pmekkgnqduwlme35zpnqhenc34: resolution: {integrity: sha512-7pEdXyMseqm3kVjhdVH18sovparAzLg5h6WvIx7/Ck3ekjhrrDMEegHSa3swwC8wgfdd7DIdUVRGeiHT9/7Sgg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npmmirror.com/react-focus-lock/-/react-focus-lock-2.9.4.tgz} id: registry.npmmirror.com/react-focus-lock/2.9.4 diff --git a/public/docs/intro.md b/public/docs/intro.md index 3cce2007a..c496d95f6 100644 --- a/public/docs/intro.md +++ b/public/docs/intro.md @@ -15,6 +15,16 @@ wx号: fastgpt123 4. 进入模型页,创建一个模型,建议直接用 ChatGPT。 5. 在模型列表点击【对话】,即可使用 API 进行聊天。 +### 价格表 +如果使用了自己的 Api Key,不会计费。可以在账号页,看到详细账单。单纯使用 chatGPT 模型进行对话,只有一个计费项目。使用知识库时,包含**对话**和**索引**生成两个计费项。 +| 计费项 | 价格: 元/ 1K tokens(包含上下文)| +| --- | --- | +| chatgpt - 对话 | 0.03 | +| 知识库 - 对话 | 0.03 | +| 知识库 - 索引 | 0.004 | +| 文件拆分 | 0.03 | + + ### 定制 prompt 1. 进入模型编辑页 @@ -29,12 +39,3 @@ wx号: fastgpt123 4. 使用该模型对话。 注意:使用知识库模型对话时,tokens 消耗会加快。 - -### 价格表 -如果使用了自己的 Api Key,不会计费。可以在账号页,看到详细账单。单纯使用 chatGPT 模型进行对话,只有一个计费项目。使用知识库时,包含**对话**和**索引**生成两个计费项。 -| 计费项 | 价格: 元/ 1K tokens(包含上下文)| -| --- | --- | -| chatgpt - 对话 | 0.03 | -| 知识库 - 对话 | 0.03 | -| 知识库 - 索引 | 0.004 | -| 文件拆分 | 0.03 | diff --git a/src/pages/api/model/data/pushModelDataCsv.ts b/src/pages/api/model/data/pushModelDataCsv.ts index 99920cd77..fc3373a04 100644 --- a/src/pages/api/model/data/pushModelDataCsv.ts +++ b/src/pages/api/model/data/pushModelDataCsv.ts @@ -40,6 +40,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse< // 去重 const searchRes = await Promise.allSettled( data.map(async ([q, a]) => { + if (!q || !a) { + return Promise.reject('q/a为空'); + } try { q = q.replace(/\\n/g, '\n'); a = a.replace(/\\n/g, '\n'); diff --git a/src/pages/chat/index.tsx b/src/pages/chat/index.tsx index c93b16f53..a731990b1 100644 --- a/src/pages/chat/index.tsx +++ b/src/pages/chat/index.tsx @@ -88,7 +88,7 @@ const Chat = ({ chatId }: { chatId: string }) => { throttle(() => { if (!ChatBox.current) return; const isBottom = - ChatBox.current.scrollTop + ChatBox.current.clientHeight + 50 >= + ChatBox.current.scrollTop + ChatBox.current.clientHeight + 80 >= ChatBox.current.scrollHeight; isBottom && scrollToBottom('auto'); diff --git a/src/pages/number/setting.tsx b/src/pages/number/setting.tsx index 629d48342..1650c5fb6 100644 --- a/src/pages/number/setting.tsx +++ b/src/pages/number/setting.tsx @@ -51,7 +51,7 @@ const NumberSetting = () => { 账号信息 - 用户账号: + 账号: {userInfo?.username} diff --git a/src/types/chat.d.ts b/src/types/chat.d.ts index b8b7dbf06..86731b6a8 100644 --- a/src/types/chat.d.ts +++ b/src/types/chat.d.ts @@ -11,4 +11,5 @@ export type ChatSiteItemType = { export type HistoryItem = { chatId: string; title: string; + history?: ChatSiteItemType[]; };