Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions document/components/docs/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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` 文件才会生效。

Expand Down Expand Up @@ -70,4 +70,4 @@ description: FastGPT 配置参数介绍

### 使用 Marker 解析 PDF 文件

[点击查看 Marker 接入教程](/docs/development/custom-models/marker)
[点击查看 Marker 接入教程](/docs/introduction/development/custom-models/marker)
Original file line number Diff line number Diff line change
Expand Up @@ -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中的渠道密钥)
Expand All @@ -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 各添加一个渠道,参数如下:

Expand Down Expand Up @@ -97,7 +97,7 @@ M3E 模型的使用方法如下:
1. 创建知识库时候选择 M3E 模型。

注意,一旦选择后,知识库将无法修改向量模型。

![](/imgs/model-m3e2.png)

2. 导入数据
Expand All @@ -108,7 +108,7 @@ M3E 模型的使用方法如下:
4. 应用绑定知识库

注意,应用只能绑定同一个向量模型的知识库,不能跨模型绑定。并且,需要注意调整相似度,不同向量模型的相似度(距离)会有所区别,需要自行测试实验。

![](/imgs/model-m3e4.png)

chatglm2 模型的使用方法如下:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -81,7 +81,6 @@ ollama pull [模型名]

![](/imgs/Ollama-pull.png)


### 测试通信

在安装完成后,需要进行检测测试,首先进入 FastGPT 所在的容器,尝试访问自己的 Ollama ,命令如下:
Expand All @@ -108,15 +107,15 @@ ollama ls

### 2. AI Proxy 接入

如果你采用的是 FastGPT 中的默认配置文件部署[这里](/docs/development/docker.md),即默认采用 AI Proxy 进行启动。
如果你采用的是 FastGPT 中的默认配置文件部署[这里](/docs/introduction/development/docker.md),即默认采用 AI Proxy 进行启动。

![](/imgs/Ollama-aiproxy1.png)

以及在确保你的 FastGPT 可以直接访问 Ollama 容器的情况下,无法访问,参考上文[点此跳转](#安装-ollama)的安装过程,检测是不是主机不能监测0.0.0.0,或者容器不在同一个网络。

![](/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)

Expand Down Expand Up @@ -177,4 +176,5 @@ docker run -it --network [ FastGPT 网络 ] --name 容器名 intel/oneapi-hpckit
![](/imgs/Ollama-models4.png)

### 6. 补充

上述接入 Ollama 的代理地址中,主机安装 Ollama 的地址为“http://[主机IP]:[端口]”,容器部署 Ollama 地址为“http://[容器名]:[端口]”
Original file line number Diff line number Diff line change
Expand Up @@ -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 最大限度地利用显卡的加速功能。

Expand Down Expand Up @@ -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) 。

Expand Down Expand Up @@ -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)
8 changes: 4 additions & 4 deletions document/content/docs/introduction/development/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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 环境

Expand Down Expand Up @@ -181,7 +181,7 @@ docker-compose up -d
### 6. 配置模型

- 首次登录FastGPT后,系统会提示未配置`语言模型`和`索引模型`,并自动跳转模型配置页面。系统必须至少有这两类模型才能正常使用。
- 如果系统未正常跳转,可以在`账号-模型提供商`页面,进行模型配置。[点击查看相关教程](/docs/development/modelconfig/ai-proxy)
- 如果系统未正常跳转,可以在`账号-模型提供商`页面,进行模型配置。[点击查看相关教程](/docs/introduction/development/modelConfig/ai-proxy)
- 目前已知可能问题:首次进入系统后,整个浏览器 tab 无法响应。此时需要删除该tab,重新打开一次即可。

## FAQ
Expand Down Expand Up @@ -271,7 +271,7 @@ docker-compose up -d

### 如何更新版本?

1. 查看[更新文档](/docs/development/upgrading/index/),确认要升级的版本,避免跨版本升级。
1. 查看[更新文档](/docs/upgrading),确认要升级的版本,避免跨版本升级。
2. 修改镜像 tag 到指定版本
3. 执行下面命令会自动拉取镜像:

Expand All @@ -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)。

### 如何检查自定义配置文件是否挂载

Expand Down
72 changes: 37 additions & 35 deletions document/content/docs/introduction/development/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ description: FastGPT 私有部署常见问题

### OneAPI 错误

带有`requestId`的,都是 OneAPI 提示错误,大部分都是因为模型接口报错。可以参考 [OneAPI 常见错误](/docs/development/faq/#三常见的-oneapi-错误)
带有`requestId`的,都是 OneAPI 提示错误,大部分都是因为模型接口报错。可以参考 [OneAPI 常见错误](/docs/introduction/development/faq/#三常见的-oneapi-错误)

## 二、通用问题

Expand Down Expand Up @@ -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不兼容问题(较少)

### 开启内容补全后,响应速度变慢
Expand Down Expand Up @@ -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 刀,可以手动修改。

Expand All @@ -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 与模型网络不通,需要检查网络配置。
Expand All @@ -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)解决。
Expand Down Expand Up @@ -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
}
```

Expand Down
Loading
Loading