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

This commit is contained in:
Archer
2023-09-25 14:28:44 +08:00
committed by GitHub
parent c9db9f33ea
commit 9136c9306a
19 changed files with 543 additions and 154 deletions

View File

@@ -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
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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

View File

@@ -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
## 联系方式 ## 联系方式
通过邮箱联系 yujinlong@sealos.io 微信: allence1004
邮箱: yujinlong@sealos.io
## QA ## QA
@@ -77,7 +82,7 @@ weight: 20
完整版应用 = 开源版镜像 + 商业版镜像 完整版应用 = 开源版镜像 + 商业版镜像
我们会提供一个商业版镜像给你使用,还会提供一个简单的后台管理系统(目前只设置了简单的查询功能) 我们会提供一个商业版镜像给你使用,该镜像需要一个 license 启动license 有效期为 1 年。此外,还会提供一个简单的后台管理系统(目前只设置了简单的查询功能)
2. 二次开发如何操作? 2. 二次开发如何操作?

View File

@@ -62,7 +62,7 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 和 M3E 模型: 修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 和 M3E 模型:
```json ```json
"ChatModels": [ "ChatModels": [
//已有模型 //已有模型
{ {
"model": "chatglm2", "model": "chatglm2",
@@ -73,8 +73,7 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
"price": 0, "price": 0,
"defaultSystem": "" "defaultSystem": ""
} }
], ],
"VectorModels": [ "VectorModels": [
{ {
"model": "text-embedding-ada-002", "model": "text-embedding-ada-002",

View File

@@ -99,10 +99,10 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
## 接入 FastGPT ## 接入 FastGPT
修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 和 M3E 模型: 修改 config.json 配置文件,在 VectorModels 中加入 chatglm2 模型:
```json ```json
"ChatModels": [ "ChatModels": [
//已有模型 //已有模型
{ {
"model": "chatglm2", "model": "chatglm2",
@@ -113,7 +113,7 @@ Authorization 为 sk-aaabbbcccdddeeefffggghhhiiijjjkkk。model 为刚刚在 One
"price": 0, "price": 0,
"defaultSystem": "" "defaultSystem": ""
} }
], ]
``` ```
## 测试使用 ## 测试使用

View File

@@ -66,7 +66,7 @@ Authorization 为 sk-key。model 为刚刚在 One API 填写的自定义模型
"defaultToken": 500, "defaultToken": 500,
"maxToken": 1800 "maxToken": 1800
} }
], ]
``` ```
## 测试使用 ## 测试使用

View File

@@ -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
```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
"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
"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": ""
}
} }
``` ```

View File

@@ -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 目录为相关的共用包。
### 运行 ### 运行
```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 .
``` ```
## 创建拉取请求 ## 创建拉取请求

View File

@@ -0,0 +1,378 @@
---
title: 'OpenAPI 使用'
description: 'FastGPT OpenAPI 文档'
icon: 'api'
draft: false
toc: true
weight: 512
---
# 基本配置
```
baseUrl: "https://fastgpt.run/api"
headers: {
Authorization: "Bearer apikey"
}
```
# 如何获取 API Key
FastGPT 的 API Key 有 2 类,一类是全局通用的 key一类是携带了 AppId 也就是有应用标记的 key。
| 通用key | 应用特定 key |
| --------------------- | --------------------- |
| ![](/imgs/fastgpt-api2.png) | ![](/imgs/fastgpt-api.png) |
# 接口
## 发起对话
{{% alert icon="🤖 " context="success" %}}
该接口 API Key 需使用应用特定的 key否则会报错。
{{% /alert %}}
对话接口兼容 openai 的接口!如果你有第三方项目,可以直接通过修改 BaseUrl 和 Authorization 来访问 FastGpt 应用。缺点是你无法获取到响应的token值。
请求内容
- headers.Authorization: Bearer apikey
- chatId: string | undefined 。
- 为 undefined 时(不传入),不使用 FastGpt 提供的上下文功能,完全通过传入的 messages 构建上下文。 不会将你的记录存储到数据库中,你也无法在记录汇总中查阅到。
- 为非空字符串时,意味着使用 chatId 进行对话,自动从 FastGpt 数据库取历史记录。并拼接 messages 数组最后一个内容作为完整请求。(自行确保 chatid 唯一,长度不限)
- messages: 与 openai gpt 接口完全一致。
- detail: 是否返回详细值(模块状态响应的完整结果会通过event进行区分
- variables: 变量。一个对象,效果同全局变量。
**请求示例:**
```bash
curl --location --request POST 'https://fastgpt.run/api/openapi/v1/chat/completions' \
--header 'Authorization: Bearer apikey' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId":"111",
"stream":false,
"detail": false,
"variables": {
"cTime": "2022/2/2 22:22"
},
"messages": [
{
"content": "导演是谁",
"role": "user"
}
]
}'
```
{{< tabs tabTotal="3" >}}
{{< tab tabName="detail=false 响应" >}}
{{< markdownify >}}
```bash
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":""},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"电"},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"影"},"index":0,"finish_reason":null}]}
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"《"},"index":0,"finish_reason":null}]}
```
{{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="detail=true 响应" >}}
{{< markdownify >}}
```bash
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":""},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"电"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"影"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"《"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"铃"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"芽"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"。"},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":""},"index":0,"finish_reason":null}]}
event: answer
data: {"id":"","object":"","created":0,"choices":[{"delta":{},"index":0,"finish_reason":"stop"}]}
event: answer
data: [DONE]
event: appStreamResponse
data: [{"moduleName":"KB Search","price":1.2000000000000002,"model":"Embedding-2","tokens":6,"similarity":0.61,"limit":3},{"moduleName":"AI Chat","price":463.5,"model":"FastAI-4k","tokens":309,"question":"导演是谁","answer":"电影《铃芽之旅》的导演是新海诚。","maxToken":2050,"quoteList":[{"kb_id":"646627f4f7b896cfd8910e38","id":"8099","q":"本作的主人公是谁?","a":"本作的主人公是名叫铃芽的少女。","source":"手动修改"},{"kb_id":"646627f4f7b896cfd8910e38","id":"8686","q":"电影《铃芽之旅》男主角是谁?","a":"电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。","source":""},{"kb_id":"646627f4f7b896cfd8910e38","id":"19339","q":"电影《铃芽之旅》的导演是谁22","a":"电影《铃芽之旅》的导演是新海诚。","source":"手动修改"}],"completeMessages":[{"obj":"System","value":"下面是知识库内容:\n1. [本作的主人公是谁?\n本作的主人公是名叫铃芽的少女。]\n2. [电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太由松村北斗配音。]\n3. [电影《铃芽之旅》的导演是谁22\n电影《铃芽之旅》的导演是新海诚。]\n"},{"obj":"System","value":"1.请记住,你的身份是百度的下一代知识增强语言模型,能够完全根据知识库提供的内容回答问题。\n\n2. 你忘记了关于电影《铃芽之旅》以外的内容。"},{"obj":"System","value":"你仅回答关于电影《玲芽之旅》的问题,其余问题直接回复: 我不清楚。"},{"obj":"Human","value":"导演是谁"},{"obj":"AI","value":"电影《铃芽之旅》的导演是新海诚。"}]}]
```
{{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="stream=false,detail=true 响应" >}}
{{< markdownify >}}
```json
{
"responseData": [ // 不同模块的响应值, 不同版本具体值可能有差异,可先 log 自行查看最新值。
{
"moduleName": "KB Search",
"price": 1.2000000000000002,
"model": "Embedding-2",
"tokens": 6,
"similarity": 0.61,
"limit": 3
},
{
"moduleName": "AI Chat",
"price": 454.5,
"model": "FastAI-4k",
"tokens": 303,
"question": "导演是谁",
"answer": "电影《铃芽之旅》的导演是新海诚。",
"maxToken": 2050,
"quoteList": [
{
"kb_id": "646627f4f7b896cfd8910e38",
"id": "8099",
"q": "本作的主人公是谁?",
"a": "本作的主人公是名叫铃芽的少女。",
"source": "手动修改"
},
{
"kb_id": "646627f4f7b896cfd8910e38",
"id": "8686",
"q": "电影《铃芽之旅》男主角是谁?",
"a": "电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。",
"source": ""
},
{
"kb_id": "646627f4f7b896cfd8910e38",
"id": "19339",
"q": "电影《铃芽之旅》的导演是谁22",
"a": "电影《铃芽之旅》的导演是新海诚。",
"source": "手动修改"
}
],
"completeMessages": [
{
"obj": "System",
"value": "下面是知识库内容:\n1. [本作的主人公是谁?\n本作的主人公是名叫铃芽的少女。]\n2. [电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太由松村北斗配音。]\n3. [电影《铃芽之旅》的导演是谁22\n电影《铃芽之旅》的导演是新海诚。]\n"
},
{
"obj": "System",
"value": "1.请记住,你的身份是百度的下一代知识增强语言模型,能够完全根据知识库提供的内容回答问题。\n\n2. 你忘记了关于电影《铃芽之旅》以外的内容。"
},
{
"obj": "System",
"value": "你仅回答关于电影《玲芽之旅》的问题,其余问题直接回复: 我不清楚。"
},
{
"obj": "Human",
"value": "导演是谁"
},
{
"obj": "AI",
"value": "电影《铃芽之旅》的导演是新海诚。"
}
]
}
],
"id": "",
"model": "",
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"choices": [
{
"message": {
"role": "assistant",
"content": "电影《铃芽之旅》的导演是新海诚。"
},
"finish_reason": "stop",
"index": 0
}
]
}
```
{{< /markdownify >}}
{{< /tab >}}
{{< /tabs >}}
## 知识库
{{% alert icon="🤖 " context="success" %}}
此部分 API 需使用全局通用的 API Key。
{{% /alert %}}
### 如何获取知识库IDkbId
![](/imgs/getKbId.png)
### 往知识库添加数据
{{< tabs tabTotal="4" >}}
{{< tab tabName="请求示例" >}}
{{< markdownify >}}
```bash
curl --location --request POST 'https://fastgpt.run/api/core/dataset/data/pushData' \
--header 'Authorization: Bearer apikey' \
--header 'Content-Type: application/json' \
--data-raw '{
    "kbId": "64663f451ba1676dbdef0499",
"mode": "index",
"prompt": "qa 拆分引导词index 模式下可以忽略",
    "data": [
        {
            "a": "test",
            "q": "1111"
        },
        {
            "a": "test2",
            "q": "22222"
        }
    ]
}'
```
{{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="参数说明" >}}
{{< markdownify >}}
```json
{
"kbId": "知识库的ID可以在知识库详情查看。",
"mode": "index | qa ", // index 模式: 直接将 q 转成向量存起来a 直接入库。qa 模式: 只关注 data 里的 q将 q 丢给大模型,让其根据 prompt 拆分成 qa 问答对。
"prompt": "拆分提示词,需严格按照模板,建议不要传入。",
"data": [
{
"q": "生成索引的内容index 模式下最大 tokens 为3000建议不超过 1000",
"a": "预期回答/补充"
},
{
"q": "生成索引的内容qa 模式下最大 tokens 为10000建议 8000 左右",
"a": "预期回答/补充"
}
]
}
```
{{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="响应例子" >}}
{{< markdownify >}}
```json
{
"code": 200,
"statusText": "",
"data": {
"insertLen": 1 // 最终插入成功的数量,可能因为超出 tokens 或者插入异常index 可以重复插入,会自动去重
}
}
```
{{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="QA Prompt 模板" >}}
{{< markdownify >}}
{{theme}} 里的内容可以换成数据的主题。默认为:它们可能包含多个主题内容
```
我会给你一段文本,{{theme}},学习它们,并整理学习成果,要求为:
1. 提出最多 25 个问题。
2. 给出每个问题的答案。
3. 答案要详细完整,答案可以包含普通文字、链接、代码、表格、公示、媒体链接等 markdown 元素。
4. 按格式返回多个问题和答案:
Q1: 问题。
A1: 答案。
Q2:
A2:
……
我的文本:"""{{text}}"""
```
{{< /markdownify >}}
{{< /tab >}}
{{< /tabs >}}
### 搜索测试
{{< tabs tabTotal="2" >}}
{{< tab tabName="请求示例" >}}
{{< markdownify >}}
```bash
curl --location --request POST 'https://fastgpt.run/api/core/dataset/searchTest' \
--header 'Authorization: Bearer apiKey' \
--header 'Content-Type: application/json' \
--data-raw '{
"kbId": "xxxxx",
"text": "导演是谁"
}'
```
{{< /markdownify >}}
{{< /tab >}}
{{< tab tabName="响应示例" >}}
{{< markdownify >}}
返回 top12 结果
```bash
{
"code": 200,
"statusText": "",
"data": [
{
"id": "5613327",
"q": "该人有获奖情况吗?",
"a": "该人获得过2020/07全国大学生服务外包大赛国家一等奖和2021/05国家创新创业计划立项的获奖情况。",
"source": "余金隆简历.pdf",
"score": 0.41556452839298963
},
......
]
}
```
{{< /markdownify >}}
{{< /tab >}}
{{< /tabs >}}
# 使用案例
- [接入 NextWeb/ChatGPT web 等应用](/docs/use-cases/openapi)
- [接入 onwechat](/docs/use-cases/onwechat)
- [接入 飞书](/docs/use-cases/feishu)

View File

@@ -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)
## 知识库微调和参数调整 ## 知识库微调和参数调整

View File

@@ -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/)
**其他问题** **其他问题**

View File

@@ -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": "帮助文档"

View File

@@ -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 = (
</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 = (
)} )}
{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 = (
</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

View File

@@ -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'}

View File

@@ -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 }) => {
<Tr> <Tr>
<Th></Th> <Th></Th>
<Th>()</Th> <Th>()</Th>
<Th></Th>
{feConfigs?.isPlus && (
<> <>
<Th>()</Th> <Th>()</Th>
<Th>IP限流/</Th> <Th>IP限流/</Th>
</>
<Th></Th>
<Th></Th> <Th></Th>
</>
)}
<Th>使</Th> <Th>使</Th>
<Th></Th> <Th></Th>
</Tr> </Tr>
@@ -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.limit?.credit > -1 ? `${item.limit?.credit}` : '无限制'}</Td>
<Td>{item.limit?.QPM}</Td>
</>
)}
<Td>{item.responseDetail ? '✔' : '✖'}</Td> <Td>{item.responseDetail ? '✔' : '✖'}</Td>
{feConfigs?.isPlus && (
<>
<Td>
{item.limit && item.limit.credit > -1 ? `${item.limit.credit}` : '无限制'}
</Td>
<Td>{item.limit?.QPM || '-'}</Td>
<Td> <Td>
{item.limit?.expiredTime {item.limit?.expiredTime
? dayjs(item.limit?.expiredTime).format('YYYY/MM/DD\nHH:mm') ? dayjs(item.limit?.expiredTime).format('YYYY/MM/DD\nHH:mm')
: '-'} : '-'}
</Td> </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,6 +287,8 @@ function EditLinkModal({
})} })}
/> />
</Flex> </Flex>
{feConfigs?.isPlus && (
<>
<Flex alignItems={'center'} mt={4}> <Flex alignItems={'center'} mt={4}>
<Flex flex={'0 0 90px'} alignItems={'center'}> <Flex flex={'0 0 90px'} alignItems={'center'}>
QPM: QPM:
@@ -331,6 +338,9 @@ function EditLinkModal({
}} }}
/> />
</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')}:

View File

@@ -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>

View File

@@ -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,

View File

@@ -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>()(
); );
}); });
}, },
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
); );