Skip to content

Commit

Permalink
Commercial baseurl (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
c121914yu committed Jan 6, 2024
1 parent dfa4c08 commit 84cc4ba
Show file tree
Hide file tree
Showing 44 changed files with 128 additions and 123 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b
[![](https://cdn.jsdelivr.us/gh/labring-actions/templates@main/Deploy-on-Sealos.svg)](https://cloud.sealos.io/?openapp=system-fastdeploy%3FtemplateName%3Dfastgpt)

由于需要部署数据库,部署完后需要等待 2~4 分钟才能正常访问。默认用了最低配置,首次访问时会有些慢。
由于需要部署数据库,部署完后需要等待 2~4 分钟才能正常访问。默认用了最低配置,首次访问时会有些慢。相关使用教程可查看:[Sealos 部署 FastGPT](https://doc.fastgpt.in/docs/development/sealos/)

* [快开始本地开发](https://doc.fastgpt.in/docs/development/intro/)
* [部署 FastGPT](https://doc.fastgpt.in/docs/development/sealos)
Expand Down
Binary file removed docSite/assets/imgs/KBProcess.jpg
Binary file not shown.
Binary file removed docSite/assets/imgs/chatmodels1.png
Binary file not shown.
Binary file removed docSite/assets/imgs/data_search1.png
Binary file not shown.
Binary file removed docSite/assets/imgs/onsealos10.png
Binary file not shown.
Binary file removed docSite/assets/imgs/onsealos12.png
Binary file not shown.
Binary file removed docSite/assets/imgs/onsealosl11.PNG
Binary file not shown.
Binary file removed docSite/assets/imgs/sealos13.png
Binary file not shown.
9 changes: 5 additions & 4 deletions docSite/content/docs/development/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ weight: 708
```json
{
"SystemParams": {
"pluginBaseUrl": "", // 商业版接口地址
"vectorMaxProcess": 15, // 向量生成最大进程,结合数据库性能和 key 来设置
"qaMaxProcess": 15, // QA 生成最大进程,结合数据库性能和 key 来设置
"pgHNSWEfSearch": 100 // pg vector 索引参数,越大精度高但速度慢
Expand Down Expand Up @@ -169,7 +168,6 @@ weight: 708
```json
{
"systemEnv": {
"pluginBaseUrl": "", // 商业版接口地址
"vectorMaxProcess": 15, // 向量生成最大进程,结合数据库性能和 key 来设置
"qaMaxProcess": 15, // QA 生成最大进程,结合数据库性能和 key 来设置
"pgHNSWEfSearch": 100 // pg vector 索引参数,越大精度高但速度慢
Expand Down Expand Up @@ -234,7 +232,8 @@ weight: 708
"name": "GPT35-16k",
"maxContext": 16000,
"maxResponse": 16000,
"price": 0
"inputPrice": 0,
"outputPrice": 0
}
],
"cqModels": [ // 问题分类模型
Expand All @@ -254,6 +253,7 @@ weight: 708
"maxContext": 8000,
"maxResponse": 8000,
"inputPrice": 0,
"outputPrice": 0,
"toolChoice": true,
"functionPrompt": ""
}
Expand All @@ -264,7 +264,8 @@ weight: 708
"name": "GPT35-1106",
"maxContext": 16000,
"maxResponse": 4000,
"outputPrice": 0,
"inputPrice": 0,
"outputPrice": 0,
"toolChoice": true,
"functionPrompt": ""
}
Expand Down
10 changes: 5 additions & 5 deletions docSite/content/docs/development/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ weight: 707
## 推荐配置

{{< table "table-hover table-striped-columns" >}}
| 环境 | 推荐配置(单节点) |
| ---- | ---- |
| 测试 | 2c2g |
| 100w 组向量 | 4c16g |
| 500w 组向量 | 16c64g |
| 环境 | 最低配置(单节点) | 推荐配置 |
| ---- | ---- | ---- |
| 测试 | 2c2g | 2c4g |
| 100w 组向量 | 4c8g 50GB | 4c16g 50GB |
| 500w 组向量 | 8c32g | 16c64g 200GB |
{{< /table >}}

### 1. 准备好代理环境(国外服务器可忽略)
Expand Down
2 changes: 1 addition & 1 deletion docSite/content/docs/development/openapi/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ weight: 853

| 如何获取知识库ID(datasetId) | 如何获取文件集合ID(collection_id) |
| --------------------- | --------------------- |
| ![](/imgs/getDatasetId.png) | ![](/imgs/getfile_id.png) |
| ![](/imgs/getDatasetId.jpg) | ![](/imgs/getfile_id.png) |



Expand Down
4 changes: 2 additions & 2 deletions docSite/content/docs/development/openapi/share.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ weight: 860
## 配置教程
### 1. 配置身份校验地址

![](/imgs/share-setlink.jpg)
![](/imgs/share-setlink.png)

配置校验地址后,在每次分享链接使用时,都会向对应的地址发起校验和上报请求。

Expand Down Expand Up @@ -251,7 +251,7 @@ curl --location --request POST '{{host}}/shareAuth/finish' \

### 1. 创建3个Laf接口

![](/imgs/share-auth1.jpg)
![](/imgs/share-auth1.png)



Expand Down
23 changes: 13 additions & 10 deletions docSite/content/docs/development/sealos.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ toc: true
weight: 706
---

## 部署架构图

![](/imgs/sealos-fastgpt.webp)

## 一键部署
Sealos 的服务器在国外,不需要额外处理网络问题,无需服务器、无需魔法、无需域名,支持高并发 & 动态伸缩。点击以下按钮即可一键部署 👇

[![](https://fastly.jsdelivr.net/gh/labring-actions/templates@main/Deploy-on-Sealos.svg)](https://cloud.sealos.io/?openapp=system-fastdeploy%3FtemplateName%3Dfastgpt)
Expand All @@ -19,11 +24,13 @@ Sealos 的服务器在国外,不需要额外处理网络问题,无需服务

![](/imgs/sealos2.png)

> 用户名:`root`
>
> 密码就是刚刚一键部署时设置的环境变量
### 登录

用户名:`root`

## 修改配置文件和环境变量
密码是刚刚一键部署时设置的`root_password`

### 修改配置文件和环境变量

在 Sealos 中,你可以打开`应用管理`(App Launchpad)看到部署的 FastGPT,可以打开`数据库`(Database)看到对应的数据库。

Expand All @@ -35,13 +42,9 @@ Sealos 的服务器在国外,不需要额外处理网络问题,无需服务
在 Sealos 上,FastGPT 一共运行了 1 个服务和 2 个数据库,如暂停和删除请注意数据库一同操作。(你可以白天启动,晚上暂停它们,省钱大法)
{{% /alert %}}

## 更新

点击重启会自动拉取最新镜像更新,请确保镜像`tag`正确。
### 更新

## 部署架构图

![](/imgs/sealos-fastgpt.webp)
点击变更或重启会自动拉取镜像更新,请确保镜像`tag`正确。建议不要使用`latest`,改成固定版本号。

## Sealos 使用

Expand Down
4 changes: 2 additions & 2 deletions docSite/content/docs/development/upgrading/45.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ CREATE INDEX CONCURRENTLY vector_index ON modeldata USING hnsw (vector vector_ip

| | |
| --------------------- | --------------------- |
| ![](/imgs/v45-1.png) | ![](/imgs/v45-2.png) |
| ![](/imgs/v45-3.png) | ![](/imgs/v45-4.png) |
| ![](/imgs/v45-1.jpg) | ![](/imgs/v45-2.jpg) |
| ![](/imgs/v45-3.jpg) | ![](/imgs/v45-4.jpg) |



Expand Down
10 changes: 10 additions & 0 deletions docSite/content/docs/development/upgrading/466.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ weight: 830

为了减少代码重复度,我们对配置文件做了一些修改:[点击查看最新的配置文件](/docs/development/configuration/)

## 商业版变更

1. 更新商业版镜像到 4.6.6 版本。
2. 将旧版配置文件中的 `SystemParams.pluginBaseUrl` 放置到环境变量中:

PRO_URL=商业版镜像地址(此处不再需要以 /api 结尾),例如:
PRO_URL=http://fastgpt-plugin.ns-hsss5d.svc.cluster.local:3000

3. 原本在配置文件中的 `FeConfig` 已被移除,可以直接打开新的商业版镜像外网地址进行配置。包括 FastGPT 的各个参数和模型都可以直接在商业版镜像中配置,无需再变更 `config.json` 文件。

## 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)
Expand Down
6 changes: 3 additions & 3 deletions docSite/content/docs/development/upgrading/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ FastGPT 升级包括两个步骤:

2. 选择对应的应用 - 点击右边三个点 - 变更

![](/imgs/updateImageSealos2.jpg)
![](/imgs/updateImageSealos2.png)

3. 修改镜像 - 确认变更

如果要修改配置文件,可以拉到下面的`配置文件`进行修改。

![](/imgs/updateImageSealos3.jpg)
![](/imgs/updateImageSealos3.png)

## Docker-Compose 修改镜像

Expand All @@ -66,7 +66,7 @@ docker-compose up -d

Sealos 中,你可以在下图中找到你的域名:

![](/imgs/updateImageSealos4.jpg)
![](/imgs/updateImageSealos4.png)


### 如何获取 rootkey
Expand Down
8 changes: 4 additions & 4 deletions docSite/content/docs/use-cases/ai_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ Tips: 建议根据不同的场景,每种知识库仅选择1类数据类型,

| 通用模板配置及效果 | 问答模板配置及效果 |
| --- | --- |
| ![](/imgs/datasetprompt1.png) | ![](/imgs/datasetprompt2.png) |
| ![](/imgs/datasetprompt3.png) | ![](/imgs/datasetprompt5.png) |
| ![](/imgs/datasetprompt4.png) | ![](/imgs/datasetprompt6.png) |
| ![](/imgs/datasetprompt1.jpg) | ![](/imgs/datasetprompt2.jpg) |
| ![](/imgs/datasetprompt3.jpg) | ![](/imgs/datasetprompt5.jpg) |
| ![](/imgs/datasetprompt4.jpg) | ![](/imgs/datasetprompt6.jpg) |

#### 严格模板

使用非严格模板,我们随便询问一个不在知识库中的内容,模型通常会根据其自身知识进行回答。

| 非严格模板效果 | 选择严格模板 | 严格模板效果 |
| --- | --- | --- |
| ![](/imgs/datasetprompt7.png) | ![](/imgs/datasetprompt8.png) |![](/imgs/datasetprompt9.png) |
| ![](/imgs/datasetprompt7.jpg) | ![](/imgs/datasetprompt8.jpg) |![](/imgs/datasetprompt9.jpg) |

#### 提示词设计思路

Expand Down
2 changes: 1 addition & 1 deletion docSite/content/docs/use-cases/datasetEngine.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ FastGPT 采用了 `PostgresSQL` 的 `PG Vector` 插件作为向量检索器,

有些数据较为独特,可能需要单独的进行预处理分割后再导入 FastGPT,此时可以选择 csv 导入,可批量的将处理好的数据导入。

![](/imgs/datasetEngine11.png)
![](/imgs/datasetEngine11.jpg)

### 导入数据方案5 - API导入

Expand Down
4 changes: 2 additions & 2 deletions docSite/content/docs/workflow/examples/lab_appointment.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ HTTP 模块允许你调用任意 GET/POST 类型的 HTTP 接口,从而实现
2. 可以通过内容提取模块,实现自然语言转结构化数据,从而实现复杂的逻辑操作。
3. 内容提取 + HTTP 模块允许你无限扩展。

**难点**
**困难点**

1. 模型对连续对话的分类和提取能力不足
1. 模型对连续对话时,分类和提取能力不足


# 附件
Expand Down
10 changes: 5 additions & 5 deletions docSite/content/docs/workflow/examples/versatile_assistant.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ weight: 406

1. 找到查询天气的 API 接口

![](/imgs/versatile_assistant_3.jpg)
![](/imgs/versatile_assistant_3.png)

2. 由于我想要的效果是用户可以随意问接下来一周内任意时间的天气(比如用户可以问“接下来一周的天气适合晾被子吗”),所以选择了上面接口的这个格式:https://api.vvhan.com/api/weather?city=徐州&type=week

Expand Down Expand Up @@ -109,7 +109,7 @@ if __name__ == '__main__':

第一步就是对用户问题进行分类,如图红框部分:

![](/imgs/versatile_assistant_4.jpg)
![](/imgs/versatile_assistant_4.png)

### 接口参数获取及处理

Expand All @@ -132,7 +132,7 @@ if __name__ == '__main__':

如图:

![](/imgs/versatile_assistant_5.jpg)
![](/imgs/versatile_assistant_5.png)

### AI 总结回复

Expand All @@ -147,7 +147,7 @@ if __name__ == '__main__':

如图:

![](/imgs/versatile_assistant_6.jpg)
![](/imgs/versatile_assistant_6.png)

## 模块编排

Expand Down Expand Up @@ -1526,7 +1526,7 @@ PS2:配置中的问题分类还包含着“联网搜索”,这个是另一

## 效果图

![](/imgs/versatile_assistant_7.jpg)
![](/imgs/versatile_assistant_7.png)

## 后记

Expand Down
1 change: 0 additions & 1 deletion packages/global/common/system/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export type FastGPTFeConfigsType = {
};

export type SystemEnvType = {
pluginBaseUrl?: string;
openapiPrefix?: string;
vectorMaxProcess: number;
qaMaxProcess: number;
Expand Down
6 changes: 5 additions & 1 deletion packages/global/support/user/inform/constants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
export enum InformTypeEnum {
system = 'system'
system = 'system',
admin = 'admin'
}

export const InformTypeMap = {
[InformTypeEnum.system]: {
label: '系统通知'
},
[InformTypeEnum.admin]: {
label: '管理员'
}
};
2 changes: 1 addition & 1 deletion packages/global/support/user/inform/type.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InformTypeEnum } from './constant';
import { InformTypeEnum } from './constants';

export type SendInformProps = {
tmbId?: string;
Expand Down
5 changes: 3 additions & 2 deletions packages/service/common/api/plusRequest.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios, { Method, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
import { FastGPTProUrl } from '../system/constants';

interface ConfigType {
headers?: { [key: string]: string };
Expand Down Expand Up @@ -70,7 +71,7 @@ instance.interceptors.request.use(requestStart, (err) => Promise.reject(err));
instance.interceptors.response.use(responseSuccess, (err) => Promise.reject(err));

export function request(url: string, data: any, config: ConfigType, method: Method): any {
if (!global.systemEnv || !global.systemEnv?.pluginBaseUrl) {
if (!FastGPTProUrl) {
console.log('未部署商业版接口', url);
return Promise.reject('The The request was denied...');
}
Expand All @@ -84,7 +85,7 @@ export function request(url: string, data: any, config: ConfigType, method: Meth

return instance
.request({
baseURL: global.systemEnv.pluginBaseUrl,
baseURL: FastGPTProUrl,
url,
method,
data: ['POST', 'PUT'].includes(method) ? data : null,
Expand Down
3 changes: 0 additions & 3 deletions packages/service/common/string/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ export const htmlToMarkdown = (html?: string | null) =>
worker.terminate();
reject(err);
});
worker.on('exit', (code) => {
console.log('html 2 md finish', code);
});

worker.postMessage(html);
});
5 changes: 4 additions & 1 deletion packages/service/common/system/config/controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { SystemConfigsTypeEnum } from '@fastgpt/global/common/system/config/constants';
import { MongoSystemConfigs } from './schema';
import { FastGPTConfigFileType } from '@fastgpt/global/common/system/types';
import { FastGPTProUrl } from '../constants';

export const getFastGPTConfigFromDB = async () => {
if (!FastGPTProUrl) return {} as FastGPTConfigFileType;

const res = await MongoSystemConfigs.findOne({
type: SystemConfigsTypeEnum.fastgpt
}).sort({
Expand All @@ -11,5 +14,5 @@ export const getFastGPTConfigFromDB = async () => {

const config = res?.value || {};

return config as Omit<FastGPTConfigFileType, 'systemEnv'>;
return config as FastGPTConfigFileType;
};
1 change: 1 addition & 0 deletions packages/service/common/system/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const FastGPTProUrl = process.env.PRO_URL ? `${process.env.PRO_URL}/api` : '';
3 changes: 2 additions & 1 deletion packages/service/support/outLink/tools.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios from 'axios';
import { MongoOutLink } from './schema';
import { FastGPTProUrl } from '../../common/system/constants';

export const updateOutLinkUsage = async ({
shareId,
Expand Down Expand Up @@ -30,7 +31,7 @@ export const pushResult2Remote = async ({
shareId?: string;
responseData?: any[];
}) => {
if (!shareId || !outLinkUid || !global.systemEnv?.pluginBaseUrl) return;
if (!shareId || !outLinkUid || !FastGPTProUrl) return;
try {
const outLink = await MongoOutLink.findOne({
shareId
Expand Down
2 changes: 2 additions & 0 deletions projects/app/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ CHAT_API_KEY=sk-xxxx
MONGODB_URI=mongodb://username:[email protected]:27017/fastgpt?authSource=admin
# PG 数据库连接参数
PG_URL=postgresql://username:password@host:port/postgres
# 商业版地址
PRO_URL=
# 首页路径
HOME_URL=/
# Loki Log Path
Expand Down
Loading

0 comments on commit 84cc4ba

Please sign in to comment.