Commit 9136c930 by Archer Committed by GitHub

Add OpenAPI docs;Correct the glm document (#346)

parent c9db9f33
...@@ -81,7 +81,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b ...@@ -81,7 +81,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
* [系统配置文件说明](https://doc.fastgpt.run/docs/development/configuration/) * [系统配置文件说明](https://doc.fastgpt.run/docs/development/configuration/)
* [多模型配置](https://doc.fastgpt.run/docs/installation/one-api/) * [多模型配置](https://doc.fastgpt.run/docs/installation/one-api/)
* [版本升级](https://doc.fastgpt.run/docs/installation/upgrading) * [版本升级](https://doc.fastgpt.run/docs/installation/upgrading)
* [API 文档](https://kjqvjse66l.feishu.cn/docx/DmLedTWtUoNGX8xui9ocdUEjnNh?pre_pathname=%2Fdrive%2Fhome%2F) * [API 文档](https://doc.fastgpt.run/docs/development/openapi?pre_pathname=%2Fdrive%2Fhome%2F)
## 🏘️ 社区交流群 ## 🏘️ 社区交流群
...@@ -118,4 +118,4 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b ...@@ -118,4 +118,4 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
1. 允许作为后台服务直接商用,但不允许直接使用 saas 服务商用。 1. 允许作为后台服务直接商用,但不允许直接使用 saas 服务商用。
2. 需保留相关版权信息。 2. 需保留相关版权信息。
3. 完整请查看 [FastGPT Open Source License](./LICENSE) 3. 完整请查看 [FastGPT Open Source License](./LICENSE)
4. 联系方式:yujinlong@sealos.io, [点击查看定价策略](https://fael3z0zfze.feishu.cn/docx/F155dbirfo8vDDx2WgWc6extnwf) 4. 联系方式:yujinlong@sealos.io, [点击查看定价策略](https://doc.fastgpt.run/docs/commercial)
...@@ -20,20 +20,24 @@ weight: 20 ...@@ -20,20 +20,24 @@ weight: 20
1. 自定义 title 和 logo 1. 自定义 title 和 logo
2. 用户注册,支付 (已有微信扫码支付,后续会补充支付方式) 2. 用户注册,支付 (已有微信扫码支付,后续会补充支付方式)
3. 团队空间 (下期开发) 3. API 访问限制,可配置:额度、过期时间
4. 完善的 OpenAPI 4. 团队空间 (计划)
5. 高级编排额外插件 5. 完善的 OpenAPI(计划)
6. 后台管理系统 (已有,持续更新) 6. 高级编排额外插件(计划)
7. 后台管理系统
a. 查询:用户、支付、应用、知识库
b. 变更:用户
c. 新增:用户
{{% /alert %}} {{% /alert %}}
### 商业版定价 ### 商业版定价
#### 交付费用 #### 交付费用
+ 使用 [Sealos 公有云](https://sealos.io)交付:1w/年/套 (直接在 Sealos 公有云充值,便可**免费获取 FastGPT 商业版 License**,同时您充值的金额可用于部署其他云资源,相当于白嫖了一个 FastGPT 商业版)。 + 使用 [Sealos 公有云](https://sealos.io)部署:1万元/年/套 (无部署费用。赠送 8000 sealos 公有云额度,可用于 FastGPT 或其他云资源)。
+ 渠道商使用 Sealos 交付:返现 20% 成交额。 + 渠道商使用 Sealos 部署:返现 20% 成交额。
+ 私有服务器交付:2w/年/套(如需部署支持,按技术服务费计算) + 私有服务器部署:2万元/年/套(如需部署支持,按技术服务费计算)
+ 渠道商私有服务器交付:1.3w/年/套(渠道商合同单独约谈,累计 5 套以上可签) + 渠道商私有服务器部署:1.3万元/年/套(渠道商合同单独约谈,累计 5 套以上可签)
#### 用户注册数量费用(按注册量算,不计量分享和 API) #### 用户注册数量费用(按注册量算,不计量分享和 API)
...@@ -69,7 +73,8 @@ weight: 20 ...@@ -69,7 +73,8 @@ weight: 20
## 联系方式 ## 联系方式
通过邮箱联系 yujinlong@sealos.io 微信: allence1004
邮箱: yujinlong@sealos.io
## QA ## QA
...@@ -77,7 +82,7 @@ weight: 20 ...@@ -77,7 +82,7 @@ weight: 20
完整版应用 = 开源版镜像 + 商业版镜像 完整版应用 = 开源版镜像 + 商业版镜像
我们会提供一个商业版镜像给你使用,还会提供一个简单的后台管理系统(目前只设置了简单的查询功能) 我们会提供一个商业版镜像给你使用,该镜像需要一个 license 启动,license 有效期为 1 年。此外,还会提供一个简单的后台管理系统(目前只设置了简单的查询功能)
2. 二次开发如何操作? 2. 二次开发如何操作?
......
...@@ -62,19 +62,18 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One ...@@ -62,19 +62,18 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 和 M3E 模型: 修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 和 M3E 模型:
```json ```json
"ChatModels": [ "ChatModels": [
//已有模型 //已有模型
{ {
"model": "chatglm2", "model": "chatglm2",
"name": "chatglm2", "name": "chatglm2",
"contextMaxToken": 8000, "contextMaxToken": 8000,
"quoteMaxToken": 4000, "quoteMaxToken": 4000,
"maxTemperature": 1.2, "maxTemperature": 1.2,
"price": 0, "price": 0,
"defaultSystem": "" "defaultSystem": ""
} }
], ],
"VectorModels": [ "VectorModels": [
{ {
"model": "text-embedding-ada-002", "model": "text-embedding-ada-002",
......
...@@ -99,21 +99,21 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One ...@@ -99,21 +99,21 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
## 接入 FastGPT ## 接入 FastGPT
修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 和 M3E 模型: 修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 模型:
```json ```json
"ChatModels": [ "ChatModels": [
//已有模型 //已有模型
{ {
"model": "chatglm2", "model": "chatglm2",
"name": "chatglm2", "name": "chatglm2",
"contextMaxToken": 8000, "contextMaxToken": 8000,
"quoteMaxToken": 4000, "quoteMaxToken": 4000,
"maxTemperature": 1.2, "maxTemperature": 1.2,
"price": 0, "price": 0,
"defaultSystem": "" "defaultSystem": ""
} }
], ]
``` ```
## 测试使用 ## 测试使用
......
...@@ -66,7 +66,7 @@ Authorization 为 sk-key。model 为刚刚在 One API 填写的自定义模型 ...@@ -66,7 +66,7 @@ Authorization 为 sk-key。model 为刚刚在 One API 填写的自定义模型
"defaultToken": 500, "defaultToken": 500,
"maxToken": 1800 "maxToken": 1800
} }
], ]
``` ```
## 测试使用 ## 测试使用
......
...@@ -22,17 +22,6 @@ weight: 520 ...@@ -22,17 +22,6 @@ weight: 520
这里介绍一些基础的配置字段: 这里介绍一些基础的配置字段:
```json ```json
// 这个配置会控制前端的一些样式
"FeConfig": {
"show_emptyChat": true, // 对话页面,空内容时,是否展示介绍页
"show_register": false, // 是否展示注册按键(包括忘记密码,注册账号和三方登录)
"show_appStore": false, // 是否展示应用市场(不过目前权限还没做好,放开也没用)
"show_userDetail": false, // 是否展示用户详情(账号余额、OpenAI 绑定)
"show_git": true, // 是否展示 Git
"systemTitle": "FastGPT", // 系统的 title
"authorText": "Made by FastGPT Team.", // 签名
},
...
... ...
// 这个配置文件是系统级参数 // 这个配置文件是系统级参数
"SystemParams": { "SystemParams": {
...@@ -47,22 +36,11 @@ weight: 520 ...@@ -47,22 +36,11 @@ weight: 520
```json ```json
{ {
"FeConfig": {
"show_emptyChat": true,
"show_register": false,
"show_appStore": false,
"show_userDetail": false,
"show_git": true,
"systemTitle": "FastGPT",
"authorText": "Made by FastGPT Team.",
"scripts": []
},
"SystemParams": { "SystemParams": {
"vectorMaxProcess": 15, "vectorMaxProcess": 15,
"qaMaxProcess": 15, "qaMaxProcess": 15,
"pgIvfflatProbe": 20 "pgIvfflatProbe": 20
}, },
"plugins": {},
"ChatModels": [ "ChatModels": [
{ {
"model": "gpt-3.5-turbo", "model": "gpt-3.5-turbo",
...@@ -92,12 +70,6 @@ weight: 520 ...@@ -92,12 +70,6 @@ weight: 520
"defaultSystem": "" "defaultSystem": ""
} }
], ],
"QAModel": {
"model": "gpt-3.5-turbo-16k",
"name": "GPT35-16k",
"maxToken": 16000,
"price": 0
},
"VectorModels": [ "VectorModels": [
{ {
"model": "text-embedding-ada-002", "model": "text-embedding-ada-002",
...@@ -106,6 +78,28 @@ weight: 520 ...@@ -106,6 +78,28 @@ weight: 520
"defaultToken": 500, "defaultToken": 500,
"maxToken": 3000 "maxToken": 3000
} }
] ],
"QAModel": {
"model": "gpt-3.5-turbo-16k",
"name": "GPT35-16k",
"maxToken": 0,
"price": 0
},
"ExtractModel": {
"model": "gpt-3.5-turbo-16k",
"functionCall": true,
"name": "GPT35-16k",
"maxToken": 0,
"price": 0,
"prompt": ""
},
"CQModel": {
"model": "gpt-3.5-turbo-16k",
"functionCall": true,
"name": "GPT35-16k",
"maxToken": 0,
"price": 0,
"prompt": ""
}
} }
``` ```
...@@ -41,8 +41,9 @@ weight: 510 ...@@ -41,8 +41,9 @@ weight: 510
git clone git@github.com:<github_username>/FastGPT.git git clone git@github.com:<github_username>/FastGPT.git
``` ```
projects 目录下为 FastGPT 应用代码。NextJS 框架前后端放在一起,API 服务位于 `src/pages/api` 目录内。 **projects 目录下为 FastGPT 应用代码。NextJS 框架前后端放在一起,API 服务位于 `src/pages/api` 目录内。**
packages 目录为相关的共用包。
**packages 目录为相关的共用包。**
### 安装数据库 ### 安装数据库
...@@ -69,15 +70,15 @@ packages 目录为相关的共用包。 ...@@ -69,15 +70,15 @@ packages 目录为相关的共用包。
### 运行 ### 运行
```bash ```bash
cd client
pnpm i pnpm i
cd projects/app # FastGPT 主程序
pnpm dev pnpm dev
``` ```
### 镜像打包 ### 镜像打包
```bash ```bash
docker build -t dockername/fastgpt . docker build -t dockername/fastgpt --build-arg name=app .
``` ```
## 创建拉取请求 ## 创建拉取请求
......
...@@ -73,7 +73,7 @@ weight: 340 ...@@ -73,7 +73,7 @@ weight: 340
![手动录入知识库结果](/imgs/9.png) ![手动录入知识库结果](/imgs/9.png)
导入结果如上图。可以看到,我们均采用的是问答对的格式,而不是粗略的直接导入。目的就是为了模拟用户问题,进一步的提高向量搜索的匹配效果。可以为同一个问题设置多种问法,效果更佳。 导入结果如上图。可以看到,我们均采用的是问答对的格式,而不是粗略的直接导入。目的就是为了模拟用户问题,进一步的提高向量搜索的匹配效果。可以为同一个问题设置多种问法,效果更佳。
FastGPT 还提供了 openapi 功能,你可以在本地对特殊格式的文件进行处理后,再上传到 FastGPT,具体可以参考:[FastGPT Api Docs](https://kjqvjse66l.feishu.cn/docx/DmLedTWtUoNGX8xui9ocdUEjnNh) FastGPT 还提供了 openapi 功能,你可以在本地对特殊格式的文件进行处理后,再上传到 FastGPT,具体可以参考:[FastGPT Api Docs](https://doc.fastgpt.run/docs/development/openapi)
## 知识库微调和参数调整 ## 知识库微调和参数调整
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
- [**Git 地址**,点击查看项目地址](https://github.com/labring/FastGPT) - [**Git 地址**,点击查看项目地址](https://github.com/labring/FastGPT)
- [本地部署 FastGPT](https://doc.fastgpt.run/docs/installation) - [本地部署 FastGPT](https://doc.fastgpt.run/docs/installation)
- [API 文档](https://kjqvjse66l.feishu.cn/docx/DmLedTWtUoNGX8xui9ocdUEjnNh?pre_pathname=%2Fdrive%2Fhome%2F) - [API 文档](https://doc.fastgpt.run/docs/development/openapi?pre_pathname=%2Fdrive%2Fhome%2F)
- **反馈问卷**: 如果你遇到任何使用问题或有期望的功能,可以[填写该问卷](https://www.wjx.cn/vm/rLIw1uD.aspx#) - **反馈问卷**: 如果你遇到任何使用问题或有期望的功能,可以[填写该问卷](https://www.wjx.cn/vm/rLIw1uD.aspx#)
- **问题文档**: [先看文档,再提问](https://kjqvjse66l.feishu.cn/docx/HtrgdT0pkonP4kxGx8qcu6XDnGh) - **问题文档**: [先看文档,再提问](https://kjqvjse66l.feishu.cn/docx/HtrgdT0pkonP4kxGx8qcu6XDnGh)
- [点击查看商业版文档](https://fael3z0zfze.feishu.cn/docx/F155dbirfo8vDDx2WgWc6extnwf) - [点击查看商业版文档](https://doc.fastgpt.run/docs/commercial)
- [计费规则](https://doc.fastgpt.run/docs/pricing/) - [计费规则](https://doc.fastgpt.run/docs/pricing/)
**其他问题** **其他问题**
......
...@@ -247,8 +247,8 @@ ...@@ -247,8 +247,8 @@
"QPM": "", "QPM": "",
"QPM Tips": "每个 IP 每分钟最多提问多少次", "QPM Tips": "每个 IP 每分钟最多提问多少次",
"QPM is empty": "QPM 不能为空", "QPM is empty": "QPM 不能为空",
"Response Detail": "返回引用", "Response Detail": "返回详情",
"Response Detail tips": "是否需要返回引用" "Response Detail tips": "是否需要返回详情(引用内容,调用时间等,不会返回预设提示词和完整上下文)"
}, },
"system": { "system": {
"Help Document": "帮助文档" "Help Document": "帮助文档"
......
...@@ -612,6 +612,7 @@ const ChatBox = ( ...@@ -612,6 +612,7 @@ const ChatBox = (
> >
{item.obj === 'Human' && ( {item.obj === 'Human' && (
<> <>
{/* control icon */}
<Flex w={'100%'} alignItems={'center'} justifyContent={'flex-end'}> <Flex w={'100%'} alignItems={'center'} justifyContent={'flex-end'}>
<Flex {...controlContainerStyle} justifyContent={'flex-end'} mr={3}> <Flex {...controlContainerStyle} justifyContent={'flex-end'} mr={3}>
<MyTooltip label={t('common.Copy')}> <MyTooltip label={t('common.Copy')}>
...@@ -654,6 +655,7 @@ const ChatBox = ( ...@@ -654,6 +655,7 @@ const ChatBox = (
</Flex> </Flex>
<ChatAvatar src={userAvatar} type={'Human'} /> <ChatAvatar src={userAvatar} type={'Human'} />
</Flex> </Flex>
{/* content */}
<Box mt={['6px', 2]} textAlign={'right'}> <Box mt={['6px', 2]} textAlign={'right'}>
<Card <Card
className="markdown" className="markdown"
...@@ -670,6 +672,7 @@ const ChatBox = ( ...@@ -670,6 +672,7 @@ const ChatBox = (
)} )}
{item.obj === 'AI' && ( {item.obj === 'AI' && (
<> <>
{/* control icon */}
<Flex w={'100%'} alignItems={'flex-end'}> <Flex w={'100%'} alignItems={'flex-end'}>
<ChatAvatar src={appAvatar} type={'AI'} /> <ChatAvatar src={appAvatar} type={'AI'} />
<Flex <Flex
...@@ -822,6 +825,7 @@ const ChatBox = ( ...@@ -822,6 +825,7 @@ const ChatBox = (
</Flex> </Flex>
)} )}
</Flex> </Flex>
{/* content */}
<Box textAlign={'left'} mt={['6px', 2]}> <Box textAlign={'left'} mt={['6px', 2]}>
<Card bg={'white'} {...MessageCardStyle}> <Card bg={'white'} {...MessageCardStyle}>
<Markdown <Markdown
......
...@@ -83,10 +83,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => { ...@@ -83,10 +83,7 @@ const ApiKeyTable = ({ tips, appId }: { tips: string; appId?: string }) => {
API 秘钥管理 API 秘钥管理
</Box> </Box>
<Link <Link
href={ href={feConfigs.openAPIUrl || 'https://doc.fastgpt.run/docs/development/openapi'}
feConfigs.openAPIUrl ||
'https://kjqvjse66l.feishu.cn/docx/DmLedTWtUoNGX8xui9ocdUEjnNh'
}
target={'_blank'} target={'_blank'}
ml={1} ml={1}
color={'myBlue.600'} color={'myBlue.600'}
......
...@@ -39,6 +39,7 @@ import { formatPrice } from '@fastgpt/common/bill/index'; ...@@ -39,6 +39,7 @@ import { formatPrice } from '@fastgpt/common/bill/index';
import { OutLinkTypeEnum } from '@/constants/chat'; import { OutLinkTypeEnum } from '@/constants/chat';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useToast } from '@/hooks/useToast'; import { useToast } from '@/hooks/useToast';
import { feConfigs } from '@/store/static';
import MyTooltip from '@/components/MyTooltip'; import MyTooltip from '@/components/MyTooltip';
import MyModal from '@/components/MyModal'; import MyModal from '@/components/MyModal';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
...@@ -89,12 +90,14 @@ const Share = ({ appId }: { appId: string }) => { ...@@ -89,12 +90,14 @@ const Share = ({ appId }: { appId: string }) => {
<Tr> <Tr>
<Th>名称</Th> <Th>名称</Th>
<Th>金额消耗(¥)</Th> <Th>金额消耗(¥)</Th>
<> <Th>返回详情</Th>
<Th>金额限制(¥)</Th> {feConfigs?.isPlus && (
<Th>IP限流(人/分钟)</Th> <>
</> <Th>金额限制(¥)</Th>
<Th>返回引用</Th> <Th>IP限流(人/分钟)</Th>
<Th>过期时间</Th> <Th>过期时间</Th>
</>
)}
<Th>最后使用时间</Th> <Th>最后使用时间</Th>
<Th></Th> <Th></Th>
</Tr> </Tr>
...@@ -104,18 +107,20 @@ const Share = ({ appId }: { appId: string }) => { ...@@ -104,18 +107,20 @@ const Share = ({ appId }: { appId: string }) => {
<Tr key={item._id}> <Tr key={item._id}>
<Td>{item.name}</Td> <Td>{item.name}</Td>
<Td>{formatPrice(item.total)}</Td> <Td>{formatPrice(item.total)}</Td>
{item.limit && ( <Td>{item.responseDetail ? '✔' : '✖'}</Td>
{feConfigs?.isPlus && (
<> <>
<Td>{item.limit?.credit > -1 ? `${item.limit?.credit}元` : '无限制'}</Td> <Td>
<Td>{item.limit?.QPM}</Td> {item.limit && item.limit.credit > -1 ? `${item.limit.credit}元` : '无限制'}
</Td>
<Td>{item.limit?.QPM || '-'}</Td>
<Td>
{item.limit?.expiredTime
? dayjs(item.limit?.expiredTime).format('YYYY/MM/DD\nHH:mm')
: '-'}
</Td>
</> </>
)} )}
<Td>{item.responseDetail ? '✔' : '✖'}</Td>
<Td>
{item.limit?.expiredTime
? dayjs(item.limit?.expiredTime).format('YYYY/MM/DD\nHH:mm')
: '-'}
</Td>
<Td>{item.lastTime ? formatTimeToChatTime(item.lastTime) : '未使用'}</Td> <Td>{item.lastTime ? formatTimeToChatTime(item.lastTime) : '未使用'}</Td>
<Td display={'flex'} alignItems={'center'}> <Td display={'flex'} alignItems={'center'}>
<Menu autoSelect={false} isLazy> <Menu autoSelect={false} isLazy>
...@@ -282,55 +287,60 @@ function EditLinkModal({ ...@@ -282,55 +287,60 @@ function EditLinkModal({
})} })}
/> />
</Flex> </Flex>
<Flex alignItems={'center'} mt={4}> {feConfigs?.isPlus && (
<Flex flex={'0 0 90px'} alignItems={'center'}> <>
QPM: <Flex alignItems={'center'} mt={4}>
<MyTooltip label={t('outlink.QPM Tips' || '')}> <Flex flex={'0 0 90px'} alignItems={'center'}>
<QuestionOutlineIcon ml={1} /> QPM:
</MyTooltip> <MyTooltip label={t('outlink.QPM Tips' || '')}>
</Flex> <QuestionOutlineIcon ml={1} />
<Input </MyTooltip>
max={1000} </Flex>
{...register('limit.QPM', { <Input
min: 0, max={1000}
max: 1000, {...register('limit.QPM', {
valueAsNumber: true, min: 0,
required: t('outlink.QPM is empty') || '' max: 1000,
})} valueAsNumber: true,
/> required: t('outlink.QPM is empty') || ''
</Flex> })}
<Flex alignItems={'center'} mt={4}> />
<Flex flex={'0 0 90px'} alignItems={'center'}> </Flex>
{t('common.Max credit')}: <Flex alignItems={'center'} mt={4}>
<MyTooltip label={t('common.Max credit tips' || '')}> <Flex flex={'0 0 90px'} alignItems={'center'}>
<QuestionOutlineIcon ml={1} /> {t('common.Max credit')}:
</MyTooltip> <MyTooltip label={t('common.Max credit tips' || '')}>
</Flex> <QuestionOutlineIcon ml={1} />
<Input </MyTooltip>
{...register('limit.credit', { </Flex>
min: -1, <Input
max: 1000, {...register('limit.credit', {
valueAsNumber: true, min: -1,
required: true max: 1000,
})} valueAsNumber: true,
/> required: true
</Flex> })}
<Flex alignItems={'center'} mt={4}> />
<Flex flex={'0 0 90px'} alignItems={'center'}> </Flex>
{t('common.Expired Time')}: <Flex alignItems={'center'} mt={4}>
</Flex> <Flex flex={'0 0 90px'} alignItems={'center'}>
<Input {t('common.Expired Time')}:
type="datetime-local" </Flex>
defaultValue={ <Input
defaultData.limit?.expiredTime type="datetime-local"
? dayjs(defaultData.limit?.expiredTime).format('YYYY-MM-DDTHH:mm') defaultValue={
: '' defaultData.limit?.expiredTime
} ? dayjs(defaultData.limit?.expiredTime).format('YYYY-MM-DDTHH:mm')
onChange={(e) => { : ''
setValue('limit.expiredTime', new Date(e.target.value)); }
}} onChange={(e) => {
/> setValue('limit.expiredTime', new Date(e.target.value));
</Flex> }}
/>
</Flex>
</>
)}
<Flex alignItems={'center'} mt={4}> <Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}> <Flex flex={'0 0 90px'} alignItems={'center'}>
{t('outlink.Response Detail')}: {t('outlink.Response Detail')}:
......
...@@ -238,7 +238,9 @@ const OutLink = ({ shareId, chatId }: { shareId: string; chatId: string }) => { ...@@ -238,7 +238,9 @@ const OutLink = ({ shareId, chatId }: { shareId: string; chatId: string }) => {
})); }));
}} }}
onStartChat={startChat} onStartChat={startChat}
onDelMessage={({ index }) => delShareChatHistoryItemById({ chatId, index })} onDelMessage={({ contentId, index }) =>
delShareChatHistoryItemById({ chatId, contentId, index })
}
/> />
</Box> </Box>
</Flex> </Flex>
......
...@@ -16,11 +16,10 @@ export async function authOutLinkChat({ shareId, ip }: { shareId: string; ip?: s ...@@ -16,11 +16,10 @@ export async function authOutLinkChat({ shareId, ip }: { shareId: string; ip?: s
const uid = String(outLink.userId); const uid = String(outLink.userId);
// authBalance const [user] = await Promise.all([
const user = await authBalanceByUid(uid); authBalanceByUid(uid), // authBalance
...(global.feConfigs?.isPlus ? [authOutLinkLimit({ outLink, ip })] : []) // limit auth
// limit auth ]);
await authOutLinkLimit({ outLink, ip });
return { return {
user, user,
......
...@@ -16,7 +16,7 @@ type State = { ...@@ -16,7 +16,7 @@ type State = {
shareId: string; shareId: string;
}) => void; }) => void;
delOneShareHistoryByChatId: (chatId: string) => void; delOneShareHistoryByChatId: (chatId: string) => void;
delShareChatHistoryItemById: (e: { chatId: string; index: number }) => void; delShareChatHistoryItemById: (e: { chatId: string; contentId?: string; index: number }) => void;
delManyShareChatHistoryByShareId: (shareId?: string) => void; delManyShareChatHistoryByShareId: (shareId?: string) => void;
}; };
...@@ -100,14 +100,14 @@ export const useShareChatStore = create<State>()( ...@@ -100,14 +100,14 @@ export const useShareChatStore = create<State>()(
); );
}); });
}, },
delShareChatHistoryItemById({ chatId, index }) { delShareChatHistoryItemById({ chatId, contentId }) {
set((state) => { set((state) => {
// update history store // update history store
const newHistoryList = state.shareChatHistory.map((item) => const newHistoryList = state.shareChatHistory.map((item) =>
item.chatId === chatId item.chatId === chatId
? { ? {
...item, ...item,
chats: [...item.chats.slice(0, index), ...item.chats.slice(index + 1)] chats: item.chats.filter((item) => item.dataId !== contentId)
} }
: item : item
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment