diff --git a/document/components/docs/not-found.tsx b/document/components/docs/not-found.tsx index bdac79a25b48..ffa838b02958 100644 --- a/document/components/docs/not-found.tsx +++ b/document/components/docs/not-found.tsx @@ -29,16 +29,16 @@ export default function NotFound() { const router = useRouter(); useEffect(() => { - const tryRedirect = async () => { + (async () => { if (exactMap[pathname]) { - router.replace(exactMap[pathname]); + window.location.replace(exactMap[pathname]); return; } for (const [oldPrefix, newPrefix] of Object.entries(prefixMap)) { if (pathname.startsWith(oldPrefix)) { const rest = pathname.slice(oldPrefix.length); - router.replace(newPrefix + rest); + window.location.replace(newPrefix + rest); return; } } @@ -54,17 +54,15 @@ export default function NotFound() { if (validPage) { console.log('validPage', validPage); - router.replace(validPage); + window.location.replace(validPage); return; } } catch (e) { console.warn('meta.json fallback failed:', e); } - router.replace(fallbackRedirect); - }; - - tryRedirect(); + window.location.replace(fallbackRedirect); + })(); }, [pathname, router]); return null; diff --git a/document/content/docs/introduction/development/configuration.mdx b/document/content/docs/introduction/development/configuration.mdx index a7df6484a843..9228d4909707 100644 --- a/document/content/docs/introduction/development/configuration.mdx +++ b/document/content/docs/introduction/development/configuration.mdx @@ -3,7 +3,7 @@ title: 配置文件介绍 description: FastGPT 配置参数介绍 --- -由于环境变量不利于配置复杂的内容,新版 FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `projects/app/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/development/docker/) 来挂载配置文件。 +由于环境变量不利于配置复杂的内容,新版 FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `projects/app/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/introduction/development/docker/) 来挂载配置文件。 **开发环境下**,你需要将示例配置文件 `config.json` 复制成 `config.local.json` 文件才会生效。 @@ -70,4 +70,4 @@ description: FastGPT 配置参数介绍 ### 使用 Marker 解析 PDF 文件 -[点击查看 Marker 接入教程](/docs/development/custom-models/marker) +[点击查看 Marker 接入教程](/docs/introduction/development/custom-models/marker) diff --git a/document/content/docs/introduction/development/custom-models/chatglm2-m3e.mdx b/document/content/docs/introduction/development/custom-models/chatglm2-m3e.mdx index a44eec19090c..1aab448c597f 100644 --- a/document/content/docs/introduction/development/custom-models/chatglm2-m3e.mdx +++ b/document/content/docs/introduction/development/custom-models/chatglm2-m3e.mdx @@ -9,9 +9,9 @@ FastGPT 默认使用了 OpenAI 的 LLM 模型和向量模型,如果想要私 ## 部署镜像 -+ 镜像名: `stawky/chatglm2-m3e:latest` -+ 国内镜像名: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/chatglm2-m3e:latest` -+ 端口号: 6006 +- 镜像名: `stawky/chatglm2-m3e:latest` +- 国内镜像名: `registry.cn-hangzhou.aliyuncs.com/fastgpt_docker/chatglm2-m3e:latest` +- 端口号: 6006 ``` # 设置安全凭证(即oneapi中的渠道密钥) @@ -21,7 +21,7 @@ FastGPT 默认使用了 OpenAI 的 LLM 模型和向量模型,如果想要私 ## 接入 OneAPI -文档链接:[One API](/docs/development/modelconfig/one-api/) +文档链接:[One API](/docs/introduction/development/modelconfig/one-api/) 为 chatglm2 和 m3e-large 各添加一个渠道,参数如下: @@ -97,7 +97,7 @@ M3E 模型的使用方法如下: 1. 创建知识库时候选择 M3E 模型。 注意,一旦选择后,知识库将无法修改向量模型。 - + ![](/imgs/model-m3e2.png) 2. 导入数据 @@ -108,7 +108,7 @@ M3E 模型的使用方法如下: 4. 应用绑定知识库 注意,应用只能绑定同一个向量模型的知识库,不能跨模型绑定。并且,需要注意调整相似度,不同向量模型的相似度(距离)会有所区别,需要自行测试实验。 - + ![](/imgs/model-m3e4.png) chatglm2 模型的使用方法如下: diff --git a/document/content/docs/introduction/development/custom-models/ollama.mdx b/document/content/docs/introduction/development/custom-models/ollama.mdx index 13830b5cbae9..66c9a9032c49 100644 --- a/document/content/docs/introduction/development/custom-models/ollama.mdx +++ b/document/content/docs/introduction/development/custom-models/ollama.mdx @@ -7,14 +7,14 @@ description: ' 采用 Ollama 部署自己的模型' ## 安装 Ollama -Ollama 本身支持多种安装方式,但是推荐使用 Docker 拉取镜像部署。如果是个人设备上安装了 Ollama 后续需要解决如何让 Docker 中 FastGPT 容器访问宿主机 Ollama的问题,较为麻烦。 +Ollama 本身支持多种安装方式,但是推荐使用 Docker 拉取镜像部署。如果是个人设备上安装了 Ollama 后续需要解决如何让 Docker 中 FastGPT 容器访问宿主机 Ollama的问题,较为麻烦。 ### Docker 安装(推荐) 你可以使用 Ollama 官方的 Docker 镜像来一键安装和启动 Ollama 服务(确保你的机器上已经安装了 Docker),命令如下: ```bash -docker pull ollama/ollama +docker pull ollama/ollama docker run --rm -d --name ollama -p 11434:11434 ollama/ollama ``` @@ -81,7 +81,6 @@ ollama pull [模型名] ![](/imgs/Ollama-pull.png) - ### 测试通信 在安装完成后,需要进行检测测试,首先进入 FastGPT 所在的容器,尝试访问自己的 Ollama ,命令如下: @@ -108,7 +107,7 @@ ollama ls ### 2. AI Proxy 接入 -如果你采用的是 FastGPT 中的默认配置文件部署[这里](/docs/development/docker.md),即默认采用 AI Proxy 进行启动。 +如果你采用的是 FastGPT 中的默认配置文件部署[这里](/docs/introduction/development/docker.md),即默认采用 AI Proxy 进行启动。 ![](/imgs/Ollama-aiproxy1.png) @@ -116,7 +115,7 @@ ollama ls ![](/imgs/Ollama-aiproxy2.png) -在 FastGPT 中点击账号->模型提供商->模型配置->新增模型,添加自己的模型即可,添加模型时需要保证模型ID和 OneAPI 中的模型名称一致。详细参考[这里](/docs/development/modelConfig/intro.md) +在 FastGPT 中点击账号->模型提供商->模型配置->新增模型,添加自己的模型即可,添加模型时需要保证模型ID和 OneAPI 中的模型名称一致。详细参考[这里](/docs/introduction/development/modelConfig/intro.md) ![](/imgs/Ollama-models2.png) @@ -177,4 +176,5 @@ docker run -it --network [ FastGPT 网络 ] --name 容器名 intel/oneapi-hpckit ![](/imgs/Ollama-models4.png) ### 6. 补充 + 上述接入 Ollama 的代理地址中,主机安装 Ollama 的地址为“http://[主机IP]:[端口]”,容器部署 Ollama 地址为“http://[容器名]:[端口]” diff --git a/document/content/docs/introduction/development/custom-models/xinference.mdx b/document/content/docs/introduction/development/custom-models/xinference.mdx index 86d4ff047fd4..04269343db03 100644 --- a/document/content/docs/introduction/development/custom-models/xinference.mdx +++ b/document/content/docs/introduction/development/custom-models/xinference.mdx @@ -13,8 +13,8 @@ Xinference 支持多种推理引擎作为后端,以满足不同场景下部署 如果你的目标是在一台 Linux 或者 Window 服务器上部署大模型,可以选择 Transformers 或 vLLM 作为 Xinference 的推理后端: -+ [Transformers](https://huggingface.co/docs/transformers/index):通过集成 Huggingface 的 Transformers 库作为后端,Xinference 可以最快地 集成当今自然语言处理(NLP)领域的最前沿模型(自然也包括 LLM)。 -+ [vLLM](https://vllm.ai/): vLLM 是由加州大学伯克利分校开发的一个开源库,专为高效服务大型语言模型(LLM)而设计。它引入了 PagedAttention 算法, 通过有效管理注意力键和值来改善内存管理,吞吐量能够达到 Transformers 的 24 倍,因此 vLLM 适合在生产环境中使用,应对高并发的用户访问。 +- [Transformers](https://huggingface.co/docs/transformers/index):通过集成 Huggingface 的 Transformers 库作为后端,Xinference 可以最快地 集成当今自然语言处理(NLP)领域的最前沿模型(自然也包括 LLM)。 +- [vLLM](https://vllm.ai/): vLLM 是由加州大学伯克利分校开发的一个开源库,专为高效服务大型语言模型(LLM)而设计。它引入了 PagedAttention 算法, 通过有效管理注意力键和值来改善内存管理,吞吐量能够达到 Transformers 的 24 倍,因此 vLLM 适合在生产环境中使用,应对高并发的用户访问。 假设你服务器配备 NVIDIA 显卡,可以参考[这篇文章中的指令来安装 CUDA](https://xorbits.cn/blogs/langchain-streamlit-doc-chat),从而让 Xinference 最大限度地利用显卡的加速功能。 @@ -98,7 +98,7 @@ xinference launch -n qwen-chat -s 14 -f pytorch ## 将本地模型接入 One API -One API 的部署和接入请参考[这里](/docs/development/modelconfig/one-api/)。 +One API 的部署和接入请参考[这里](/docs/introduction/development/modelconfig/one-api/)。 为 qwen1.5-chat 添加一个渠道,这里的 Base URL 需要填 Xinference 服务的端点,并且注册 qwen-chat (模型的 UID) 。 @@ -153,9 +153,6 @@ curl --location --request POST 'https://[oneapi_url]/v1/chat/completions' \ 然后重启 FastGPT 就可以在应用配置中选择 Qwen 模型进行对话: -![](/imgs/fastgpt-list-models.png) ---- - -+ 参考:[FastGPT + Xinference:一站式本地 LLM 私有化部署和应用开发](https://xorbits.cn/blogs/fastgpt-weather-chat) - +## ![](/imgs/fastgpt-list-models.png) +- 参考:[FastGPT + Xinference:一站式本地 LLM 私有化部署和应用开发](https://xorbits.cn/blogs/fastgpt-weather-chat) diff --git a/document/content/docs/introduction/development/docker.mdx b/document/content/docs/introduction/development/docker.mdx index be3c74d6a2d4..5f55b46a8dc5 100644 --- a/document/content/docs/introduction/development/docker.mdx +++ b/document/content/docs/introduction/development/docker.mdx @@ -58,7 +58,7 @@ Zilliz Cloud 由 Milvus 原厂打造,是全托管的 SaaS 向量数据库服 ### 1. 确保网络环境 -如果使用`OpenAI`等国外模型接口,请确保可以正常访问,否则会报错:`Connection error` 等。 方案可以参考:[代理方案](/docs/development/proxy/) +如果使用`OpenAI`等国外模型接口,请确保可以正常访问,否则会报错:`Connection error` 等。 方案可以参考:[代理方案](/docs/introduction/development/proxy/nginx) ### 2. 准备 Docker 环境 @@ -181,7 +181,7 @@ docker-compose up -d ### 6. 配置模型 - 首次登录FastGPT后,系统会提示未配置`语言模型`和`索引模型`,并自动跳转模型配置页面。系统必须至少有这两类模型才能正常使用。 -- 如果系统未正常跳转,可以在`账号-模型提供商`页面,进行模型配置。[点击查看相关教程](/docs/development/modelconfig/ai-proxy) +- 如果系统未正常跳转,可以在`账号-模型提供商`页面,进行模型配置。[点击查看相关教程](/docs/introduction/development/modelConfig/ai-proxy) - 目前已知可能问题:首次进入系统后,整个浏览器 tab 无法响应。此时需要删除该tab,重新打开一次即可。 ## FAQ @@ -271,7 +271,7 @@ docker-compose up -d ### 如何更新版本? -1. 查看[更新文档](/docs/development/upgrading/index/),确认要升级的版本,避免跨版本升级。 +1. 查看[更新文档](/docs/upgrading),确认要升级的版本,避免跨版本升级。 2. 修改镜像 tag 到指定版本 3. 执行下面命令会自动拉取镜像: @@ -284,7 +284,7 @@ docker-compose up -d ### 如何自定义配置文件? -修改`config.json`文件,并执行`docker-compose down`再执行`docker-compose up -d`重起容器。具体配置,参考[配置详解](/docs/development/configuration)。 +修改`config.json`文件,并执行`docker-compose down`再执行`docker-compose up -d`重起容器。具体配置,参考[配置详解](/docs/introduction/development/configuration)。 ### 如何检查自定义配置文件是否挂载 diff --git a/document/content/docs/introduction/development/faq.mdx b/document/content/docs/introduction/development/faq.mdx index 308d4eef889d..ba00cbc6e9f9 100644 --- a/document/content/docs/introduction/development/faq.mdx +++ b/document/content/docs/introduction/development/faq.mdx @@ -18,7 +18,7 @@ description: FastGPT 私有部署常见问题 ### OneAPI 错误 -带有`requestId`的,都是 OneAPI 提示错误,大部分都是因为模型接口报错。可以参考 [OneAPI 常见错误](/docs/development/faq/#三常见的-oneapi-错误) +带有`requestId`的,都是 OneAPI 提示错误,大部分都是因为模型接口报错。可以参考 [OneAPI 常见错误](/docs/introduction/development/faq/#三常见的-oneapi-错误) ## 二、通用问题 @@ -59,13 +59,15 @@ description: FastGPT 私有部署常见问题 1. 看日志。如果提示 JSON invalid,not support tool 之类的,说明该模型不支持工具调用或函数调用,需要设置`toolChoice=false`和`functionCall=false`,就会默认走提示词模式。目前内置提示词仅针对了商业模型API进行测试。问题分类基本可用,内容提取不太行。 2. 如果已经配置正常,并且没有错误日志,则说明可能提示词不太适合该模型,可以通过修改`customCQPrompt`来自定义提示词。 - + ### 页面崩溃 1. 关闭翻译 2. 检查配置文件是否正常加载,如果没有正常加载会导致缺失系统信息,在某些操作下会导致空指针。 - * 95%情况是配置文件不对。会提示 xxx undefined - * 提示`URI malformed`,请 Issue 反馈具体操作和页面,这是由于特殊字符串编码解析报错。 + +- 95%情况是配置文件不对。会提示 xxx undefined +- 提示`URI malformed`,请 Issue 反馈具体操作和页面,这是由于特殊字符串编码解析报错。 + 3. 某些api不兼容问题(较少) ### 开启内容补全后,响应速度变慢 @@ -102,7 +104,7 @@ description: FastGPT 私有部署常见问题 带有 requestId 的都是 OneAPI 的报错。 -### insufficient_user_quota user quota is not enough +### insufficient_user_quota user quota is not enough OneAPI 账号的余额不足,默认 root 用户只有 200 刀,可以手动修改。 @@ -120,7 +122,8 @@ FastGPT 模型配置文件中的 model 必须与 OneAPI 渠道中的模型对应 ### 点击模型测试失败 -OneAPI 只会测试渠道的第一个模型,并且只会测试对话模型,向量模型无法自动测试,需要手动发起请求进行测试。[查看测试模型命令示例](/docs/development/faq/#如何检查模型问题) +OneAPI 只会测试渠道的第一个模型,并且只会测试对话模型,向量模型无法自动测试,需要手动发起请求进行测试。[查看测试模型命令示例](/docs/introduction/development/faq/#如何检查模型问题) + ### get request url failed: Post `"https://xxx"` dial tcp: xxxx OneAPI 与模型网络不通,需要检查网络配置。 @@ -137,7 +140,6 @@ OneAPI 的 API Key 配置错误,需要修改`OPENAI_API_KEY`环境变量,并 2. 模型接口参数异常(温度、max token等可能不适配) 3. .... - ### Tiktoken 下载失败 由于 OneAPI 会在启动时从网络下载一个 tiktoken 的依赖,如果网络异常,就会导致启动失败。可以参考[OneAPI 离线部署](https://blog.csdn.net/wanh/article/details/139039216)解决。 @@ -304,35 +306,35 @@ curl --location --request POST 'https://oneapi.xxx/v1/chat/completions' \ ```json { - "id": "chatcmpl-A7kwo1rZ3OHYSeIFgfWYxu8X2koN3", - "object": "chat.completion.chunk", - "created": 1726412126, - "model": "gpt-4o-mini-2024-07-18", - "system_fingerprint": "fp_483d39d857", - "choices": [ - { + "id": "chatcmpl-A7kwo1rZ3OHYSeIFgfWYxu8X2koN3", + "object": "chat.completion.chunk", + "created": 1726412126, + "model": "gpt-4o-mini-2024-07-18", + "system_fingerprint": "fp_483d39d857", + "choices": [ + { + "index": 0, + "delta": { + "role": "assistant", + "content": null, + "tool_calls": [ + { "index": 0, - "delta": { - "role": "assistant", - "content": null, - "tool_calls": [ - { - "index": 0, - "id": "call_0n24eiFk8OUyIyrdEbLdirU7", - "type": "function", - "function": { - "name": "mEYIcFl84rYC", - "arguments": "" - } - } - ], - "refusal": null - }, - "logprobs": null, - "finish_reason": null - } - ], - "usage": null + "id": "call_0n24eiFk8OUyIyrdEbLdirU7", + "type": "function", + "function": { + "name": "mEYIcFl84rYC", + "arguments": "" + } + } + ], + "refusal": null + }, + "logprobs": null, + "finish_reason": null + } + ], + "usage": null } ``` diff --git a/document/content/docs/introduction/development/intro.mdx b/document/content/docs/introduction/development/intro.mdx index 0a8d479e9bf7..6b680bbf8691 100644 --- a/document/content/docs/introduction/development/intro.mdx +++ b/document/content/docs/introduction/development/intro.mdx @@ -24,6 +24,7 @@ import FastGPTLink from '@/components/docs/linkFastGPT'; 1. 用户默认的时区为 `Asia/Shanghai`,非 linux 环境时候,获取系统时间会异常,本地开发时候,可以将用户的时区调整成 UTC(+0)。 2. 建议先服务器装好**数据库**,再进行本地开发。 + ### 1. Fork 存储库 @@ -46,9 +47,11 @@ git clone git@github.com:/FastGPT.git ### 3. 安装数据库 -第一次开发,需要先部署数据库,建议本地开发可以随便找一台 2C2G 的轻量小数据库实践,或者新建文件夹并配置相关文件用以运行docker。数据库部署教程:[Docker 快速部署](/docs/development/docker/)。部署完了,可以本地访问其数据库。 +第一次开发,需要先部署数据库,建议本地开发可以随便找一台 2C2G 的轻量小数据库实践,或者新建文件夹并配置相关文件用以运行docker。数据库部署教程:[Docker 快速部署](/docs/introduction/development/docker/)。部署完了,可以本地访问其数据库。 + -Mongo 数据库需要注意,需要注意在连接地址中增加 `directConnection=true` 参数,才能连接上副本集的数据库。 + Mongo 数据库需要注意,需要注意在连接地址中增加 `directConnection=true` + 参数,才能连接上副本集的数据库。 ### 4. 初始配置 @@ -61,7 +64,7 @@ Mongo 数据库需要注意,需要注意在连接地址中增加 `directConnec **2. config 配置文件** -复制 `data/config.json` 文件,生成一个 `data/config.local.json` 配置文件,具体配置参数说明,可参考 [config 配置说明](/docs/development/configuration) +复制 `data/config.json` 文件,生成一个 `data/config.local.json` 配置文件,具体配置参数说明,可参考 [config 配置说明](/docs/introduction/development/configuration) **注意:json 配置文件不能包含注释,介绍中为了方便看才加入的注释** @@ -128,7 +131,7 @@ make build name=app image=registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.8 FastGPT 在`pnpm i`后会执行`postinstall`脚本,用于自动生成`ChakraUI`的`Type`。如果没有权限,可以先执行`chmod -R +x ./scripts/`,再执行`pnpm i`。 仍不可行的话,可以手动执行`./scripts/postinstall.sh`里的内容。 -*如果是Windows下的话,可以使用git bash给`postinstall`脚本添加执行权限并执行sh脚本* +_如果是Windows下的话,可以使用git bash给`postinstall`脚本添加执行权限并执行sh脚本_ ### TypeError: Cannot read properties of null (reading 'useMemo' ) @@ -148,7 +151,11 @@ FastGPT 在`pnpm i`后会执行`postinstall`脚本,用于自动生成`ChakraUI 遇到困难了吗?有任何问题吗? 加入飞书群与开发者和用户保持沟通。 - + ## 代码结构说明 @@ -160,12 +167,12 @@ FastGPT 使用了 nextjs 的 page route 作为框架。为了区分好前后端 FastGPT 采用 pnpm workspace 方式构建 monorepo 项目,主要分为两个部分: -- projects/app - FastGPT 主项目 -- packages/ - 子模块 - - global - 共用代码,通常是放一些前后端都能执行的函数、类型声明、常量。 - - service - 服务端代码 - - web - 前端代码 - - plugin - 工作流自定义插件的代码 +- projects/app - FastGPT 主项目 +- packages/ - 子模块 + - global - 共用代码,通常是放一些前后端都能执行的函数、类型声明、常量。 + - service - 服务端代码 + - web - 前端代码 + - plugin - 工作流自定义插件的代码 ### 领域驱动模式(DDD) diff --git a/document/content/docs/introduction/development/modelConfig/ai-proxy.mdx b/document/content/docs/introduction/development/modelConfig/ai-proxy.mdx index a28b574d23ae..a44cf9194b34 100644 --- a/document/content/docs/introduction/development/modelConfig/ai-proxy.mdx +++ b/document/content/docs/introduction/development/modelConfig/ai-proxy.mdx @@ -17,7 +17,7 @@ AI Proxy 与 One API 类似,也是作为一个 OpenAI 接口管理 & 分发系 ## 运行原理 -AI proxy 核心模块: +AI proxy 核心模块: 1. 渠道管理:管理各家模型提供商的 API Key 和可用模型列表。 2. 模型调用:根据请求的模型,选中对应的渠道;根据渠道的 API 格式,构造请求体,发送请求;格式化响应体成标准格式返回。 @@ -47,12 +47,12 @@ AI proxy 相关功能,可以在`账号-模型提供商`页面找到。 1. 渠道名:展示在外部的渠道名称,仅作标识; 2. 厂商:模型对应的厂商,不同厂商对应不同的默认地址和 API 密钥格式; -3. 模型:当前渠道具体可以使用的模型,系统内置了主流的一些模型,如果下拉框中没有想要的选项,可以点击“新增模型”,[增加自定义模型](/docs/development/modelconfig/intro/#新增自定义模型); +3. 模型:当前渠道具体可以使用的模型,系统内置了主流的一些模型,如果下拉框中没有想要的选项,可以点击“新增模型”,[增加自定义模型](/docs/introduction/development/modelconfig/intro/#新增自定义模型); 4. 模型映射:将 FastGPT 请求的模型,映射到具体提供的模型上。例如: - + ```json { - "gpt-4o-test": "gpt-4o", + "gpt-4o-test": "gpt-4o" } ``` @@ -81,7 +81,7 @@ FatGPT 中的模型为 `gpt-4o-test`,向 AI Proxy 发起请求时也是 `gpt-4 ### 3. 启用模型 -最后在`模型配置`中,可以选择启用对应的模型,这样就能在平台中使用了,更多模型配置可以参考[模型配置](/docs/development/modelconfig/intro) +最后在`模型配置`中,可以选择启用对应的模型,这样就能在平台中使用了,更多模型配置可以参考[模型配置](/docs/introduction/development/modelconfig/intro) ![aiproxy8](/imgs/aiproxy-8.png) diff --git a/document/content/docs/introduction/development/modelConfig/intro.mdx b/document/content/docs/introduction/development/modelConfig/intro.mdx index 58a41595e739..b2a7d2cc37b7 100644 --- a/document/content/docs/introduction/development/modelConfig/intro.mdx +++ b/document/content/docs/introduction/development/modelConfig/intro.mdx @@ -15,11 +15,11 @@ import { Alert } from '@/components/docs/Alert'; #### AI Proxy -从 4.8.23 版本开始, FastGPT 支持在页面上配置模型提供商,即使用 [AI Proxy 接入教程](/docs/development/modelconfig/ai-proxy) 来进行模型聚合,从而可以对接更多模型提供商。 +从 4.8.23 版本开始, FastGPT 支持在页面上配置模型提供商,即使用 [AI Proxy 接入教程](/docs/introduction/development/modelconfig/ai-proxy) 来进行模型聚合,从而可以对接更多模型提供商。 #### One API -也可以使用 [OneAPI 接入教程](/docs/development/modelconfig/one-api)。你需要先在各服务商申请好 API 接入 OneAPI 后,才能在 FastGPT 中使用这些模型。示例流程如下: +也可以使用 [OneAPI 接入教程](/docs/introduction/development/modelconfig/one-api)。你需要先在各服务商申请好 API 接入 OneAPI 后,才能在 FastGPT 中使用这些模型。示例流程如下: ![alt text](/imgs/image-95.png) @@ -223,7 +223,7 @@ FastGPT 页面上提供了每类模型的简单测试,可以初步检查模型 #### 私有部署模型 -[点击查看部署 ReRank 模型教程](/docs/development/custom-models/bge-rerank/) +[点击查看部署 ReRank 模型教程](/docs/introduction/development/custom-models/bge-rerank/) ### 接入语音识别模型 @@ -253,7 +253,7 @@ OneAPI 的语言识别接口,无法正确的识别其他模型(会始终识 所有接口均遵循 OpenAI 提供的模型格式,可参考 [OpenAI API 文档](https://platform.openai.com/docs/api-reference/introduction) 进行配置。 -由于 OpenAI 没有提供 ReRank 模型,遵循的是 Cohere 的格式。[点击查看接口请求示例](/docs/development/faq/#如何检查模型问题) +由于 OpenAI 没有提供 ReRank 模型,遵循的是 Cohere 的格式。[点击查看接口请求示例](/docs/introduction/development/faq/#如何检查模型问题) ### 模型价格配置 @@ -276,13 +276,13 @@ OneAPI 的语言识别接口,无法正确的识别其他模型(会始终识 ### 添加模型 -你可以在`FastGPT-plugin`项目中`modules/model/provider`目录下,找对应模型提供商的配置文件,并追加模型配置。请自行全文检查,`model`字段,必须在所有模型中唯一。具体配置字段说明,参考[模型配置字段说明](/docs/development/modelconfig/intro/#通过配置文件配置) +你可以在`FastGPT-plugin`项目中`modules/model/provider`目录下,找对应模型提供商的配置文件,并追加模型配置。请自行全文检查,`model`字段,必须在所有模型中唯一。具体配置字段说明,参考[模型配置字段说明](/docs/introduction/development/modelconfig/intro/#通过配置文件配置) ## 旧版模型配置说明 配置好 OneAPI 后,需要在`config.json`文件中,手动的增加模型配置,并重启。 -由于环境变量不利于配置复杂的内容,FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `projects/app/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/development/docker/) 来挂载配置文件。 +由于环境变量不利于配置复杂的内容,FastGPT 采用了 ConfigMap 的形式挂载配置文件,你可以在 `projects/app/data/config.json` 看到默认的配置文件。可以参考 [docker-compose 快速部署](/docs/introduction/development/docker/) 来挂载配置文件。 **开发环境下**,你需要将示例配置文件 `config.json` 复制成 `config.local.json` 文件才会生效。 **Docker部署**,修改`config.json` 文件,需要重启容器。 diff --git a/document/content/docs/introduction/development/modelConfig/ppio.mdx b/document/content/docs/introduction/development/modelConfig/ppio.mdx index 278482e99cfc..ae78d1af927e 100644 --- a/document/content/docs/introduction/development/modelConfig/ppio.mdx +++ b/document/content/docs/introduction/development/modelConfig/ppio.mdx @@ -8,7 +8,8 @@ import { Alert } from '@/components/docs/Alert'; FastGPT 还可以通过 PPIO LLM API 接入模型。 -以下内容搬运自 [FastGPT 接入 PPIO LLM API](https://ppinfra.com/docs/third-party/fastgpt-use),可能会有更新不及时的情况。 + 以下内容搬运自 [FastGPT 接入 PPIO LLM + API](https://ppinfra.com/docs/third-party/fastgpt-use),可能会有更新不及时的情况。 FastGPT 是一个将 AI 开发、部署和使用全流程简化为可视化操作的平台。它使开发者不需要深入研究算法, @@ -32,15 +33,25 @@ PPIO 派欧云提供简单易用的 API 接口,让开发者能够轻松调用 登录派欧云控制台 [API 秘钥管理](https://www.ppinfra.com/settings/key-management) 页面,点击创建按钮。 注册账号填写邀请码【VOJL20】得 50 代金券 -创建 API 密钥 +创建 API 密钥 (3) 生成并保存 【API 密钥】 + -秘钥在服务端是加密存储,请在生成时保存好秘钥;若遗失可以在控制台上删除并创建一个新的秘钥。 + 秘钥在服务端是加密存储,请在生成时保存好秘钥;若遗失可以在控制台上删除并创建一个新的秘钥。 -生成 API 密钥 -保存 API 密钥 +生成 API 密钥 +保存 API 密钥 (4) 获取需要使用的模型 ID @@ -55,7 +66,7 @@ deepseek 系列: ## 2. 部署最新版 FastGPT 到本地环境 -请使用 v4.8.22 以上版本,部署参考: https://doc.tryfastgpt.ai/docs/development/intro/ + 请使用 v4.8.22 以上版本,部署参考: https://doc.fastgpt.io/docs/introduction/development/intro/ ## 3. 模型配置(下面两种方式二选其一) @@ -68,33 +79,62 @@ OPENAI_BASE_URL= http://OneAPI-IP:OneAPI-PORT/v1 - 修改后重启 FastGPT,按下图在模型提供商中选择派欧云 -选择派欧云 +选择派欧云 - 测试连通性 -以 deepseek 为例,在模型中选择使用 deepseek/deepseek-r1/community,点击图中②的位置进行连通性测试,出现图中绿色的的成功显示证明连通成功,可以进行后续的配置对话了 -测试连通性 + 以 deepseek 为例,在模型中选择使用 deepseek/deepseek-r1/community,点击图中②的位置进行连通性测试,出现图中绿色的的成功显示证明连通成功,可以进行后续的配置对话了 + 测试连通性 (2)不使用 OneAPI 接入 PPIO 模型 按照下图在模型提供商中选择派欧云 -选择派欧云 + +选择派欧云 - 配置模型 自定义请求地址中输入:`https://api.ppinfra.com/v3/openai/chat/completions` -配置模型 -配置模型 + + 配置模型 + 配置模型 - 测试连通性 -测试连通性 + 测试连通性 出现图中绿色的的成功显示证明连通成功,可以进行对话配置 ## 4. 配置对话 + (1)新建工作台 -新建工作台 + +新建工作台 (2)开始聊天 -开始聊天 +开始聊天 ## PPIO 全新福利重磅来袭 🔥 + 顺利完成教程配置步骤后,您将解锁两大权益:1. 畅享 PPIO 高速通道与 FastGPT 的效能组合;2.立即激活 **「新用户邀请奖励」** ————通过专属邀请码邀好友注册,您与好友可各领 50 元代金券,硬核福利助力 AI 工具效率倍增! 🎁 新手专享:立即使用邀请码【VOJL20】完成注册,50 元代金券奖励即刻到账! diff --git a/document/content/docs/introduction/development/modelConfig/siliconCloud.mdx b/document/content/docs/introduction/development/modelConfig/siliconCloud.mdx index f37fdca83ce4..fe23cb6d106b 100644 --- a/document/content/docs/introduction/development/modelConfig/siliconCloud.mdx +++ b/document/content/docs/introduction/development/modelConfig/siliconCloud.mdx @@ -5,11 +5,10 @@ description: 通过 SiliconCloud 体验开源模型 [SiliconCloud(硅基流动)](https://cloud.siliconflow.cn/i/TR9Ym0c4) 是一个以提供开源模型调用为主的平台,并拥有自己的加速引擎。帮助用户低成本、快速的进行开源模型的测试和使用。实际体验下来,他们家模型的速度和稳定性都非常不错,并且种类丰富,覆盖语言、向量、重排、TTS、STT、绘图、视频生成模型,可以满足 FastGPT 中所有模型需求。 -如果你想部分模型使用 SiliconCloud 的模型,可额外参考[OneAPI接入硅基流动](/docs/development/modelconfig/one-api/#硅基流动--开源模型大合集)。 +如果你想部分模型使用 SiliconCloud 的模型,可额外参考[OneAPI接入硅基流动](/docs/introduction/development/modelconfig/one-api/#硅基流动--开源模型大合集)。 本文会介绍完全使用 SiliconCloud 模型来部署 FastGPT 的方案。 - ## 1. 注册 SiliconCloud 账号 1. [点击注册硅基流动账号](https://cloud.siliconflow.cn/i/TR9Ym0c4) @@ -37,8 +36,8 @@ CHAT_API_KEY=sk-xxxxxx 随便新建一个简易应用,选择对应模型,并开启图片上传后进行测试: -| | | -| --- | --- | +| | | +| ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-68.png) | ![alt text](/imgs/image-70.png) | 可以看到,72B 的模型,性能还是非常快的,这要是本地没几个 4090,不说配置环境,输出怕都要 30s 了。 @@ -47,22 +46,22 @@ CHAT_API_KEY=sk-xxxxxx 新建一个知识库(由于只配置了一个向量模型,页面上不会展示向量模型选择) -| | | -| --- | --- | +| | | +| ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-72.png) | ![alt text](/imgs/image-71.png) | 导入本地文件,直接选择文件,然后一路下一步即可。79 个索引,大概花了 20s 的时间就完成了。现在我们去测试一下知识库问答。 首先回到我们刚创建的应用,选择知识库,调整一下参数后即可开始对话: -| | | | -| --- | --- | --- | +| | | | +| ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-73.png) | ![alt text](/imgs/image-75.png) | ![alt text](/imgs/image-76.png) | 对话完成后,点击底部的引用,可以查看引用详情,同时可以看到具体的检索和重排得分: -| | | -| --- | --- | +| | | +| ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-77.png) | ![alt text](/imgs/image-78.png) | ### 测试语音播放 @@ -79,8 +78,8 @@ CHAT_API_KEY=sk-xxxxxx 开启后,对话输入框中,会增加一个话筒的图标,点击可进行语音输入: -| | | -| --- | --- | +| | | +| ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-81.png) | ![alt text](/imgs/image-82.png) | ## 总结 diff --git a/document/content/docs/introduction/development/openapi/chat.mdx b/document/content/docs/introduction/development/openapi/chat.mdx index 6d150643829a..4da75d00f270 100644 --- a/document/content/docs/introduction/development/openapi/chat.mdx +++ b/document/content/docs/introduction/development/openapi/chat.mdx @@ -3,8 +3,6 @@ title: 对话接口 description: FastGPT OpenAPI 对话接口 --- -import { Alert } from '@/components/docs/Alert'; - # 如何获取 AppId 可在应用详情的路径里获取 AppId。 @@ -13,243 +11,141 @@ import { Alert } from '@/components/docs/Alert'; # 发起对话 - -* 该接口的 API Key 需使用`应用特定的 key`,否则会报错。 +- 该接口的 API Key 需使用`应用特定的 key`,否则会报错。 +- 有些包调用时,`BaseUrl`需要添加`v1`路径,有些不需要,如果出现404情况,可补充`v1`重试。 {/* * 对话现在有`v1`和`v2`两个接口,可以按需使用,v2 自 4.9.4 版本新增,v1 接口同时不再维护 */} -* 有些包调用时,`BaseUrl`需要添加`v1`路径,有些不需要,如果出现404情况,可补充`v1`重试。 - - ## 请求简易应用和工作流 `v1`对话接口兼容`GPT`的接口!如果你的项目使用的是标准的`GPT`官方接口,可以直接通过修改`BaseUrl`和 `Authorization`来访问 FastGpt 应用,不过需要注意下面几个规则: - * 传入的`model`,`temperature`等参数字段均无效,这些字段由编排决定,不会根据 API 参数改变。 * 不会返回实际消耗`Token`值,如果需要,可以设置`detail=true`,并手动计算 `responseData` 里的`tokens`值。 - ### 请求 - - - -```bash -curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \ ---header 'Authorization: Bearer fastgpt-xxxxxx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "chatId": "my_chatId", - "stream": false, - "detail": false, - "responseChatItemId": "my_responseChatItemId", - "variables": { - "uid": "asdfadsfasfd2323", - "name": "张三" - }, - "messages": [ - { - "role": "user", - "content": "导演是谁" - } - ] -}' -``` - - - - - -* 仅`messages`有部分区别,其他参数一致。 -* 目前不支持上传文件,需上传到自己的对象存储中,获取对应的文件链接。 - -```bash -curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \ ---header 'Authorization: Bearer fastgpt-xxxxxx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "chatId": "abcd", - "stream": false, - "messages": [ - { - "role": "user", - "content": [ - { - "type": "text", - "text": "导演是谁" - }, - { - "type": "image_url", - "image_url": { - "url": "图片链接" - } - }, - { - "type": "file_url", - "name": "文件名", - "url": "文档链接,支持 txt md html word pdf ppt csv excel" - } - ] - } - ] -}' -``` - - - - - - -- headers.Authorization: Bearer [apikey] -- chatId: string | undefined 。 - - 为 `undefined` 时(不传入),不使用 FastGpt 提供的上下文功能,完全通过传入的 messages 构建上下文。 - - 为`非空字符串`时,意味着使用 chatId 进行对话,自动从 FastGpt 数据库取历史记录,并使用 messages 数组最后一个内容作为用户问题,其余 message 会被忽略。请自行确保 chatId 唯一,长度小于250,通常可以是自己系统的对话框ID。 -- messages: 结构与 [GPT接口](https://platform.openai.com/docs/api-reference/chat/object) chat模式一致。 -- responseChatItemId: string | undefined 。如果传入,则会将该值作为本次对话的响应消息的 ID,FastGPT 会自动将该 ID 存入数据库。请确保,在当前`chatId`下,`responseChatItemId`是唯一的。 -- detail: 是否返回中间值(模块状态,响应的完整结果等),`stream模式`下会通过`event`进行区分,`非stream模式`结果保存在`responseData`中。 -- variables: 模块变量,一个对象,会替换模块中,输入框内容里的`[key]` - - - - - -{/* #### v2 - -v1,v2 接口请求参数一致,仅请求地址不一样。 + - -```bash -curl --location --request POST 'http://localhost:3000/api/v2/chat/completions' \ ---header 'Authorization: fastgpt-xxxxxx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "chatId": "my_chatId", - "stream": false, - "detail": false, - "responseChatItemId": "my_responseChatItemId", - "variables": { - "uid": "asdfadsfasfd2323", - "name": "张三" - }, - "messages": [ - { - "role": "user", - "content": "你是谁" - } - ] -}' -``` + ```bash + curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \ + --header 'Authorization: Bearer fastgpt-xxxxxx' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "chatId": "my_chatId", + "stream": false, + "detail": false, + "responseChatItemId": "my_responseChatItemId", + "variables": { + "uid": "asdfadsfasfd2323", + "name": "张三" + }, + "messages": [ + { + "role": "user", + "content": "导演是谁" + } + ] + }' + ``` - + -* 仅`messages`有部分区别,其他参数一致。 -* 目前不支持上传文件,需上传到自己的对象存储中,获取对应的文件链接。 - -```bash -curl --location --request POST 'http://localhost:3000/api/v2/chat/completions' \ ---header 'Authorization: Bearer fastgpt-xxxxxx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "chatId": "abcd", - "stream": false, - "messages": [ - { - "role": "user", - "content": [ - { - "type": "text", - "text": "导演是谁" - }, - { - "type": "image_url", - "image_url": { - "url": "图片链接" - } - }, - { - "type": "file_url", - "name": "文件名", - "url": "文档链接,支持 txt md html word pdf ppt csv excel" - } - ] - } - ] -}' -``` + - 仅`messages`有部分区别,其他参数一致。 + - 目前不支持上传文件,需上传到自己的对象存储中,获取对应的文件链接。 + + ```bash + curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \ + --header 'Authorization: Bearer fastgpt-xxxxxx' \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "chatId": "abcd", + "stream": false, + "messages": [ + { + "role": "user", + "content": [ + { + "type": "text", + "text": "导演是谁" + }, + { + "type": "image_url", + "image_url": { + "url": "图片链接" + } + }, + { + "type": "file_url", + "name": "文件名", + "url": "文档链接,支持 txt md html word pdf ppt csv excel" + } + ] + } + ] + }' + ``` - - + + +
- headers.Authorization: Bearer [apikey] - chatId: string | undefined 。 - - 为 `undefined` 时(不传入),不使用 FastGpt 提供的上下文功能,完全通过传入的 messages 构建上下文。 - - 为`非空字符串`时,意味着使用 chatId 进行对话,自动从 FastGpt 数据库取历史记录,并使用 messages 数组最后一个内容作为用户问题,其余 message 会被忽略。请自行确保 chatId 唯一,长度小于250,通常可以是自己系统的对话框ID。 -- messages: 结构与 [GPT接口](https://platform.openai.com/docs/api-reference/chat/object) chat模式一致。 -- responseChatItemId: string | undefined 。如果传入,则会将该值作为本次对话的响应消息的 ID,FastGPT 会自动将该 ID 存入数据库。请确保,在当前`chatId`下,`responseChatItemId`是唯一的。 -- detail: 是否返回中间值(模块状态,响应的完整结果等),`stream模式`下会通过`event`进行区分,`非stream模式`结果保存在`responseData`中。 + - 为时(不传入),不使用 FastGpt 提供的上下文功能,完全通过传入的 messages 构建上下文。 + - 为`非空字符串`时,意味着使用 chatId 进行对话,自动从 FastGpt 数据库取历史记录,并使用 messages数组最后一个内容作为用户问题,其余 message 会被忽略。请自行确保 chatId唯一,长度小于250,通常可以是自己系统的对话框ID。 +- messages: 结构与[GPT接口](https://platform.openai.com/docs/api-reference/chat/object) chat模式一致。 +- responseChatItemId: string | undefined 。如果传入,则会将该值作为本次对话的响应消息的 ID,FastGPT会自动将该 ID 存入数据库。请确保,在当前`chatId`下,`responseChatItemId`是唯一的。 +- detail:是否返回中间值(模块状态,响应的完整结果等),`stream模式`下会通过`event`进行区分,`非stream模式`结果保存在`responseData`中。 - variables: 模块变量,一个对象,会替换模块中,输入框内容里的`[key]` - +
-#### v1 - - - ### 响应 -#### v2 - -v2 接口比起 v1,主要变变化在于:会在每个节点运行结束后及时返回 response,而不是等工作流结束后再统一返回。 - ```json { - "id": "", - "model": "", - "usage": { - "prompt_tokens": 1, - "completion_tokens": 1, - "total_tokens": 1 - }, - "choices": [ - { - "message": { - "role": "assistant", - "content": "我是一个人工智能助手,旨在回答问题和提供信息。如果你有任何问题或者需要帮助,随时问我!" - }, - "finish_reason": "stop", - "index": 0 - } - ] + "id": "adsfasf", + "model": "", + "usage": { + "prompt_tokens": 1, + "completion_tokens": 1, + "total_tokens": 1 + }, + "choices": [ + { + "message": { + "role": "assistant", + "content": "电影《铃芽之旅》的导演是新海诚。" + }, + "finish_reason": "stop", + "index": 0 + } + ] } ``` - ```bash -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你好"},"index":0,"finish_reason":null}]} - -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"!"},"index":0,"finish_reason":null}]} - -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"今天"},"index":0,"finish_reason":null}]} +data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":""},"index":0,"finish_reason":null}]} -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"过得怎么样?"},"index":0,"finish_reason":null}]} +data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"电"},"index":0,"finish_reason":null}]} -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":null},"index":0,"finish_reason":"stop"}]} +data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"影"},"index":0,"finish_reason":null}]} -data: [DONE] +data: {"id":"","object":"","created":0,"choices":[{"delta":{"content":"《"},"index":0,"finish_reason":null}]} ``` @@ -257,240 +153,88 @@ data: [DONE] ```json { - "responseData": [ + "responseData": [ + // 不同模块的响应值, 不同版本具体值可能有差异,可先 log 自行查看最新值。 + { + "moduleName": "Dataset 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": [ { - "id": "iSol79OFrBH1I9kC", - "nodeId": "448745", - "moduleName": "common:core.module.template.work_start", - "moduleType": "workflowStart", - "runningTime": 0 + "dataset_id": "646627f4f7b896cfd8910e38", + "id": "8099", + "q": "本作的主人公是谁?", + "a": "本作的主人公是名叫铃芽的少女。", + "source": "手动修改" }, { - "id": "t1T94WCy6Su3BK4V", - "nodeId": "fjLpE3XPegmoGtbU", - "moduleName": "AI 对话", - "moduleType": "chatNode", - "runningTime": 1.46, - "totalPoints": 0, - "model": "GPT-4o-mini", - "tokens": 64, - "inputTokens": 10, - "outputTokens": 54, - "query": "你是谁", - "reasoningText": "", - "historyPreview": [ - { - "obj": "Human", - "value": "你是谁" - }, - { - "obj": "AI", - "value": "我是一个人工智能助手,旨在帮助回答问题和提供信息。如果你有任何问题或需要帮助,请告诉我!" - } - ], - "contextTotalLen": 2 - } - ], - "newVariables": { - - }, - "id": "", - "model": "", - "usage": { - "prompt_tokens": 1, - "completion_tokens": 1, - "total_tokens": 1 - }, - "choices": [ + "dataset_id": "646627f4f7b896cfd8910e38", + "id": "8686", + "q": "电影《铃芽之旅》男主角是谁?", + "a": "电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。", + "source": "" + }, { - "message": { - "role": "assistant", - "content": "我是一个人工智能助手,旨在帮助回答问题和提供信息。如果你有任何问题或需要帮助,请告诉我!" - }, - "finish_reason": "stop", - "index": 0 + "dataset_id": "646627f4f7b896cfd8910e38", + "id": "19339", + "q": "电影《铃芽之旅》的导演是谁?22", + "a": "电影《铃芽之旅》的导演是新海诚。", + "source": "手动修改" } - ] -} -``` - - - - - -```bash -event: flowNodeResponse -data: {"id":"iYv2uA9rCWAtulWo","nodeId":"workflowStartNodeId","moduleName":"流程开始","moduleType":"workflowStart","runningTime":0} - -event: flowNodeStatus -data: {"status":"running","name":"AI 对话"} - -event: answer -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"你好"},"index":0,"finish_reason":null}]} - -event: answer -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"!"},"index":0,"finish_reason":null}]} - -event: answer -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"今天"},"index":0,"finish_reason":null}]} - -event: answer -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":"过得怎么样?"},"index":0,"finish_reason":null}]} - -event: flowNodeResponse -data: {"id":"pVzLBF7M3Ol4n7s6","nodeId":"ixe20AHN3jy74pKf","moduleName":"AI 对话","moduleType":"chatNode","runningTime":1.48,"totalPoints":0.0042,"model":"Qwen-plus","tokens":28,"inputTokens":8,"outputTokens":20,"query":"你好","reasoningText":"","historyPreview":[{"obj":"Human","value":"你好"},{"obj":"AI","value":"你好!今天过得怎么样?"}],"contextTotalLen":2} - -event: answer -data: {"id":"","object":"","created":0,"model":"","choices":[{"delta":{"role":"assistant","content":null},"index":0,"finish_reason":"stop"}]} - -event: answer -data: [DONE] -``` - - - - -event取值: - -- answer: 返回给客户端的文本(最终会算作回答) -- fastAnswer: 指定回复返回给客户端的文本(最终会算作回答) -- toolCall: 执行工具 -- toolParams: 工具参数 -- toolResponse: 工具返回 -- flowNodeStatus: 运行到的节点状态 -- flowNodeResponse: 单个节点详细响应 -- updateVariables: 更新变量 -- error: 报错 - - - - -#### v1 */} - - - - -```json -{ - "id": "adsfasf", - "model": "", - "usage": { - "prompt_tokens": 1, - "completion_tokens": 1, - "total_tokens": 1 - }, - "choices": [ + ], + "completeMessages": [ { - "message": { - "role": "assistant", - "content": "电影《铃芽之旅》的导演是新海诚。" - }, - "finish_reason": "stop", - "index": 0 - } - ] -} -``` - - - - - -```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}]} -``` - - - -```json -{ - "responseData": [ // 不同模块的响应值, 不同版本具体值可能有差异,可先 log 自行查看最新值。 + "obj": "System", + "value": "下面是知识库内容:\n1. [本作的主人公是谁?\n本作的主人公是名叫铃芽的少女。]\n2. [电影《铃芽之旅》男主角是谁?\n电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。]\n3. [电影《铃芽之旅》的导演是谁?22\n电影《铃芽之旅》的导演是新海诚。]\n" + }, { - "moduleName": "Dataset Search", - "price": 1.2000000000000002, - "model": "Embedding-2", - "tokens": 6, - "similarity": 0.61, - "limit": 3 + "obj": "System", + "value": "1.请记住,你的身份是百度的下一代知识增强语言模型,能够完全根据知识库提供的内容回答问题。\n\n2. 你忘记了关于电影《铃芽之旅》以外的内容。" }, { - "moduleName": "AI Chat", - "price": 454.5, - "model": "FastAI-4k", - "tokens": 303, - "question": "导演是谁", - "answer": "电影《铃芽之旅》的导演是新海诚。", - "maxToken": 2050, - "quoteList": [ - { - "dataset_id": "646627f4f7b896cfd8910e38", - "id": "8099", - "q": "本作的主人公是谁?", - "a": "本作的主人公是名叫铃芽的少女。", - "source": "手动修改" - }, - { - "dataset_id": "646627f4f7b896cfd8910e38", - "id": "8686", - "q": "电影《铃芽之旅》男主角是谁?", - "a": "电影《铃芽之旅》男主角是宗像草太,由松村北斗配音。", - "source": "" - }, - { - "dataset_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": [ + "obj": "System", + "value": "你仅回答关于电影《玲芽之旅》的问题,其余问题直接回复: 我不清楚。" + }, { - "message": { - "role": "assistant", - "content": "电影《铃芽之旅》的导演是新海诚。" - }, - "finish_reason": "stop", - "index": 0 + "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 + } + ] } ``` @@ -547,7 +291,6 @@ event取值: - ### 交互节点响应 如果工作流中包含交互节点,依然是调用该 API 接口,需要设置`detail=true`,并可以从`event=interactive`的数据中获取交互节点的配置信息。如果是`stream=false`,则可以从 choice 中获取`type=interactive`的元素,获取交互节点的选择信息。 @@ -559,69 +302,70 @@ event取值: ```json { - "interactive": { - "type": "userSelect", - "params": { - "description": "测试", - "userSelectOptions": [ - { - "value": "Confirm", - "key": "option1" - }, - { - "value": "Cancel", - "key": "option2" - } - ] + "interactive": { + "type": "userSelect", + "params": { + "description": "测试", + "userSelectOptions": [ + { + "value": "Confirm", + "key": "option1" + }, + { + "value": "Cancel", + "key": "option2" } + ] } + } } ``` + ```json { - "interactive": { - "type": "userInput", - "params": { - "description": "测试", - "inputForm": [ - { - "type": "input", - "key": "测试 1", - "label": "测试 1", - "description": "", - "value": "", - "defaultValue": "", - "valueType": "string", - "required": false, - "list": [ - { - "label": "", - "value": "" - } - ] - }, - { - "type": "numberInput", - "key": "测试 2", - "label": "测试 2", - "description": "", - "value": "", - "defaultValue": "", - "valueType": "number", - "required": false, - "list": [ - { - "label": "", - "value": "" - } - ] - } - ] + "interactive": { + "type": "userInput", + "params": { + "description": "测试", + "inputForm": [ + { + "type": "input", + "key": "测试 1", + "label": "测试 1", + "description": "", + "value": "", + "defaultValue": "", + "valueType": "string", + "required": false, + "list": [ + { + "label": "", + "value": "" + } + ] + }, + { + "type": "numberInput", + "key": "测试 2", + "label": "测试 2", + "description": "", + "value": "", + "defaultValue": "", + "valueType": "number", + "required": false, + "list": [ + { + "label": "", + "value": "" + } + ] } + ] } + } } ``` @@ -679,17 +423,15 @@ curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions'
- - ## 请求插件 插件的接口与对话接口一致,仅请求参数略有区别,有以下规定: -* 调用插件类型的应用时,接口默认为`detail`模式。 -* 无需传入 `chatId`,因为插件只能运行一轮。 -* 无需传入`messages`。 -* 通过传递`variables`来代表插件的输入。 -* 通过获取`pluginData`来获取插件输出。 +- 调用插件类型的应用时,接口默认为`detail`模式。 +- 无需传入 `chatId`,因为插件只能运行一轮。 +- 无需传入`messages`。 +- 通过传递`variables`来代表插件的输入。 +- 通过获取`pluginData`来获取插件输出。 ### 请求示例 @@ -711,73 +453,73 @@ curl --location --request POST 'http://localhost:3000/api/v1/chat/completions' \ -* 插件的输出可以通过查找`responseData`中, `moduleType=pluginOutput`的元素,其`pluginOutput`是插件的输出。 -* 流输出,仍可以通过`choices`进行获取。 +- 插件的输出可以通过查找`responseData`中, `moduleType=pluginOutput`的元素,其`pluginOutput`是插件的输出。 +- 流输出,仍可以通过`choices`进行获取。 ```json { - "responseData": [ + "responseData": [ + { + "nodeId": "fdDgXQ6SYn8v", + "moduleName": "AI 对话", + "moduleType": "chatNode", + "totalPoints": 0.685, + "model": "FastAI-3.5", + "tokens": 685, + "query": "你好", + "maxToken": 2000, + "historyPreview": [ { - "nodeId": "fdDgXQ6SYn8v", - "moduleName": "AI 对话", - "moduleType": "chatNode", - "totalPoints": 0.685, - "model": "FastAI-3.5", - "tokens": 685, - "query": "你好", - "maxToken": 2000, - "historyPreview": [ - { - "obj": "Human", - "value": "你好" - }, - { - "obj": "AI", - "value": "你好!有什么可以帮助你的吗?欢迎向我提问。" - } - ], - "contextTotalLen": 14, - "runningTime": 1.73 + "obj": "Human", + "value": "你好" }, { - "nodeId": "pluginOutput", - "moduleName": "插件输出", - "moduleType": "pluginOutput", - "totalPoints": 0, - "pluginOutput": { - "result": "你好!有什么可以帮助你的吗?欢迎向我提问。" - }, - "runningTime": 0 + "obj": "AI", + "value": "你好!有什么可以帮助你的吗?欢迎向我提问。" } - ], - "newVariables": { - "query": "你好" + ], + "contextTotalLen": 14, + "runningTime": 1.73 }, - "id": "safsafsa", - "model": "", - "usage": { - "prompt_tokens": 1, - "completion_tokens": 1, - "total_tokens": 1 - }, - "choices": [ - { - "message": { - "role": "assistant", - "content": "你好!有什么可以帮助你的吗?欢迎向我提问。" - }, - "finish_reason": "stop", - "index": 0 - } - ] + { + "nodeId": "pluginOutput", + "moduleName": "插件输出", + "moduleType": "pluginOutput", + "totalPoints": 0, + "pluginOutput": { + "result": "你好!有什么可以帮助你的吗?欢迎向我提问。" + }, + "runningTime": 0 + } + ], + "newVariables": { + "query": "你好" + }, + "id": "safsafsa", + "model": "", + "usage": { + "prompt_tokens": 1, + "completion_tokens": 1, + "total_tokens": 1 + }, + "choices": [ + { + "message": { + "role": "assistant", + "content": "你好!有什么可以帮助你的吗?欢迎向我提问。" + }, + "finish_reason": "stop", + "index": 0 + } + ] } ``` -* 插件的输出可以通过获取`event=flowResponses`中的字符串,并将其反序列化后得到一个数组。同样的,查找 `moduleType=pluginOutput`的元素,其`pluginOutput`是插件的输出。 -* 流输出,仍和对话接口一样获取。 +- 插件的输出可以通过获取`event=flowResponses`中的字符串,并将其反序列化后得到一个数组。同样的,查找 `moduleType=pluginOutput`的元素,其`pluginOutput`是插件的输出。 +- 流输出,仍和对话接口一样获取。 ```bash event: flowNodeStatus @@ -858,22 +600,20 @@ event取值: # 对话 CRUD - -* 以下接口可使用任意`API Key`调用。 +* 以下接口可使用任意`API Key`调用。 * 4.8.12 以上版本才能使用 - **重要字段** -* chatId - 指一个应用下,某一个对话窗口的 ID -* dataId - 指一个对话窗口下,某一个对话记录的 ID +- chatId - 指一个应用下,某一个对话窗口的 ID +- dataId - 指一个对话窗口下,某一个对话记录的 ID ## 历史记录 ### 获取某个应用历史记录 - + ```bash curl --location --request POST 'http://localhost:3000/api/core/chat/getHistories' \ @@ -890,44 +630,43 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/getHistories - +
- appId - 应用 Id - offset - 偏移量,即从第几条数据开始取 - pageSize - 记录数量 - source - 对话源。source=api,表示获取通过 API 创建的对话(不会获取到页面上的对话记录) - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "list": [ - { - "chatId": "usdAP1GbzSGu", - "updateTime": "2024-10-13T03:29:05.779Z", - "appId": "66e29b870b24ce35330c0f08", - "customTitle": "", - "title": "你好", - "top": false - }, - { - "chatId": "lC0uTAsyNBlZ", - "updateTime": "2024-10-13T03:22:19.950Z", - "appId": "66e29b870b24ce35330c0f08", - "customTitle": "", - "title": "测试", - "top": false - } - ], - "total": 2 - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "list": [ + { + "chatId": "usdAP1GbzSGu", + "updateTime": "2024-10-13T03:29:05.779Z", + "appId": "66e29b870b24ce35330c0f08", + "customTitle": "", + "title": "你好", + "top": false + }, + { + "chatId": "lC0uTAsyNBlZ", + "updateTime": "2024-10-13T03:22:19.950Z", + "appId": "66e29b870b24ce35330c0f08", + "customTitle": "", + "title": "测试", + "top": false + } + ], + "total": 2 + } } ``` @@ -939,7 +678,6 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/getHistories - ```bash curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistory' \ --header 'Authorization: Bearer [apikey]' \ @@ -955,24 +693,22 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistor - - +
- appId - 应用 Id - chatId - 历史记录 Id - customTitle - 自定义对话名 - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` @@ -980,10 +716,10 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistor
### 置顶 / 取消置顶 + - ```bash curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistory' \ --header 'Authorization: Bearer [apikey]' \ @@ -999,24 +735,22 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistor - - +
- appId - 应用Id - chatId - 历史记录 Id - top - 是否置顶,ture 置顶,false 取消置顶 - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` @@ -1028,7 +762,6 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/updateHistor - ```bash curl --location --request DELETE 'http://localhost:3000/api/core/chat/delHistory?chatId=[chatId]&appId=[appId]' \ --header 'Authorization: Bearer [apikey]' @@ -1038,23 +771,21 @@ curl --location --request DELETE 'http://localhost:3000/api/core/chat/delHistory - - +
- appId - 应用 Id - chatId - 历史记录 Id - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` @@ -1066,8 +797,7 @@ curl --location --request DELETE 'http://localhost:3000/api/core/chat/delHistory 仅会情况通过 API Key 创建的对话历史记录,不会清空在线使用、分享链接等其他来源的对话历史记录。 - - + ```bash curl --location --request DELETE 'http://localhost:3000/api/core/chat/clearHistories?appId=[appId]' \ @@ -1078,22 +808,20 @@ curl --location --request DELETE 'http://localhost:3000/api/core/chat/clearHisto - - +
- appId - 应用 Id - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` @@ -1109,79 +837,69 @@ curl --location --request DELETE 'http://localhost:3000/api/core/chat/clearHisto + ```bash + curl --location --request GET 'http://localhost:3000/api/core/chat/init?appId=[appId]&chatId=[chatId]' \ + --header 'Authorization: Bearer [apikey]' + ``` -```bash -curl --location --request GET 'http://localhost:3000/api/core/chat/init?appId=[appId]&chatId=[chatId]' \ ---header 'Authorization: Bearer [apikey]' -``` + - - -- appId - 应用 Id +
+- appId - 应用 Id - chatId - 历史记录 Id - +
- + -```json -{ + ```json + { "code": 200, "statusText": "", "message": "", "data": { - "chatId": "sPVOuEohjo3w", - "appId": "66e29b870b24ce35330c0f08", - "variables": { - + "chatId": "sPVOuEohjo3w", + "appId": "66e29b870b24ce35330c0f08", + "variables": {}, + "app": { + "chatConfig": { + "questionGuide": true, + "ttsConfig": { + "type": "web" + }, + "whisperConfig": { + "open": false, + "autoSend": false, + "autoTTSResponse": false + }, + "chatInputGuide": { + "open": false, + "textList": [], + "customUrl": "" + }, + "instruction": "", + "variables": [], + "fileSelectConfig": { + "canSelectFile": true, + "canSelectImg": true, + "maxFiles": 10 + }, + "_id": "66f1139aaab9ddaf1b5c596d", + "welcomeText": "" }, - "app": { - "chatConfig": { - "questionGuide": true, - "ttsConfig": { - "type": "web" - }, - "whisperConfig": { - "open": false, - "autoSend": false, - "autoTTSResponse": false - }, - "chatInputGuide": { - "open": false, - "textList": [ - - ], - "customUrl": "" - }, - "instruction": "", - "variables": [ - - ], - "fileSelectConfig": { - "canSelectFile": true, - "canSelectImg": true, - "maxFiles": 10 - }, - "_id": "66f1139aaab9ddaf1b5c596d", - "welcomeText": "" - }, - "chatModels": [ - "GPT-4o-mini" - ], - "name": "测试", - "avatar": "/imgs/app/avatar/workflow.svg", - "intro": "", - "type": "advanced", - "pluginInputs": [ - - ] - } + "chatModels": ["GPT-4o-mini"], + "name": "测试", + "avatar": "/imgs/app/avatar/workflow.svg", + "intro": "", + "type": "advanced", + "pluginInputs": [] + } } -} -``` + } + ```
@@ -1191,7 +909,6 @@ curl --location --request GET 'http://localhost:3000/api/core/chat/init?appId=[a - ```bash curl --location --request POST 'http://localhost:3000/api/core/chat/getPaginationRecords' \ --header 'Authorization: Bearer [apikey]' \ @@ -1209,68 +926,60 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/getPaginatio - - +
- appId - 应用 Id - chatId - 历史记录 Id - offset - 偏移量 - pageSize - 记录数量 - loadCustomFeedbacks - 是否读取自定义反馈(可选) - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "list": [ - { - "_id": "670b84e6796057dda04b0fd2", - "dataId": "jzqdV4Ap1u004rhd2WW8yGLn", - "obj": "Human", - "value": [ - { - "type": "text", - "text": { - "content": "你好" - } - } - ], - "customFeedbacks": [ - - ] - }, - { - "_id": "670b84e6796057dda04b0fd3", - "dataId": "x9KQWcK9MApGdDQH7z7bocw1", - "obj": "AI", - "value": [ - { - "type": "text", - "text": { - "content": "你好!有什么我可以帮助你的吗?" - } - } - ], - "customFeedbacks": [ - - ], - "llmModuleAccount": 1, - "totalQuoteList": [ - - ], - "totalRunningTime": 2.42, - "historyPreviewLength": 2 + "code": 200, + "statusText": "", + "message": "", + "data": { + "list": [ + { + "_id": "670b84e6796057dda04b0fd2", + "dataId": "jzqdV4Ap1u004rhd2WW8yGLn", + "obj": "Human", + "value": [ + { + "type": "text", + "text": { + "content": "你好" } + } ], - "total": 2 - } + "customFeedbacks": [] + }, + { + "_id": "670b84e6796057dda04b0fd3", + "dataId": "x9KQWcK9MApGdDQH7z7bocw1", + "obj": "AI", + "value": [ + { + "type": "text", + "text": { + "content": "你好!有什么我可以帮助你的吗?" + } + } + ], + "customFeedbacks": [], + "llmModuleAccount": 1, + "totalQuoteList": [], + "totalRunningTime": 2.42, + "historyPreviewLength": 2 + } + ], + "total": 2 + } } ``` @@ -1282,7 +991,6 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/getPaginatio - ```bash curl --location --request GET 'http://localhost:3000/api/core/chat/getResData?appId=[appId]&chatId=[chatId]&dataId=[dataId]' \ --header 'Authorization: Bearer [apikey]' @@ -1292,76 +1000,72 @@ curl --location --request GET 'http://localhost:3000/api/core/chat/getResData?ap - - +
- appId - 应用 Id - chatId - 对话 Id - dataId - 对话记录 Id - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": [ + "code": 200, + "statusText": "", + "message": "", + "data": [ + { + "id": "mVlxkz8NfyfU", + "nodeId": "448745", + "moduleName": "common:core.module.template.work_start", + "moduleType": "workflowStart", + "runningTime": 0 + }, + { + "id": "b3FndAdHSobY", + "nodeId": "z04w8JXSYjl3", + "moduleName": "AI 对话", + "moduleType": "chatNode", + "runningTime": 1.22, + "totalPoints": 0.02475, + "model": "GPT-4o-mini", + "tokens": 75, + "query": "测试", + "maxToken": 2000, + "historyPreview": [ + { + "obj": "Human", + "value": "你好" + }, + { + "obj": "AI", + "value": "你好!有什么我可以帮助你的吗?" + }, { - "id": "mVlxkz8NfyfU", - "nodeId": "448745", - "moduleName": "common:core.module.template.work_start", - "moduleType": "workflowStart", - "runningTime": 0 + "obj": "Human", + "value": "测试" }, { - "id": "b3FndAdHSobY", - "nodeId": "z04w8JXSYjl3", - "moduleName": "AI 对话", - "moduleType": "chatNode", - "runningTime": 1.22, - "totalPoints": 0.02475, - "model": "GPT-4o-mini", - "tokens": 75, - "query": "测试", - "maxToken": 2000, - "historyPreview": [ - { - "obj": "Human", - "value": "你好" - }, - { - "obj": "AI", - "value": "你好!有什么我可以帮助你的吗?" - }, - { - "obj": "Human", - "value": "测试" - }, - { - "obj": "AI", - "value": "测试成功!请问你有什么具体的问题或者需要讨论的话题吗?" - } - ], - "contextTotalLen": 4 + "obj": "AI", + "value": "测试成功!请问你有什么具体的问题或者需要讨论的话题吗?" } - ] + ], + "contextTotalLen": 4 + } + ] } ```
- ### 删除对话记录 - + - ```bash curl --location --request DELETE 'http://localhost:3000/api/core/chat/item/delete?contentId=[contentId]&chatId=[chatId]&appId=[appId]' \ --header 'Authorization: Bearer [apikey]' @@ -1371,24 +1075,22 @@ curl --location --request DELETE 'http://localhost:3000/api/core/chat/item/delet - - +
- appId - 应用 Id - chatId - 历史记录 Id - contentId - 对话记录 Id - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` @@ -1398,8 +1100,7 @@ curl --location --request DELETE 'http://localhost:3000/api/core/chat/item/delet ### 点赞 / 取消点赞 - - + ```bash curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/updateUserFeedback' \ @@ -1417,25 +1118,23 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/upd - - +
- appId - 应用 Id - chatId - 历史记录 Id - dataId - 对话记录 Id - userGoodFeedback - 用户点赞时的信息(可选),取消点赞时不填此参数即可 - +
- ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` @@ -1445,8 +1144,7 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/upd ### 点踩 / 取消点踩 - - + ```bash curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/updateUserFeedback' \ @@ -1464,13 +1162,12 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/upd - - +
- appId - 应用 Id - chatId - 历史记录 Id - dataId - 对话记录 Id - userBadFeedback - 用户点踩时的信息(可选),取消点踩时不填此参数即可 - +
@@ -1478,12 +1175,13 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/upd ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` +
@@ -1494,8 +1192,7 @@ curl --location --request POST 'http://localhost:3000/api/core/chat/feedback/upd 新版猜你想问,必须包含 appId 和 chatId 的参数才可以进行使用。会自动根据 chatId 去拉取最近 6 轮对话记录作为上下文来引导回答。 - - + ```bash curl --location --request POST 'http://localhost:3000/api/core/ai/agent/v2/createQuestionGuide' \ @@ -1516,14 +1213,11 @@ curl --location --request POST 'http://localhost:3000/api/core/ai/agent/v2/creat - - - -| 参数名 | 类型 | 必填 | 说明 | -| --- | --- | --- | --- | -| appId | string | ✅ | 应用 Id | -| chatId | string | ✅ | 对话 Id | -| questionGuide | object | | 自定义配置,不传的话,则会根据 appId,取最新发布版本的配置 | +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ------ | ---- | ---------------------------------------------------------- | +| appId | string | ✅ | 应用 Id | +| chatId | string | ✅ | 对话 Id | +| questionGuide | object | | 自定义配置,不传的话,则会根据 appId,取最新发布版本的配置 | ```ts type CreateQuestionGuideParams = OutLinkChatAuthProps & { @@ -1537,85 +1231,18 @@ type CreateQuestionGuideParams = OutLinkChatAuthProps & { }; ``` - - - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": [ - "你对AI有什么看法?", - "想了解AI的应用吗?", - "你希望AI能做什么?" - ] + "code": 200, + "statusText": "", + "message": "", + "data": ["你对AI有什么看法?", "想了解AI的应用吗?", "你希望AI能做什么?"] } ``` - - ---- - -**4.8.16 前旧版接口:** - - - - - -```bash -curl --location --request POST 'http://localhost:3000/api/core/ai/agent/createQuestionGuide' \ ---header 'Authorization: Bearer [apikey]' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "messages":[ - { - "role": "user", - "content": "你好" - }, - { - "role": "assistant", - "content": "你好!有什么我可以帮助你的吗?" - } - ] -}' -``` - - - - - - - -- messages - 对话消息,提供给 AI 的消息记录 - - - - - - - -```json -{ - "code": 200, - "statusText": "", - "message": "", - "data": [ - "你对AI有什么看法?", - "想了解AI的应用吗?", - "你希望AI能做什么?" - ] -} -``` - - - - - - diff --git a/document/content/docs/introduction/development/openapi/dataset.mdx b/document/content/docs/introduction/development/openapi/dataset.mdx index eca83b4424ab..c1699cac4daa 100644 --- a/document/content/docs/introduction/development/openapi/dataset.mdx +++ b/document/content/docs/introduction/development/openapi/dataset.mdx @@ -3,18 +3,15 @@ title: 知识库接口 description: FastGPT OpenAPI 知识库接口 --- -import { Alert } from '@/components/docs/Alert'; - | 如何获取知识库ID(datasetId) | 如何获取文件集合ID(collection_id) | -| --------------------- | --------------------- | -| ![](/imgs/getDatasetId.jpg) | ![](/imgs/getfile_id.webp) | +| ----------------------------- | ----------------------------------- | +| ![](/imgs/getDatasetId.jpg) | ![](/imgs/getfile_id.webp) | ## 创建训练订单 - **新例子** ```bash @@ -27,11 +24,9 @@ curl --location --request POST 'http://localhost:3000/api/support/wallet/usage/c }' ``` - - data 为 billId,可用于添加知识库数据时进行账单聚合。 ```json @@ -43,7 +38,6 @@ data 为 billId,可用于添加知识库数据时进行账单聚合。 } ``` - @@ -54,29 +48,27 @@ data 为 billId,可用于添加知识库数据时进行账单聚合。 - ```bash curl --location --request POST 'http://localhost:3000/api/core/dataset/create' \ --header 'Authorization: Bearer {{authorization}}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "parentId": null, - "type": "dataset", - "name":"测试", - "intro":"介绍", - "avatar": "", - "vectorModel": "text-embedding-ada-002", - "agentModel": "gpt-3.5-turbo-16k", - "vlmModel": "gpt-4.1" + "parentId": null, + "type": "dataset", + "name":"测试", + "intro":"介绍", + "avatar": "", + "vectorModel": "text-embedding-ada-002", + "agentModel": "gpt-3.5-turbo-16k", + "vlmModel": "gpt-4.1" }' ``` - +
- - parentId - 父级ID,用于构建目录结构。通常可以为 null 或者直接不传。 - type - `dataset`或者`folder`,代表普通知识库和文件夹。不传则代表创建普通知识库。 - name - 知识库名(必填) @@ -85,12 +77,12 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/create' \ - vectorModel - 向量模型(建议传空,用系统默认的) - agentModel - 文本处理模型(建议传空,用系统默认的) - vlmModel - 图片理解模型(建议传空,用系统默认的) - +
- + ```json { @@ -101,7 +93,6 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/create' \ } ``` -
@@ -110,7 +101,6 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/create' \ - ```bash curl --location --request POST 'http://localhost:3000/api/core/dataset/list?parentId=' \ --header 'Authorization: Bearer xxxx' \ @@ -120,51 +110,46 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/list?pare }' ``` - - - + - +
- parentId - 父级ID,传空字符串或者null,代表获取根目录下的知识库 - - +
- - + ```json { - "code": 200, - "statusText": "", - "message": "", - "data": [ - { - "_id": "65abc9bd9d1448617cba5e6c", - "parentId": null, - "avatar": "", - "name": "测试", - "intro": "", - "type": "dataset", - "permission": "private", - "canWrite": true, - "isOwner": true, - "vectorModel": { - "model": "text-embedding-ada-002", - "name": "Embedding-2", - "charsPointsPrice": 0, - "defaultToken": 512, - "maxToken": 8000, - "weight": 100 - } - } - ] + "code": 200, + "statusText": "", + "message": "", + "data": [ + { + "_id": "65abc9bd9d1448617cba5e6c", + "parentId": null, + "avatar": "", + "name": "测试", + "intro": "", + "type": "dataset", + "permission": "private", + "canWrite": true, + "isOwner": true, + "vectorModel": { + "model": "text-embedding-ada-002", + "name": "Embedding-2", + "charsPointsPrice": 0, + "defaultToken": 512, + "maxToken": 8000, + "weight": 100 + } + } + ] } ``` -
@@ -173,66 +158,60 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/list?pare - ```bash curl --location --request GET 'http://localhost:3000/api/core/dataset/detail?id=6593e137231a2be9c5603ba7' \ --header 'Authorization: Bearer {{authorization}}' \ ``` - - - +
- id: 知识库的ID - - +
- - + ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "_id": "6593e137231a2be9c5603ba7", - "parentId": null, - "teamId": "65422be6aa44b7da77729ec8", - "tmbId": "65422be6aa44b7da77729ec9", - "type": "dataset", - "status": "active", - "avatar": "/icon/logo.svg", - "name": "FastGPT test", - "vectorModel": { - "model": "text-embedding-ada-002", - "name": "Embedding-2", - "charsPointsPrice": 0, - "defaultToken": 512, - "maxToken": 8000, - "weight": 100 - }, - "agentModel": { - "model": "gpt-3.5-turbo-16k", - "name": "FastAI-16k", - "maxContext": 16000, - "maxResponse": 16000, - "charsPointsPrice": 0 - }, - "intro": "", - "permission": "private", - "updateTime": "2024-01-02T10:11:03.084Z", - "canWrite": true, - "isOwner": true - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "_id": "6593e137231a2be9c5603ba7", + "parentId": null, + "teamId": "65422be6aa44b7da77729ec8", + "tmbId": "65422be6aa44b7da77729ec9", + "type": "dataset", + "status": "active", + "avatar": "/icon/logo.svg", + "name": "FastGPT test", + "vectorModel": { + "model": "text-embedding-ada-002", + "name": "Embedding-2", + "charsPointsPrice": 0, + "defaultToken": 512, + "maxToken": 8000, + "weight": 100 + }, + "agentModel": { + "model": "gpt-3.5-turbo-16k", + "name": "FastAI-16k", + "maxContext": 16000, + "maxResponse": 16000, + "charsPointsPrice": 0 + }, + "intro": "", + "permission": "private", + "updateTime": "2024-01-02T10:11:03.084Z", + "canWrite": true, + "isOwner": true + } } ``` -
@@ -241,67 +220,60 @@ curl --location --request GET 'http://localhost:3000/api/core/dataset/detail?id= - ```bash curl --location --request DELETE 'http://localhost:3000/api/core/dataset/delete?id=65abc8729d1448617cba5df6' \ --header 'Authorization: Bearer {{authorization}}' \ ``` - - - +
- id: 知识库的ID - - +
- - + ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` -
- ## 集合 ### 通用创建参数说明(必看) **入参** -| 参数 | 说明 | 必填 | -| --- | --- | --- | -| datasetId | 知识库ID | ✅ | -| parentId: | 父级ID,不填则默认为根目录 | | -| trainingType | 数据处理方式。chunk: 按文本长度进行分割;qa: 问答对提取 | ✅ | -| indexPrefixTitle | 是否自动生成标题索引 | | -| autoIndexes | 是否自动生成索引(仅商业版支持) | | -| imageIndex | 是否自动生成图片索引(仅商业版支持) | | -| chunkSettingMode | 分块参数模式。auto: 系统默认参数; custom: 手动指定参数 | | -| chunkSplitMode | 分块拆分模式。size: 按长度拆分; char: 按字符拆分。chunkSettingMode=auto时不生效。 | | -| chunkSize | 分块大小,默认 1500。chunkSettingMode=auto时不生效。 | | -| indexSize | 索引大小,默认 512,必须小于索引模型最大token。chunkSettingMode=auto时不生效。 | | -| chunkSplitter | 自定义最高优先分割符号,除非超出文件处理最大上下文,否则不会进行进一步拆分。chunkSettingMode=auto时不生效。 | | -| qaPrompt | qa拆分提示词 | | -| tags | 集合标签(字符串数组) | | -| createTime | 文件创建时间(Date / String) | | +| 参数 | 说明 | 必填 | +| ---------------- | ----------------------------------------------------------------------------------------------------------- | ---- | +| datasetId | 知识库ID | ✅ | +| parentId: | 父级ID,不填则默认为根目录 | | +| trainingType | 数据处理方式。chunk: 按文本长度进行分割;qa: 问答对提取 | ✅ | +| indexPrefixTitle | 是否自动生成标题索引 | | +| autoIndexes | 是否自动生成索引(仅商业版支持) | | +| imageIndex | 是否自动生成图片索引(仅商业版支持) | | +| chunkSettingMode | 分块参数模式。auto: 系统默认参数; custom: 手动指定参数 | | +| chunkSplitMode | 分块拆分模式。size: 按长度拆分; char: 按字符拆分。chunkSettingMode=auto时不生效。 | | +| chunkSize | 分块大小,默认 1500。chunkSettingMode=auto时不生效。 | | +| indexSize | 索引大小,默认 512,必须小于索引模型最大token。chunkSettingMode=auto时不生效。 | | +| chunkSplitter | 自定义最高优先分割符号,除非超出文件处理最大上下文,否则不会进行进一步拆分。chunkSettingMode=auto时不生效。 | | +| qaPrompt | qa拆分提示词 | | +| tags | 集合标签(字符串数组) | | +| createTime | 文件创建时间(Date / String) | | **出参** -- collectionId - 新建的集合ID +- collectionId - 新建的集合ID - insertLen:插入的块数量 ### 创建一个空的集合 @@ -309,7 +281,6 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/delete? - ```bash curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create' \ --header 'Authorization: Bearer {{authorization}}' \ @@ -325,25 +296,22 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio }' ``` - - - +
- datasetId: 知识库的ID(必填) - parentId: 父级ID,不填则默认为根目录 - name: 集合名称(必填) -- type: +- type: - folder:文件夹 - virtual:虚拟集合(手动集合) - metadata: 元数据(暂时没啥用) - - +
- + data 为集合的 ID。 @@ -356,11 +324,9 @@ data 为集合的 ID。 } ``` -
- ### 创建一个纯文本集合 传入一段文字,创建一个集合,会根据传入的文字进行分割。 @@ -368,7 +334,6 @@ data 为集合的 ID。 - ```bash curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/text' \ --header 'Authorization: Bearer {{authorization}}' \ @@ -387,23 +352,20 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio }' ``` - - - +
- text: 原文本 - datasetId: 知识库的ID(必填) - parentId: 父级ID,不填则默认为根目录 - name: 集合名称(必填) - metadata: 元数据(暂时没啥用) - - +
- + data 为集合的 ID。 @@ -413,18 +375,17 @@ data 为集合的 ID。 "statusText": "", "message": "", "data": { - "collectionId": "65abcfab9d1448617cba5f0d", - "results": { - "insertLen": 5, // 分割成多少段 - "overToken": [], - "repeat": [], - "error": [] - } + "collectionId": "65abcfab9d1448617cba5f0d", + "results": { + "insertLen": 5, // 分割成多少段 + "overToken": [], + "repeat": [], + "error": [] + } } } ``` -
@@ -435,13 +396,12 @@ data 为集合的 ID。 - ```bash curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/create/link' \ --header 'Authorization: Bearer {{authorization}}' \ --header 'Content-Type: application/json' \ --data-raw '{ - "link":"https://doc.tryfastgpt.ai/docs/course/quick-start/", + "link":"https://doc.fastgpt.io/docs/course/quick-start/", "datasetId":"6593e137231a2be9c5603ba7", "parentId": null, @@ -455,43 +415,39 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio }' ``` - - - +
- link: 网络链接 - datasetId: 知识库的ID(必填) - parentId: 父级ID,不填则默认为根目录 - metadata.webPageSelector: 网页选择器,用于指定网页中的哪个元素作为文本(可选) - - +
- + data 为集合的 ID。 ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "collectionId": "65abd0ad9d1448617cba6031", - "results": { - "insertLen": 1, - "overToken": [], - "repeat": [], - "error": [] - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "collectionId": "65abd0ad9d1448617cba6031", + "results": { + "insertLen": 1, + "overToken": [], + "repeat": [], + "error": [] } + } } ``` -
@@ -502,7 +458,6 @@ data 为集合的 ID。 - 使用代码上传时,请注意中文 filename 需要进行 encode 处理,否则容易乱码。 ```bash @@ -512,43 +467,39 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio --form 'data="{\"datasetId\":\"6593e137231a2be9c5603ba7\",\"parentId\":null,\"trainingType\":\"chunk\",\"chunkSize\":512,\"chunkSplitter\":\"\",\"qaPrompt\":\"\",\"metadata\":{}}"' ``` - - +
需要使用 POST form-data 的格式上传。包含 file 和 data 两个字段。 - - file: 文件 -- data: 知识库相关信息(json序列化后传入),参数说明见上方“通用创建参数说明” - - +- data: 知识库相关信息(json序列化后传入),参数说明见上方"通用创建参数说明" +
- + data 为集合的 ID。 ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "collectionId": "65abc044e4704bac793fbd81", - "results": { - "insertLen": 1, - "overToken": [], - "repeat": [], - "error": [] - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "collectionId": "65abc044e4704bac793fbd81", + "results": { + "insertLen": 1, + "overToken": [], + "repeat": [], + "error": [] } + } } ``` -
@@ -557,8 +508,7 @@ data 为集合的 ID。 传入一个文件的 id,创建一个集合,会读取文件内容进行分割。目前支持:pdf, docx, md, txt, html, csv。 - - + 使用代码上传时,请注意中文 filename 需要进行 encode 处理,否则容易乱码。 @@ -567,27 +517,25 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio --header 'Authorization: Bearer fastgpt-xxx' \ --header 'Content-Type: application/json' \ --data-raw '{ - "name": "A Quick Guide to Building a Discord Bot.pdf", - "apiFileId":"A Quick Guide to Building a Discord Bot.pdf", + "name": "A Quick Guide to Building a Discord Bot.pdf", + "apiFileId":"A Quick Guide to Building a Discord Bot.pdf", - "datasetId": "674e9e479c3503c385495027", - "parentId": null, + "datasetId": "674e9e479c3503c385495027", + "parentId": null, - "trainingType": "chunk", - "chunkSize":512, - "chunkSplitter":"", - "qaPrompt":"" + "trainingType": "chunk", + "chunkSize":512, + "chunkSplitter":"", + "qaPrompt":"" }' ``` + + - - - - +
需要使用 POST form-data 的格式上传。包含 file 和 data 两个字段。 - - name: 集合名,建议就用文件名,必填。 - apiFileId: 文件的ID,必填。 - datasetId: 知识库的ID(必填) @@ -596,35 +544,32 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio - chunkSize: 每个 chunk 的长度(可选). chunk模式:100~3000; qa模式: 4000~模型最大token(16k模型通常建议不超过10000) - chunkSplitter: 自定义最高优先分割符号(可选) - qaPrompt: qa拆分自定义提示词(可选) - +
+
-
- - - + data 为集合的 ID。 ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "collectionId": "65abc044e4704bac793fbd81", - "results": { - "insertLen": 1, - "overToken": [], - "repeat": [], - "error": [] - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "collectionId": "65abc044e4704bac793fbd81", + "results": { + "insertLen": 1, + "overToken": [], + "repeat": [], + "error": [] } + } } ``` - - +
### 创建一个外部文件库集合(商业版) @@ -632,7 +577,6 @@ data 为集合的 ID。 - ```bash curl --location --request POST 'http://localhost:3000/api/proApi/core/dataset/collection/create/externalFileUrl' \ --header 'Authorization: Bearer {{authorization}}' \ @@ -654,26 +598,21 @@ curl --location --request POST 'http://localhost:3000/api/proApi/core/dataset/co }' ``` - - -| 参数 | 说明 | 必填 | -| --- | --- | --- | -| externalFileUrl | 文件访问链接(可以是临时链接) | ✅ | -| externalFileId | 外部文件ID | | -| filename | 自定义文件名,需要带后缀 | | -| createTime | 文件创建时间(Date ISO 字符串都 ok) | | - - +| 参数 | 说明 | 必填 | +| --------------- | ------------------------------------ | ---- | +| externalFileUrl | 文件访问链接(可以是临时链接) | ✅ | +| externalFileId | 外部文件ID | | +| filename | 自定义文件名,需要带后缀 | | +| createTime | 文件创建时间(Date ISO 字符串都 ok) | | - data 为集合的 ID。 ```json @@ -684,16 +623,15 @@ data 为集合的 ID。 "data": { "collectionId": "6646fcedfabd823cdc6de746", "results": { - "insertLen": 1, - "overToken": [], - "repeat": [], - "error": [] + "insertLen": 1, + "overToken": [], + "repeat": [], + "error": [] } } } ``` - @@ -702,8 +640,6 @@ data 为集合的 ID。 - -**4.8.19+** ```bash curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/listV2' \ --header 'Authorization: Bearer {{authorization}}' \ @@ -717,104 +653,78 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio }' ``` -**4.8.19-(不再维护)** -```bash -curl --location --request POST 'http://localhost:3000/api/core/dataset/collection/list' \ ---header 'Authorization: Bearer {{authorization}}' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "pageNum":1, - "pageSize": 10, - "datasetId":"6593e137231a2be9c5603ba7", - "parentId": null, - "searchText":"" -}' -``` - - - - +
- offset: 偏移量 - pageSize: 每页数量,最大30(选填) - datasetId: 知识库的ID(必填) - parentId: 父级Id(选填) - searchText: 模糊搜索文本(选填) - - +
- - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "list": [ - { - "_id": "6593e137231a2be9c5603ba9", - "parentId": null, - "tmbId": "65422be6aa44b7da77729ec9", - "type": "virtual", - "name": "手动录入", - "updateTime": "2099-01-01T00:00:00.000Z", - "dataAmount": 3, - "trainingAmount": 0, - "externalFileId": "1111", - "tags": [ - "11", - "测试的" - ], - "forbid": false, - "trainingType": "chunk", - "permission": { - "value": 4294967295, - "isOwner": true, - "hasManagePer": true, - "hasWritePer": true, - "hasReadPer": true - } - - }, - { - "_id": "65abd0ad9d1448617cba6031", - "parentId": null, - "tmbId": "65422be6aa44b7da77729ec9", - "type": "link", - "name": "快速上手 | FastGPT", - "rawLink": "https://doc.tryfastgpt.ai/docs/course/quick-start/", - "updateTime": "2024-01-20T13:54:53.031Z", - "dataAmount": 3, - "trainingAmount": 0, - "externalFileId": "222", - "tags": [ - "测试的" - ], - "forbid": false, - "trainingType": "chunk", - "permission": { - "value": 4294967295, - "isOwner": true, - "hasManagePer": true, - "hasWritePer": true, - "hasReadPer": true - } - } - ], - "total": 93 - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "list": [ + { + "_id": "6593e137231a2be9c5603ba9", + "parentId": null, + "tmbId": "65422be6aa44b7da77729ec9", + "type": "virtual", + "name": "手动录入", + "updateTime": "2099-01-01T00:00:00.000Z", + "dataAmount": 3, + "trainingAmount": 0, + "externalFileId": "1111", + "tags": ["11", "测试的"], + "forbid": false, + "trainingType": "chunk", + "permission": { + "value": 4294967295, + "isOwner": true, + "hasManagePer": true, + "hasWritePer": true, + "hasReadPer": true + } + }, + { + "_id": "65abd0ad9d1448617cba6031", + "parentId": null, + "tmbId": "65422be6aa44b7da77729ec9", + "type": "link", + "name": "快速上手 | FastGPT", + "rawLink": "https://doc.fastgpt.io/docs/course/quick-start/", + "updateTime": "2024-01-20T13:54:53.031Z", + "dataAmount": 3, + "trainingAmount": 0, + "externalFileId": "222", + "tags": ["测试的"], + "forbid": false, + "trainingType": "chunk", + "permission": { + "value": 4294967295, + "isOwner": true, + "hasManagePer": true, + "hasWritePer": true, + "hasReadPer": true + } + } + ], + "total": 93 + } } ``` -
@@ -823,71 +733,64 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/collectio - ```bash curl --location --request GET 'http://localhost:3000/api/core/dataset/collection/detail?id=65abcfab9d1448617cba5f0d' \ --header 'Authorization: Bearer {{authorization}}' \ ``` - - - +
- id: 集合的ID - - +
- - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "_id": "65abcfab9d1448617cba5f0d", - "parentId": null, - "teamId": "65422be6aa44b7da77729ec8", - "tmbId": "65422be6aa44b7da77729ec9", - "datasetId": { - "_id": "6593e137231a2be9c5603ba7", - "parentId": null, - "teamId": "65422be6aa44b7da77729ec8", - "tmbId": "65422be6aa44b7da77729ec9", - "type": "dataset", - "status": "active", - "avatar": "/icon/logo.svg", - "name": "FastGPT test", - "vectorModel": "text-embedding-ada-002", - "agentModel": "gpt-3.5-turbo-16k", - "intro": "", - "permission": "private", - "updateTime": "2024-01-02T10:11:03.084Z" - }, - "type": "virtual", - "name": "测试训练", - "trainingType": "qa", - "chunkSize": 8000, - "chunkSplitter": "", - "qaPrompt": "11", - "rawTextLength": 40466, - "hashRawText": "47270840614c0cc122b29daaddc09c2a48f0ec6e77093611ab12b69cba7fee12", - "createTime": "2024-01-20T13:50:35.838Z", - "updateTime": "2024-01-20T13:50:35.838Z", - "canWrite": true, - "sourceName": "测试训练" - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "_id": "65abcfab9d1448617cba5f0d", + "parentId": null, + "teamId": "65422be6aa44b7da77729ec8", + "tmbId": "65422be6aa44b7da77729ec9", + "datasetId": { + "_id": "6593e137231a2be9c5603ba7", + "parentId": null, + "teamId": "65422be6aa44b7da77729ec8", + "tmbId": "65422be6aa44b7da77729ec9", + "type": "dataset", + "status": "active", + "avatar": "/icon/logo.svg", + "name": "FastGPT test", + "vectorModel": "text-embedding-ada-002", + "agentModel": "gpt-3.5-turbo-16k", + "intro": "", + "permission": "private", + "updateTime": "2024-01-02T10:11:03.084Z" + }, + "type": "virtual", + "name": "测试训练", + "trainingType": "qa", + "chunkSize": 8000, + "chunkSplitter": "", + "qaPrompt": "11", + "rawTextLength": 40466, + "hashRawText": "47270840614c0cc122b29daaddc09c2a48f0ec6e77093611ab12b69cba7fee12", + "createTime": "2024-01-20T13:50:35.838Z", + "updateTime": "2024-01-20T13:50:35.838Z", + "canWrite": true, + "sourceName": "测试训练" + } } ``` -
@@ -896,7 +799,6 @@ curl --location --request GET 'http://localhost:3000/api/core/dataset/collection - **通过集合 ID 修改集合信息** ```bash @@ -930,38 +832,32 @@ curl --location --request PUT 'http://localhost:3000/api/core/dataset/collection }' ``` - - - +
- id: 集合的ID - parentId: 修改父级ID(可选) - name: 修改集合名称(可选) - tags: 修改集合标签(可选) - forbid: 修改集合禁用状态(可选) - createTime: 修改集合创建时间(可选) - - +
- - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` -
@@ -970,39 +866,32 @@ curl --location --request PUT 'http://localhost:3000/api/core/dataset/collection - ```bash curl --location --request DELETE 'http://localhost:3000/api/core/dataset/collection/delete?id=65aa2a64e6cb9b8ccdc00de8' \ --header 'Authorization: Bearer {{authorization}}' \ ``` - - - +
- id: 集合的ID - - +
- - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` -
@@ -1012,28 +901,28 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/collect **Data结构** -| 字段 | 类型 | 说明 | 必填 | -| --- | --- | --- | --- | -| teamId | String | 团队ID | ✅ | -| tmbId | String | 成员ID | ✅ | -| datasetId | String | 知识库ID | ✅ | -| collectionId | String | 集合ID | ✅ | -| q | String | 主要数据 | ✅ | -| a | String | 辅助数据 | ✖ | -| fullTextToken | String | 分词 | ✖ | -| indexes | Index[] | 向量索引 | ✅ | -| updateTime | Date | 更新时间 | ✅ | -| chunkIndex | Number | 分块下表 | ✖ | +| 字段 | 类型 | 说明 | 必填 | +| ------------- | ------- | -------- | ---- | +| teamId | String | 团队ID | ✅ | +| tmbId | String | 成员ID | ✅ | +| datasetId | String | 知识库ID | ✅ | +| collectionId | String | 集合ID | ✅ | +| q | String | 主要数据 | ✅ | +| a | String | 辅助数据 | ✖ | +| fullTextToken | String | 分词 | ✖ | +| indexes | Index[] | 向量索引 | ✅ | +| updateTime | Date | 更新时间 | ✅ | +| chunkIndex | Number | 分块下表 | ✖ | **Index结构** 每组数据的自定义索引最多5个 -| 字段 | 类型 | 说明 | 必填 | -| --- | --- | --- | --- | -| type | String | 可选索引类型:default-默认索引; custom-自定义索引; summary-总结索引; question-问题索引; image-图片索引 | | -| dataId | String | 关联的向量ID,变更数据时候传入该 ID,会进行差量更新,而不是全量更新 | | -| text | String | 文本内容 | ✅ | +| 字段 | 类型 | 说明 | 必填 | +| ------ | ------ | ------------------------------------------------------------------------------------------------------ | ---- | +| type | String | 可选索引类型:default-默认索引; custom-自定义索引; summary-总结索引; question-问题索引; image-图片索引 | | +| dataId | String | 关联的向量ID,变更数据时候传入该 ID,会进行差量更新,而不是全量更新 | | +| text | String | 文本内容 | ✅ | `type` 不填则默认为 `custom` 索引,还会基于 q/a 组成一个默认索引。如果传入了默认索引,则不会额外创建。 @@ -1044,7 +933,6 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/collect - ```bash curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/data/pushData' \ --header 'Authorization: Bearer apikey' \ @@ -1075,47 +963,42 @@ curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/data/pus }' ``` - - - +
- collectionId: 集合ID(必填) - trainingType:训练模式(必填) - prompt: 自定义 QA 拆分提示词,需严格按照模板,建议不要传入。(选填) - data:(具体数据) + - q: 主要数据(必填) - a: 辅助数据(选填) - indexes: 自定义索引(选填)。可以不传或者传空数组,默认都会使用q和a组成一个索引。 - - +
- ```json { - "code": 200, - "statusText": "", - "data": { - "insertLen": 1, // 最终插入成功的数量 - "overToken": [], // 超出 token 的 - "repeat": [], // 重复的数量 - "error": [] // 其他错误 - } + "code": 200, + "statusText": "", + "data": { + "insertLen": 1, // 最终插入成功的数量 + "overToken": [], // 超出 token 的 + "repeat": [], // 重复的数量 + "error": [] // 其他错误 + } } ``` - - [theme] 里的内容可以换成数据的主题。默认为:它们可能包含多个主题内容 ``` @@ -1134,20 +1017,15 @@ A2: 我的文本:"""{{text}}""" ``` -
- ### 获取集合的数据列表 - -**4.8.11+** - ```bash curl --location --request POST 'http://localhost:3000/api/core/dataset/data/v2/list' \ --header 'Authorization: Bearer {{authorization}}' \ @@ -1160,68 +1038,47 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/data/v2/l }' ``` -**4.6.7-(即将弃用)** - -```bash -curl --location --request POST 'http://localhost:3000/api/core/dataset/data/list' \ ---header 'Authorization: Bearer {{authorization}}' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "pageNum":1, - "pageSize": 10, - "collectionId":"65abd4ac9d1448617cba6171", - "searchText":"" -}' -``` - - - - - +
- offset: 偏移量(选填) - pageSize: 每页数量,最大30(选填) - collectionId: 集合的ID(必填) - searchText: 模糊搜索词(选填) - - - +
- - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "list": [ - { - "_id": "65abd4b29d1448617cba61db", - "datasetId": "65abc9bd9d1448617cba5e6c", - "collectionId": "65abd4ac9d1448617cba6171", - "q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。", - "a": "", - "chunkIndex": 0 - }, - { - "_id": "65abd4b39d1448617cba624d", - "datasetId": "65abc9bd9d1448617cba5e6c", - "collectionId": "65abd4ac9d1448617cba6171", - "q": "本白皮书重点从 AIGC 技术、应用和治理等维度进行了阐述。在技术层面,梳理提出了 AIGC 技术体系,既涵盖了对现实世界各种内容的数字化呈现和增强,也包括了基于人工智能的自主内容创作。在应用层面,重点分析了 AIGC 在传媒、电商、影视等行业和场景的应用情况,探讨了以虚拟数字人、写作机器人等为代表的新业态和新应用。在治理层面,从政策监管、技术能力、企业应用等视角,分析了AIGC 所暴露出的版权纠纷、虚假信息传播等各种问题。最后,从政府、行业、企业、社会等层面,给出了 AIGC 发展和治理建议。由于人工智能仍处于飞速发展阶段,我们对 AIGC 的认识还有待进一步深化,白皮书中存在不足之处,敬请大家批评指正。目 录一、 人工智能生成内容的发展历程与概念.............................................................. 1(一)AIGC 历史沿革 .......................................................................................... 1(二)AIGC 的概念与内涵 .................................................................................. 4二、人工智能生成内容的技术体系及其演进方向.................................................... 7(一)AIGC 技术升级步入深化阶段 .................................................................. 7(二)AIGC 大模型架构潜力凸显 .................................................................... 10(三)AIGC 技术演化出三大前沿能力 ............................................................ 18三、人工智能生成内容的应用场景.......................................................................... 26(一)AIGC+传媒:人机协同生产,", - "a": "", - "chunkIndex": 1 - } - ], - "total": 63 - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "list": [ + { + "_id": "65abd4b29d1448617cba61db", + "datasetId": "65abc9bd9d1448617cba5e6c", + "collectionId": "65abd4ac9d1448617cba6171", + "q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。", + "a": "", + "chunkIndex": 0 + }, + { + "_id": "65abd4b39d1448617cba624d", + "datasetId": "65abc9bd9d1448617cba5e6c", + "collectionId": "65abd4ac9d1448617cba6171", + "q": "本白皮书重点从 AIGC 技术、应用和治理等维度进行了阐述。在技术层面,梳理提出了 AIGC 技术体系,既涵盖了对现实世界各种内容的数字化呈现和增强,也包括了基于人工智能的自主内容创作。在应用层面,重点分析了 AIGC 在传媒、电商、影视等行业和场景的应用情况,探讨了以虚拟数字人、写作机器人等为代表的新业态和新应用。在治理层面,从政策监管、技术能力、企业应用等视角,分析了AIGC 所暴露出的版权纠纷、虚假信息传播等各种问题。最后,从政府、行业、企业、社会等层面,给出了 AIGC 发展和治理建议。由于人工智能仍处于飞速发展阶段,我们对 AIGC 的认识还有待进一步深化,白皮书中存在不足之处,敬请大家批评指正。目 录一、 人工智能生成内容的发展历程与概念.............................................................. 1(一)AIGC 历史沿革 .......................................................................................... 1(二)AIGC 的概念与内涵 .................................................................................. 4二、人工智能生成内容的技术体系及其演进方向.................................................... 7(一)AIGC 技术升级步入深化阶段 .................................................................. 7(二)AIGC 大模型架构潜力凸显 .................................................................... 10(三)AIGC 技术演化出三大前沿能力 ............................................................ 18三、人工智能生成内容的应用场景.......................................................................... 26(一)AIGC+传媒:人机协同生产,", + "a": "", + "chunkIndex": 1 + } + ], + "total": 63 + } } ``` @@ -1233,58 +1090,51 @@ curl --location --request POST 'http://localhost:3000/api/core/dataset/data/list - ```bash curl --location --request GET 'http://localhost:3000/api/core/dataset/data/detail?id=65abd4b29d1448617cba61db' \ --header 'Authorization: Bearer {{authorization}}' \ ``` - - - +
- id: 数据的id - - +
- - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": { - "id": "65abd4b29d1448617cba61db", - "q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。", - "a": "", - "chunkIndex": 0, - "indexes": [ - { - "type": "default", - "dataId": "3720083", - "text": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。", - "_id": "65abd4b29d1448617cba61dc" - } - ], - "datasetId": "65abc9bd9d1448617cba5e6c", - "collectionId": "65abd4ac9d1448617cba6171", - "sourceName": "中文-AIGC白皮书2022.pdf", - "sourceId": "65abd4ac9d1448617cba6166", - "isOwner": true, - "canWrite": true - } + "code": 200, + "statusText": "", + "message": "", + "data": { + "id": "65abd4b29d1448617cba61db", + "q": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。", + "a": "", + "chunkIndex": 0, + "indexes": [ + { + "type": "default", + "dataId": "3720083", + "text": "N o . 2 0 2 2 1 2中 国 信 息 通 信 研 究 院京东探索研究院2022年 9月人工智能生成内容(AIGC)白皮书(2022 年)版权声明本白皮书版权属于中国信息通信研究院和京东探索研究院,并受法律保护。转载、摘编或利用其它方式使用本白皮书文字或者观点的,应注明“来源:中国信息通信研究院和京东探索研究院”。违反上述声明者,编者将追究其相关法律责任。前 言习近平总书记曾指出,“数字技术正以新理念、新业态、新模式全面融入人类经济、政治、文化、社会、生态文明建设各领域和全过程”。在当前数字世界和物理世界加速融合的大背景下,人工智能生成内容(Artificial Intelligence Generated Content,简称 AIGC)正在悄然引导着一场深刻的变革,重塑甚至颠覆数字内容的生产方式和消费模式,将极大地丰富人们的数字生活,是未来全面迈向数字文明新时代不可或缺的支撑力量。", + "_id": "65abd4b29d1448617cba61dc" + } + ], + "datasetId": "65abc9bd9d1448617cba5e6c", + "collectionId": "65abd4ac9d1448617cba6171", + "sourceName": "中文-AIGC白皮书2022.pdf", + "sourceId": "65abd4ac9d1448617cba6166", + "isOwner": true, + "canWrite": true + } } ``` -
@@ -1293,7 +1143,6 @@ curl --location --request GET 'http://localhost:3000/api/core/dataset/data/detai - ```bash curl --location --request PUT 'http://localhost:3000/api/core/dataset/data/update' \ --header 'Authorization: Bearer {{authorization}}' \ @@ -1321,36 +1170,30 @@ curl --location --request PUT 'http://localhost:3000/api/core/dataset/data/updat }' ``` - - - +
- dataId: 数据的id - q: 主要数据(选填) - a: 辅助数据(选填) - indexes: 自定义索引(选填),类型参考`为集合批量添加添加数据`。如果创建时候有自定义索引, - - +
- - ```json { - "code": 200, - "statusText": "", - "message": "", - "data": null + "code": 200, + "statusText": "", + "message": "", + "data": null } ``` -
@@ -1359,29 +1202,23 @@ curl --location --request PUT 'http://localhost:3000/api/core/dataset/data/updat - ```bash curl --location --request DELETE 'http://localhost:3000/api/core/dataset/data/delete?id=65abd4b39d1448617cba624d' \ --header 'Authorization: Bearer {{authorization}}' \ ``` - - - +
- id: 数据的id - - +
- - ```json { "code": 200, @@ -1391,7 +1228,6 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/data/de } ``` -
@@ -1400,7 +1236,6 @@ curl --location --request DELETE 'http://localhost:3000/api/core/dataset/data/de - ```bash curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/searchTest' \ --header 'Authorization: Bearer fastgpt-xxxxx' \ @@ -1419,13 +1254,11 @@ curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/searchTe }' ``` - - - +
- datasetId - 知识库ID - text - 需要测试的文本 - limit - 最大 tokens 数量 @@ -1435,14 +1268,12 @@ curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/searchTe - datasetSearchUsingExtensionQuery - 使用问题优化 - datasetSearchExtensionModel - 问题优化模型 - datasetSearchExtensionBg - 问题优化背景描述 - - +
- 返回 top k 结果, limit 为最大 Tokens 数量,最多 20000 tokens。 ```json @@ -1465,7 +1296,5 @@ curl --location --request POST 'https://api.fastgpt.in/api/core/dataset/searchTe } ``` -
- diff --git a/document/content/docs/introduction/development/openapi/share.mdx b/document/content/docs/introduction/development/openapi/share.mdx index cb764b51856c..f492b1e3e799 100644 --- a/document/content/docs/introduction/development/openapi/share.mdx +++ b/document/content/docs/introduction/development/openapi/share.mdx @@ -3,8 +3,6 @@ title: 分享链接身份鉴权 description: FastGPT 分享链接身份鉴权 --- -import { Alert } from '@/components/docs/Alert'; - ## 介绍 在 FastGPT V4.6.4 中,我们修改了分享链接的数据读取方式,为每个用户生成一个 localId,用于标识用户,从云端拉取对话记录。但是这种方式仅能保障用户在同一设备同一浏览器中使用,如果切换设备或者清空浏览器缓存则会丢失这些记录。这种方式存在一定的风险,因此我们仅允许用户拉取近`30天`的`20条`记录。 @@ -44,15 +42,15 @@ import { Alert } from '@/components/docs/Alert'; 配置校验地址后,在每次分享链接使用时,都会向对应的地址发起校验和上报请求。 -这里仅需配置根地址,无需具体到完整请求路径。 +这里仅需配置根地址,无需具体到完整请求路径。 ### 2. 分享链接中增加额外 query 在分享链接的地址中,增加一个额外的参数: authToken。例如: -原始的链接:`https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192` +原始的链接:`https://share.fastgpt.io/chat/share?shareId=648aaf5ae121349a16d62192` -完整链接: `https://share.tryfastgpt.ai/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345` +完整链接: `https://share.fastgpt.io/chat/share?shareId=648aaf5ae121349a16d62192&authToken=userid12345` 这个`authToken`通常是你系统生成的用户唯一凭证(Token之类的)。FastGPT 会在鉴权接口的`body`中携带 token=[authToken] 的参数。 @@ -358,9 +356,9 @@ export default async function (ctx: FunctionContext) { ### 3. 修改分享链接参数 -源分享链接:`https://share.tryfastgpt.ai/chat/share?shareId=64be36376a438af0311e599c` +源分享链接:`https://share.fastgpt.io/chat/share?shareId=64be36376a438af0311e599c` -修改后:`https://share.tryfastgpt.ai/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt` +修改后:`https://share.fastgpt.io/chat/share?shareId=64be36376a438af0311e599c&authToken=fastgpt` ### 4. 测试效果 diff --git a/document/content/docs/introduction/development/sealos.mdx b/document/content/docs/introduction/development/sealos.mdx index 0c265bd31ce9..6759f5086f32 100644 --- a/document/content/docs/introduction/development/sealos.mdx +++ b/document/content/docs/introduction/development/sealos.mdx @@ -13,7 +13,7 @@ import { Alert } from '@/components/docs/Alert'; FastGPT 使用了 one-api 项目来管理模型池,其可以兼容 OpenAI 、Azure 、国内主流模型和本地模型等。 -可参考:[Sealos 快速部署 OneAPI](/docs/development/modelconfig/one-api) +可参考:[Sealos 快速部署 OneAPI](/docs/introduction/development/modelconfig/one-api) ## 一键部署 @@ -79,7 +79,7 @@ FastGPT 使用了 one-api 项目来管理模型池,其可以兼容 OpenAI 、A 务必先配置至少一组模型,否则系统无法正常使用。 -[点击查看模型配置教程](/docs/development/modelConfig/intro/) +[点击查看模型配置教程](/docs/introduction/development/modelConfig/intro/) ## 收费 @@ -110,13 +110,13 @@ FastGPT 商业版共包含了2个应用(fastgpt, fastgpt-plus)和2个数据 ### 如何更新/升级 FastGPT -[升级脚本文档](https://doc.tryfastgpt.ai/docs/development/upgrading/)先看下文档,看下需要升级哪个版本。注意,不要跨版本升级!!!!! +[升级脚本文档](https://doc.fastgpt.io/docs/introduction/development/upgrading/)先看下文档,看下需要升级哪个版本。注意,不要跨版本升级!!!!! 例如,目前是4.5 版本,要升级到4.5.1,就先把镜像版本改成v4.5.1,执行一下升级脚本,等待完成后再继续升级。如果目标版本不需要执行初始化,则可以跳过。 升级步骤: -1. 查看[更新文档](/docs/development/upgrading/index/),确认要升级的版本,避免跨版本升级。 +1. 查看[更新文档](/docs/introduction/development/upgrading/index/),确认要升级的版本,避免跨版本升级。 2. 打开 sealos 的应用管理 3. 有2个应用 fastgpt , fastgpt-pro 4. 点击对应应用右边3个点,变更。或者点详情后右上角的变更。 @@ -145,7 +145,7 @@ FastGPT 商业版共包含了2个应用(fastgpt, fastgpt-plus)和2个数据 ![](/imgs/onsealos5.png) -[配置文件参考](https://doc.tryfastgpt.ai/docs/development/configuration/) +[配置文件参考](https://doc.fastgpt.io/docs/introduction/development/configuration/) ### 修改站点名称以及 favicon @@ -184,4 +184,4 @@ SYSTEM_FAVICON 可以是一个网络地址 ### One API 使用 -[参考 OneAPI 使用步骤](/docs/development/modelconfig/one-api/) +[参考 OneAPI 使用步骤](/docs/introduction/development/modelconfig/one-api/) diff --git a/document/content/docs/introduction/guide/dashboard/workflow/ai_chat.mdx b/document/content/docs/introduction/guide/dashboard/workflow/ai_chat.mdx index 5d45007d8db5..2c1fa7f1e7df 100644 --- a/document/content/docs/introduction/guide/dashboard/workflow/ai_chat.mdx +++ b/document/content/docs/introduction/guide/dashboard/workflow/ai_chat.mdx @@ -17,7 +17,7 @@ import { Alert } from '@/components/docs/Alert'; ## AI模型 -可以通过 [config.json](/docs/development/configuration/) 配置可选的对话模型,通过 [one-api](/docs/development/modelconfig/one-api/) 来实现多模型接入。 +可以通过 [config.json](/docs/introduction/development/configuration/) 配置可选的对话模型,通过 [one-api](/docs/introduction/development/modelConfig/one-api) 来实现多模型接入。 点击AI模型后,可以配置模型的相关参数。 @@ -25,8 +25,6 @@ import { Alert } from '@/components/docs/Alert'; ![](/imgs/aichat2.png) - - -具体配置参数介绍可以参考: [AI参数配置说明](/docs/introduction/guide/course/ai_settings/) + 具体配置参数介绍可以参考: [AI参数配置说明](/docs/introduction/guide/course/ai_settings/) diff --git a/document/content/docs/introduction/guide/knowledge_base/websync.mdx b/document/content/docs/introduction/guide/knowledge_base/websync.mdx index 45c4153066ee..d161baf6df8a 100644 --- a/document/content/docs/introduction/guide/knowledge_base/websync.mdx +++ b/document/content/docs/introduction/guide/knowledge_base/websync.mdx @@ -14,7 +14,7 @@ Web 站点同步利用爬虫的技术,可以通过一个入口网站,自动 Tips: 国内的媒体站点基本不可用,公众号、csdn、知乎等。可以通过终端发送`curl`请求检测是否为静态站点,例如: ```bash -curl https://doc.tryfastgpt.ai/docs/intro/ +curl https://doc.fastgpt.io/docs/intro/ ``` ## 如何使用 @@ -37,7 +37,6 @@ curl https://doc.tryfastgpt.ai/docs/intro/ 好了, 现在点击开始同步,静等系统自动抓取网站信息即可。 - ## 创建应用,绑定知识库 ![](/imgs/webSync6.jpg) diff --git a/document/content/docs/protocol/open-source.en.mdx b/document/content/docs/protocol/open-source.en.mdx index 03af16b6b440..62b0fa9bc923 100644 --- a/document/content/docs/protocol/open-source.en.mdx +++ b/document/content/docs/protocol/open-source.en.mdx @@ -7,7 +7,7 @@ The FastGPT project is open-sourced under the Apache License 2.0, but includes t - FastGPT may be used for commercial purposes, such as operating it as "backend-as-a-service" for other applications or providing it as an enterprise development platform. However, you must contact us to obtain a commercial license under the following circumstances: - - Multi-tenant SaaS Service: Unless explicit written authorization from FastGPT is obtained, you may not use the source code of tryfastgpt.ai to operate a multi-tenant SaaS service similar to tryfastgpt.ai. + - Multi-tenant SaaS Service: Unless explicit written authorization from FastGPT is obtained, you may not use the source code of fastgpt.io to operate a multi-tenant SaaS service similar to fastgpt.io. - Logo and Copyright Information: You may not remove or modify the FastGPT logo or copyright information within the FastGPT console. For commercial licensing inquiries, please contact us via email at dennis@sealos.io. diff --git a/document/content/docs/protocol/open-source.mdx b/document/content/docs/protocol/open-source.mdx index 611582a7fabf..4cf8a3c80e4b 100644 --- a/document/content/docs/protocol/open-source.mdx +++ b/document/content/docs/protocol/open-source.mdx @@ -7,7 +7,7 @@ FastGPT 项目在 Apache License 2.0 许可下开源,但包含以下附加条 - FastGPT 允许被用于商业化,例如作为其他应用的“后端即服务”使用,或者作为应用开发平台提供给企业。然而,当满足以下条件时,必须联系作者获得商业许可: - - 多租户 SaaS 服务:除非获得 FastGPT 的明确书面授权,否则不得使用 tryfastgpt.ai 的源码来运营与 tryfastgpt.ai 服务类似的多租户 SaaS 服务。 + - 多租户 SaaS 服务:除非获得 FastGPT 的明确书面授权,否则不得使用 fastgpt.io 的源码来运营与 fastgpt.io 服务类似的多租户 SaaS 服务。 - LOGO 及版权信息:在使用 FastGPT 的过程中,不得移除或修改 FastGPT 控制台内的 LOGO 或版权信息。 请通过电子邮件 dennis@sealos.io 联系我们咨询许可事宜。 diff --git a/document/content/docs/upgrading/4-11/4110.mdx b/document/content/docs/upgrading/4-11/4110.mdx index 4aa73a7be9f2..f4222f5d72d1 100644 --- a/document/content/docs/upgrading/4-11/4110.mdx +++ b/document/content/docs/upgrading/4-11/4110.mdx @@ -27,7 +27,7 @@ EVAL_LINE_LIMIT=1000 # 评估文件最大行数 1. 移除所有**开源功能**的限制,包括:应用数量和知识库数量上限。 2. 调整 RoadMap,增加`上下文管理`,`AI 生成工作流`,`高级编排 DeBug 调试模式`等计划。 -3. 海外版域名将`tryfastgpt.ai`调整成`fastgpt.io`。 +3. 海外版域名将`fastgpt.io`调整成`fastgpt.io`。 ## 🚀 新增内容 diff --git a/document/content/docs/upgrading/4-8/45.mdx b/document/content/docs/upgrading/4-8/45.mdx index 080242b29d24..de79892edb12 100644 --- a/document/content/docs/upgrading/4-8/45.mdx +++ b/document/content/docs/upgrading/4-8/45.mdx @@ -22,7 +22,7 @@ ALTER EXTENSION vector UPDATE; \dx -- 下面两个语句会设置 pg 在构建索引时可用的内存大小,需根据自身的数据库规格来动态配置,可配置为 1/4 的内存大小 -alter system set maintenance_work_mem = '2400MB'; +alter system set maintenance_work_mem = '2400MB'; select pg_reload_conf(); -- 重构数据库索引和排序 @@ -34,13 +34,11 @@ CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip \d modeldata ``` -| | | -| --------------------- | --------------------- | +| | | +| -------------------- | -------------------- | | ![](/imgs/v45-1.jpg) | ![](/imgs/v45-2.jpg) | | ![](/imgs/v45-3.jpg) | ![](/imgs/v45-4.jpg) | - - ## PgVector升级:Docker-compose.yml 部署方案 下面的命令是基于给的 docker-compose 模板,如果数据库账号密码更换了,请自行调整。 @@ -58,7 +56,7 @@ ALTER EXTENSION vector UPDATE; \dx -- 下面两个语句会设置 pg 在构建索引时可用的内存大小,需根据自身的数据库规格来动态配置,可配置为 1/4 的内存大小 -alter system set maintenance_work_mem = '2400MB'; +alter system set maintenance_work_mem = '2400MB'; select pg_reload_conf(); -- 重构数据库索引和排序 @@ -86,4 +84,4 @@ CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip ## 该版本需要修改 `config.json` 文件 -最新配置可参考: [V45版本最新 config.json](/docs/development/configuration) +最新配置可参考: [V45版本最新 config.json](/docs/introduction/development/configuration) diff --git a/document/content/docs/upgrading/4-8/46.mdx b/document/content/docs/upgrading/4-8/46.mdx index d758a7454481..d597490af5ba 100644 --- a/document/content/docs/upgrading/4-8/46.mdx +++ b/document/content/docs/upgrading/4-8/46.mdx @@ -9,8 +9,7 @@ description: FastGPT V4.6 更新 更新镜像至 latest 或者 v4.6 版本。商业版镜像更新至 V0.2.1 -最新配置可参考:[V46 版本最新 config.json](/docs/development/configuration),商业镜像配置文件也更新,参考最新的飞书文档。 - +最新配置可参考:[V46 版本最新 config.json](/docs/introduction/development/configuration),商业镜像配置文件也更新,参考最新的飞书文档。 ## 2。执行初始化 API @@ -40,7 +39,6 @@ curl --location --request POST 'https://{{host}}/api/admin/initv46-2' \ 3。初始化 Pg 的字段 4。初始化 Mongo Data - ## V4.6 功能介绍 1. 新增 - 团队空间 diff --git a/document/content/docs/upgrading/4-8/465.mdx b/document/content/docs/upgrading/4-8/465.mdx index c41e108c656d..643793d54a58 100644 --- a/document/content/docs/upgrading/4-8/465.mdx +++ b/document/content/docs/upgrading/4-8/465.mdx @@ -7,7 +7,7 @@ description: FastGPT V4.6.5 由于 openai 已开始弃用 function call,改为 toolChoice。FastGPT 同步的修改了对于的配置和调用方式,需要对配置文件做一些修改: -[点击查看最新的配置文件](/docs/development/configuration/) +[点击查看最新的配置文件](/docs/introduction/development/configuration/) 1. 主要是修改模型的`functionCall`字段,改成`toolChoice`即可。设置为`true`的模型,会默认走 openai 的 tools 模式;未设置或设置为`false`的,会走提示词生成模式。 @@ -26,4 +26,3 @@ description: FastGPT V4.6.5 7. 优化 - 高级编排连接线交互 8. 优化 - 由于 html2md 导致的 cpu密集计算,阻断线程问题 9. 修复 - 高级编排提示词提取描述 - diff --git a/document/content/docs/upgrading/4-8/466.mdx b/document/content/docs/upgrading/4-8/466.mdx index 9941eabc39c0..f72836480b85 100644 --- a/document/content/docs/upgrading/4-8/466.mdx +++ b/document/content/docs/upgrading/4-8/466.mdx @@ -5,15 +5,15 @@ description: FastGPT V4.6.6 ## 配置文件变更 -为了减少代码重复度,我们对配置文件做了一些修改:[点击查看最新的配置文件](/docs/development/configuration/) +为了减少代码重复度,我们对配置文件做了一些修改:[点击查看最新的配置文件](/docs/introduction/development/configuration/) ## 商业版变更 1. 更新商业版镜像到 4.6.6 版本。 2. 将旧版配置文件中的 `SystemParams.pluginBaseUrl` 放置到环境变量中: - PRO_URL=商业版镜像地址(此处不再需要以 /api 结尾),例如: - PRO_URL=http://fastgpt-plugin.ns-hsss5d.svc.cluster.local:3000 + PRO_URL=商业版镜像地址(此处不再需要以 /api 结尾),例如: + PRO_URL=http://fastgpt-plugin.ns-hsss5d.svc.cluster.local:3000 3. 原本在配置文件中的 `FeConfig` 已被移除,可以直接打开新的商业版镜像外网地址进行配置。包括 FastGPT 的各个参数和模型都可以直接在商业版镜像中配置,无需再变更 `config.json` 文件。 @@ -21,7 +21,7 @@ description: FastGPT V4.6.6 1. 查看 [FastGPT 2024 RoadMap](https://github.com/labring/FastGPT?tab=readme-ov-file#-%E5%9C%A8%E7%BA%BF%E4%BD%BF%E7%94%A8) 2. 新增 - Http 模块请求头支持 Json 编辑器。 -3. 新增 - [ReRank模型部署](/docs/development/custom-models/bge-rerank/) +3. 新增 - [ReRank模型部署](/docs/introduction/development/custom-models/bge-rerank/) 4. 新增 - 搜索方式:分离向量语义检索,全文检索和重排,通过 RRF 进行排序合并。 5. 优化 - 问题分类提示词,id引导。测试国产商用 api 模型(百度阿里智谱讯飞)使用 Prompt 模式均可分类。 6. UI 优化,未来将逐步替换新的UI设计。 diff --git a/document/content/docs/upgrading/4-8/468.mdx b/document/content/docs/upgrading/4-8/468.mdx index e90d6943436b..b0e6e8e90df5 100644 --- a/document/content/docs/upgrading/4-8/468.mdx +++ b/document/content/docs/upgrading/4-8/468.mdx @@ -9,54 +9,54 @@ description: FastGPT V4.6.8更新说明 ```yml mongo: - image: mongo:5.0.18 - # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云 - container_name: mongo - ports: - - 27017:27017 - networks: - - fastgpt - command: mongod --keyFile /data/mongodb.key --replSet rs0 - environment: - # 这里密码注意要和以前的一致 - - MONGO_INITDB_ROOT_USERNAME=username - - MONGO_INITDB_ROOT_PASSWORD=password - volumes: - - ./mongo/data:/data/db - entrypoint: - - bash - - -c - - | - openssl rand -base64 128 > /data/mongodb.key - chmod 400 /data/mongodb.key - chown 999:999 /data/mongodb.key - echo 'const isInited = rs.status().ok === 1 - if(!isInited){ - rs.initiate({ - _id: "rs0", - members: [ - { _id: 0, host: "mongo:27017" } - ] - }) - }' > /data/initReplicaSet.js - # 启动MongoDB服务 - exec docker-entrypoint.sh "$@" & - - # 等待MongoDB服务启动 - until mongo -u myusername -p mypassword --authenticationDatabase admin --eval "print('waited for connection')" > /dev/null 2>&1; do - echo "Waiting for MongoDB to start..." - sleep 2 - done - - # 执行初始化副本集的脚本 - mongo -u myusername -p mypassword --authenticationDatabase admin /data/initReplicaSet.js - - # 等待docker-entrypoint.sh脚本执行的MongoDB服务进程 - wait $! + image: mongo:5.0.18 + # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云 + container_name: mongo + ports: + - 27017:27017 + networks: + - fastgpt + command: mongod --keyFile /data/mongodb.key --replSet rs0 + environment: + # 这里密码注意要和以前的一致 + - MONGO_INITDB_ROOT_USERNAME=username + - MONGO_INITDB_ROOT_PASSWORD=password + volumes: + - ./mongo/data:/data/db + entrypoint: + - bash + - -c + - | + openssl rand -base64 128 > /data/mongodb.key + chmod 400 /data/mongodb.key + chown 999:999 /data/mongodb.key + echo 'const isInited = rs.status().ok === 1 + if(!isInited){ + rs.initiate({ + _id: "rs0", + members: [ + { _id: 0, host: "mongo:27017" } + ] + }) + }' > /data/initReplicaSet.js + # 启动MongoDB服务 + exec docker-entrypoint.sh "$@" & + + # 等待MongoDB服务启动 + until mongo -u myusername -p mypassword --authenticationDatabase admin --eval "print('waited for connection')" > /dev/null 2>&1; do + echo "Waiting for MongoDB to start..." + sleep 2 + done + + # 执行初始化副本集的脚本 + mongo -u myusername -p mypassword --authenticationDatabase admin /data/initReplicaSet.js + + # 等待docker-entrypoint.sh脚本执行的MongoDB服务进程 + wait $! ``` 2. 重启 MongoDB - + ```bash # 重启 Mongo docker-compose down @@ -67,7 +67,7 @@ docker-compose up -d ## 修改配置文件 -去除了重复的模型配置,LLM模型都合并到一个属性中:[点击查看最新的配置文件](/docs/development/configuration/) +去除了重复的模型配置,LLM模型都合并到一个属性中:[点击查看最新的配置文件](/docs/introduction/development/configuration/) ## 商业版初始化 diff --git a/document/content/docs/upgrading/4-8/47.mdx b/document/content/docs/upgrading/4-8/47.mdx index 5cb4f65cd50e..ad8571ce9dee 100644 --- a/document/content/docs/upgrading/4-8/47.mdx +++ b/document/content/docs/upgrading/4-8/47.mdx @@ -5,7 +5,7 @@ description: FastGPT V4.7更新说明 ## 1. 修改配置文件 -增加一些 Boolean 值,用于决定不同功能块可以使用哪些模型,同时增加了模型的 logo:[点击查看最新的配置文件](/docs/development/configuration/) +增加一些 Boolean 值,用于决定不同功能块可以使用哪些模型,同时增加了模型的 logo:[点击查看最新的配置文件](/docs/introduction/development/configuration/) ## 2. 初始化脚本 diff --git a/document/content/docs/upgrading/4-8/471.mdx b/document/content/docs/upgrading/4-8/471.mdx index 70b7b8344bce..95e9ef4c3702 100644 --- a/document/content/docs/upgrading/4-8/471.mdx +++ b/document/content/docs/upgrading/4-8/471.mdx @@ -15,11 +15,9 @@ curl --location --request POST 'https://{{host}}/api/admin/clearInvalidData' \ 该请求会执行脏数据清理(清理无效的文件、清理无效的图片、清理无效的知识库集合、清理无效的向量) - ## 修改配置文件 -增加了Laf环境配置:[点击查看最新的配置文件](/docs/development/configuration/) - +增加了Laf环境配置:[点击查看最新的配置文件](/docs/introduction/development/configuration/) ## V4.7.1 更新说明 diff --git a/document/content/docs/upgrading/4-8/4815.mdx b/document/content/docs/upgrading/4-8/4815.mdx index d0f17e017b1d..49ee5bfe8f26 100644 --- a/document/content/docs/upgrading/4-8/4815.mdx +++ b/document/content/docs/upgrading/4-8/4815.mdx @@ -7,14 +7,14 @@ description: FastGPT V4.8.15 更新说明 ### API 知识库 -| | | -| --- | --- | +| | | +| ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-20.png) | ![alt text](/imgs/image-21.png) | ### HTML 渲染 -| 源码模式 | 预览模式 | 全屏模式 | -| --- | --- | --- | +| 源码模式 | 预览模式 | 全屏模式 | +| ------------------------------- | ------------------------------- | ------------------------------- | | ![alt text](/imgs/image-22.png) | ![alt text](/imgs/image-23.png) | ![alt text](/imgs/image-24.png) | ## 升级指南 @@ -23,7 +23,6 @@ description: FastGPT V4.8.15 更新说明 - 更新 fastgpt-pro 商业版镜像 tag: v4.8.15 - Sandbox 镜像,可以不更新 - ## 运行升级脚本 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: @@ -36,7 +35,7 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4815' \ 会重置应用定时执行的字段,把 null 去掉,减少索引大小。 ----- +--- 从任意终端,发起 1 个 HTTP 请求。其中 `{{rootkey}}` 替换成环境变量里的 `rootkey`;`{{host}}` 替换成**FastGPT 域名**: @@ -48,13 +47,12 @@ curl --location --request POST 'https://{{host}}/api/admin/init/refreshFreeUser' 重新计算一次免费版用户的时长,之前有版本升级时没有重新计算时间,导致会误发通知。 - ## 完整更新内容 1. 新增 - API 知识库, 见 [API 知识库介绍](/docs/introduction/guide/knowledge_base/api_dataset/),外部文件库会被弃用。 2. 新增 - 工具箱页面,展示所有可用的系统资源。商业版后台可更便捷的配置系统插件和自定义分类。 3. 新增 - Markdown 中,HTML代码会被额外渲染,可以选择预览模式,会限制所有 script 脚本,仅做展示。 -4. 新增 - 自定义系统级文件解析服务, 见 [接入 Marker PDF 文档解析](/docs/development/custom-models/marker/) +4. 新增 - 自定义系统级文件解析服务, 见 [接入 Marker PDF 文档解析](/docs/introduction/development/custom-models/marker/) 5. 新增 - 集合直接重新调整参数,无需删除再导入。 6. 新增 - 商业版后台支持配置侧边栏跳转链接。 7. 优化 - base64 图片截取判断。 diff --git a/document/content/docs/upgrading/4-8/4816.mdx b/document/content/docs/upgrading/4-8/4816.mdx index 78c44b7b1219..93d401f61bd8 100644 --- a/document/content/docs/upgrading/4-8/4816.mdx +++ b/document/content/docs/upgrading/4-8/4816.mdx @@ -13,37 +13,35 @@ description: FastGPT V4.8.16 更新说明 ### 2. 更新配置文件 -参考最新的[配置文件](/docs/development/configuration/),更新 `config.json` 或 admin 中模型文件配置。给 LLMModel 和 VectorModel 增加 `provider` 字段,以便进行模型分类。例如: +参考最新的[配置文件](/docs/introduction/development/configuration/),更新 `config.json` 或 admin 中模型文件配置。给 LLMModel 和 VectorModel 增加 `provider` 字段,以便进行模型分类。例如: ```json { - "provider": "OpenAI", // 这是新增的 - "model": "gpt-4o", - "name": "gpt-4o", - "maxContext": 125000, - "maxResponse": 4000, - "quoteMaxToken": 120000, - "maxTemperature": 1.2, - "charsPointsPrice": 0, - "censor": false, - "vision": true, - "datasetProcess": true, - "usedInClassify": true, - "usedInExtractFields": true, - "usedInToolCall": true, - "usedInQueryExtension": true, - "toolChoice": true, - "functionCall": false, - "customCQPrompt": "", - "customExtractPrompt": "", - "defaultSystemChatPrompt": "", - "defaultConfig": {}, - "fieldMap": {} + "provider": "OpenAI", // 这是新增的 + "model": "gpt-4o", + "name": "gpt-4o", + "maxContext": 125000, + "maxResponse": 4000, + "quoteMaxToken": 120000, + "maxTemperature": 1.2, + "charsPointsPrice": 0, + "censor": false, + "vision": true, + "datasetProcess": true, + "usedInClassify": true, + "usedInExtractFields": true, + "usedInToolCall": true, + "usedInQueryExtension": true, + "toolChoice": true, + "functionCall": false, + "customCQPrompt": "", + "customExtractPrompt": "", + "defaultSystemChatPrompt": "", + "defaultConfig": {}, + "fieldMap": {} } ``` - - ## 完整更新内容 1. 新增 - SearXNG 搜索插件[点击查看教程](/docs/introduction/guide/plugins/searxng_plugin_guide/) diff --git a/document/content/docs/upgrading/4-8/4820.mdx b/document/content/docs/upgrading/4-8/4820.mdx index 814b8c7af637..18950d673230 100644 --- a/document/content/docs/upgrading/4-8/4820.mdx +++ b/document/content/docs/upgrading/4-8/4820.mdx @@ -31,7 +31,7 @@ curl --location --request POST 'https://{{host}}/api/admin/initv4820' \ ## 完整更新内容 -1. 新增 - 可视化模型参数配置,取代原配置文件配置模型。预设超过 100 个模型配置。同时支持所有类型模型的一键测试。(预计下个版本会完全支持在页面上配置渠道)。[点击查看模型配置方案](/docs/development/modelconfig/intro/) +1. 新增 - 可视化模型参数配置,取代原配置文件配置模型。预设超过 100 个模型配置。同时支持所有类型模型的一键测试。(预计下个版本会完全支持在页面上配置渠道)。[点击查看模型配置方案](/docs/introduction/development/modelconfig/intro/) 2. 新增 - DeepSeek resoner 模型支持输出思考过程。 3. 新增 - 使用记录导出和仪表盘。 4. 新增 - markdown 语法扩展,支持音视频(代码块 audio 和 video)。 diff --git a/document/content/docs/upgrading/4-9/490.mdx b/document/content/docs/upgrading/4-9/490.mdx index 3ddca42d91cd..f1c5fdb6a9e4 100644 --- a/document/content/docs/upgrading/4-9/490.mdx +++ b/document/content/docs/upgrading/4-9/490.mdx @@ -160,7 +160,7 @@ curl --location --request POST 'https://{{host}}/api/admin/initv490' \ ## 兼容 & 弃用 -1. 弃用 - 之前私有化部署的自定义文件解析方案,请同步更新到最新的配置方案。[点击查看 PDF 增强解析配置](/docs/development/configuration/#使用-doc2x-解析-pdf-文件) +1. 弃用 - 之前私有化部署的自定义文件解析方案,请同步更新到最新的配置方案。[点击查看 PDF 增强解析配置](/docs/introduction/development/configuration/#使用-doc2x-解析-pdf-文件) 2. 弃用 - 弃用旧版本地文件上传 API:/api/core/dataset/collection/create/file(以前仅商业版可用的 API,该接口已放切换成:/api/core/dataset/collection/create/localFile) 3. 停止维护,即将弃用 - 外部文件库相关 API,可通过 API 文件库替代。 4. API更新 - 上传文件至知识库、创建连接集合、API 文件库、推送分块数据等带有 `trainingType` 字段的接口,`trainingType`字段未来仅支持`chunk`和`QA`两种模式。增强索引模式将设置单独字段:`autoIndexes`,目前仍有适配旧版`trainingType=auto`代码,但请尽快变更成新接口类型。具体可见:[知识库 OpenAPI 文档](/docs/introduction/development/openapi/dataset.md) diff --git a/document/content/docs/use-cases/app-cases/submit_application_template.mdx b/document/content/docs/use-cases/app-cases/submit_application_template.mdx index 3e7b146de3c3..933338453876 100644 --- a/document/content/docs/use-cases/app-cases/submit_application_template.mdx +++ b/document/content/docs/use-cases/app-cases/submit_application_template.mdx @@ -3,7 +3,6 @@ title: 如何提交应用模板 description: 指南:如何向 FastGPT 提交应用模板 --- - ## 什么模板可以合并 目前合并进仓库的应用模板,会在「模板市场」中全部展示给用户。 @@ -18,7 +17,7 @@ description: 指南:如何向 FastGPT 提交应用模板 需要在 dev 环境下执行下面的操作。 -> 可参照 [FastGPT|快速开始本地开发](https://doc.fastgpt.in/docs/development/intro/) +> 可参照 [FastGPT|快速开始本地开发](/docs/introduction/development/intro/) 1. ### 在 FastGPT 工作台中,创建一个应用 @@ -41,13 +40,14 @@ description: 指南:如何向 FastGPT 提交应用模板 "intro": "模板描述,会展示在模板市场的展示页", "author": "填写你的名字", "avatar": "模板头像,可以将图片文件放在同一个文件夹中,然后填写相应路径", - + "tags": ["模板标签"], // writing(文本创作),image-generation(图片生成),web-search(联网搜索), - // roleplay(角色扮演), office-services(办公服务) 暂时分为 5 类,从中选择相应的标签 - - "type": "模板类别", // simple(简易应用), advanced(工作流), plugin(插件) + // roleplay(角色扮演), office-services(办公服务) 暂时分为 5 类,从中选择相应的标签 + + "type": "模板类别", // simple(简易应用), advanced(工作流), plugin(插件) - "workflow": { // 这个对象先不管,待会直接粘贴导出的工作流即可 + "workflow": { + // 这个对象先不管,待会直接粘贴导出的工作流即可 "nodes": [], "edges": [], "chatConfig": {} diff --git a/document/content/docs/use-cases/external-integration/official_account.mdx b/document/content/docs/use-cases/external-integration/official_account.mdx index d34cf2fc1fc0..5bbdd72e8b41 100644 --- a/document/content/docs/use-cases/external-integration/official_account.mdx +++ b/document/content/docs/use-cases/external-integration/official_account.mdx @@ -9,7 +9,7 @@ description: FastGPT 接入微信公众号教程 ## 1. 在 FastGPT 新建发布渠道 -在 FastGPT 中选择想要接入的应用,在 *发布渠道* 页面,新建一个接入微信公众号的发布渠道,填写好基础信息。 +在 FastGPT 中选择想要接入的应用,在 _发布渠道_ 页面,新建一个接入微信公众号的发布渠道,填写好基础信息。 ![图片](/imgs/offiaccount-1.png) @@ -35,7 +35,7 @@ description: FastGPT 接入微信公众号教程 私有部署的用户可自行查阅自己的 IP 地址。 -海外版用户(cloud.tryfastgpt.ai)可以填写下面的 IP 白名单: +海外版用户(cloud.fastgpt.io)可以填写下面的 IP 白名单: ``` 35.240.227.100 @@ -109,10 +109,12 @@ description: FastGPT 接入微信公众号教程 ![图片](/imgs/offiaccount-7.png) -2. 填入微信公众平台的 URL 处,然后提交保存 +2. 填入微信公众平台的 URL 处,然后提交保存 + ![图片](/imgs/offiaccount-8.png) ## 6. 启用服务器配置(如已自动启用,请忽略) + ![图片](/imgs/offiaccount-9.png) ## 7. 开始使用 diff --git a/plugins/model/rerank-bge/README.md b/plugins/model/rerank-bge/README.md index bb1b4339fafc..e6986d1923fc 100644 --- a/plugins/model/rerank-bge/README.md +++ b/plugins/model/rerank-bge/README.md @@ -111,4 +111,4 @@ services: ## 接入 FastGPT -参考 [ReRank模型接入](https://doc.fastgpt.io/docs/development/configuration/#rerank-接入) +参考 [ReRank模型接入](https://doc.fastgpt.io/docs/introduction/development/configuration/#rerank-接入) diff --git a/projects/app/src/service/common/system/index.ts b/projects/app/src/service/common/system/index.ts index b70a2a180a5f..745b326da30a 100644 --- a/projects/app/src/service/common/system/index.ts +++ b/projects/app/src/service/common/system/index.ts @@ -106,7 +106,7 @@ const defaultFeConfigs: FastGPTFeConfigsType = { show_emptyChat: true, show_git: true, docUrl: 'https://doc.fastgpt.io', - openAPIDocUrl: 'https://doc.fastgpt.io/docs/development/openapi', + openAPIDocUrl: 'https://doc.fastgpt.io/docs/introduction/development/openapi', systemPluginCourseUrl: 'https://fael3z0zfze.feishu.cn/wiki/ERZnw9R26iRRG0kXZRec6WL9nwh', appTemplateCourse: 'https://fael3z0zfze.feishu.cn/wiki/CX9wwMGyEi5TL6koiLYcg7U0nWb?fromScene=spaceOverview',