Skip to content

Commit

Permalink
V4.8.18 feature (#3565)
Browse files Browse the repository at this point in the history
* feat: org CRUD (#3380)

* feat: add org schema

* feat: org manage UI

* feat: OrgInfoModal

* feat: org tree view

* feat: org management

* fix: init root org

* feat: org permission for app

* feat: org support for dataset

* fix: disable org role control

* styles: opt type signatures

* fix: remove unused permission

* feat: delete org collaborator

* perf: Team org ui (#3499)

* perf: org ui

* perf: org ui

* feat: org auth for app & dataset (#3498)

* feat: auth org resource permission

* feat: org auth support for app & dataset

* perf: org permission check (#3500)

* i18n (#3501)

* name

* i18n

* feat: support dataset changeOwner (#3483)

* feat: support dataset changeOwner

* chore: update dataset change owner api

* feat: permission manage UI for org (#3503)

* perf: password check;perf: image upload check;perf: sso login check (#3509)

* perf: password check

* perf: image upload check

* perf: sso login check

* force show update notification modal & fix login page text (#3512)

* fix login page English text

* update notification modal

* perf: notify account (#3515)

* perf(plugin): improve searXNG empty result handling and documentation (#3507)

* perf(plugin): improve searXNG empty result handling and documentation

* 修改了文档和代码部分无搜索的结果的反馈

* refactor: org pathId (#3516)

* optimize payment process (#3517)

* feat: support wecom sso (#3518)

* feat: support wecom sso

* chore: remove unused wecom js-sdk dependency

* fix qrcode script (#3520)

* fix qrcode script

* i18n

* perf: full text collection and search code;perf: rename function (#3519)

* perf: full text collection and search code

* perf: rename function

* perf: notify modal

* remove invalid code

* perf: sso login

* perf: pay process

* 4.8.18 test (#3524)

* perf: remove local token

* perf: index

* perf: file encoding;perf: leave team code;@c121914yu perf: full text search code (#3528)

* perf: text encoding

* perf: leave team code

* perf: full text search code

* fix: http status

* perf: embedding search and vector avatar

* perf: async read file (#3531)

* refactor: team permission  manager (#3535)

* perf: classify org, group and member

* refactor: team per manager

* fix: missing functions

* 4.8.18 test (#3543)

* perf: login check

* doc

* perf: llm model config

* perf: team clb config

* fix: MemberModal UI (#3553)

* fix: adapt MemberModal title and icon

* fix: adapt member modal

* fix: search input placeholder

* fix: add button text

* perf: org permission (#3556)

* docs:用户答疑的官方文档补充 (#3540)

* docs:用户答疑的官方文档补充

* 问题回答的内容修补

* share link random avatar (#3541)

* share link random avatar

* fix

* delete unused code

* share page avatar (#3558)

* feat: init 4818

* share page avatar

* feat: tmp upgrade code (#3559)

* feat: tmp upgrade code

* fulltext search test

* update action

* full text tmp code (#3561)

* full text tmp code

* fix: init

* fix: init

* remove tmp code

* remove tmp code

* 4818-alpha

* 4.8.18 test (#3562)

* full text tmp code

* fix: init

* upgrade code

* account log

* account log

* perf: dockerfile

* upgrade code

* chore: update docs app template submission (#3564)

---------

Co-authored-by: a.e. <[email protected]>
Co-authored-by: Finley Ge <[email protected]>
Co-authored-by: heheer <[email protected]>
Co-authored-by: Jiangween <[email protected]>
  • Loading branch information
5 people authored Jan 11, 2025
1 parent bb669ca commit 10d8c56
Show file tree
Hide file tree
Showing 205 changed files with 5,299 additions and 2,422 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/preview-fastgpt-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ jobs:
password: ${{ secrets.GH_PAT }}
- name: Set DOCKER_REPO_TAGGED based on branch or tag
run: |
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-pr:${{ github.event.pull_request.number }}" >> $GITHUB_ENV
echo "DOCKER_REPO_TAGGED=ghcr.io/${{ github.repository_owner }}/fastgpt-pr:${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
- name: Build image for PR
env:
DOCKER_REPO_TAGGED: ${{ env.DOCKER_REPO_TAGGED }}
run: |
docker buildx build \
-f projects/app/Dockerfile \
--label "org.opencontainers.image.source=https://github.com/${{ github.repository_owner }}/FastGPT" \
--label "org.opencontainers.image.description=fastgpt-pr imae" \
--label "org.opencontainers.image.description=fastgpt-pr image" \
--label "org.opencontainers.image.licenses=Apache" \
--push \
--cache-from=type=local,src=/tmp/.buildx-cache \
Expand Down
2 changes: 1 addition & 1 deletion dev.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Premise

Since FastGPT is managed in the same way as monorepo, it is recommended to install 'make' first during development.
Since FastGPT is managed in the same way as monorepo, it is recommended to install make first during development.

monorepo Project Name:

Expand Down
Binary file added docSite/assets/imgs/dataset1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docSite/assets/imgs/dataset2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docSite/assets/imgs/template_submission2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docSite/content/zh-cn/docs/development/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ images: []

## 二、通用问题

### 本地部署的限制

具体内容参考https://fael3z0zfze.feishu.cn/wiki/OFpAw8XzAi36Guk8dfucrCKUnjg。

### 能否纯本地运行

可以。需要准备好向量模型和LLM模型。
Expand Down
37 changes: 37 additions & 0 deletions docSite/content/zh-cn/docs/development/upgrading/4818.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: 'V4.8.18(进行中)'
description: 'FastGPT V4.8.18 更新说明'
icon: 'upgrade'
draft: false
toc: true
weight: 806
---

## 更新指南

### 2. 运行升级脚本

从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`;{{host}} 替换成**FastGPT 域名**

```bash
curl --location --request POST 'https://{{host}}/api/admin/initv4818' \
--header 'rootkey: {{rootkey}}' \
--header 'Content-Type: application/json'
```

会迁移全文检索表,时间较长,迁移期间全文检索会失效,日志中会打印已经迁移的数据长度。


## 完整更新内容

1. 新增 - 支持部门架构权限模式。
2. 新增 - 支持配置自定跨域安全策略,默认全开。
3. 优化 - 分享链接随机生成用户头像。
4. 优化 - 图片上传安全校验。并增加头像图片唯一存储,确保不会累计存储。
5. 优化 - Mongo 全文索引表分离。
6. 优化 - 知识库检索查询语句合并,同时减少查库数量。
7. 优化 - 文件编码检测,减少 CSV 文件乱码概率。
8. 优化 - 异步读取文件内容,减少进程阻塞。
9. 优化 - 文件阅读,HTML 直接下载,不允许在线阅读。
10. 修复 - HTML 文件上传,base64 图片无法自动转图片链接。
11. 修复 - 插件计费错误。
10 changes: 9 additions & 1 deletion docSite/content/zh-cn/docs/faq/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ weight: 908

但是,当连续问题之间的关联性较小,模型判断的准确度可能会受到限制。在这种情况下,我们可以引入全局变量的概念来记录分类结果。在后续的问题分类阶段,首先检查全局变量是否存有分类结果。如果有,那么直接沿用该结果;若没有,则让模型自行判断。

建议:构建批量运行脚本进行测试,评估问题分类的准确性。
建议:构建批量运行脚本进行测试,评估问题分类的准确性。

## 系统编排配置中的定时执行,如果用户打开分享的连接,停留在那个页面,定时执行触发问题

发布后,后台生效。

## AI对话回答要求中的Markdown语法取消

在针对知识库的回答要求里有, 要给它配置提示词,不然他就是默认的,默认的里面就有该语法。
49 changes: 48 additions & 1 deletion docSite/content/zh-cn/docs/faq/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,51 @@ weight: 910
## 知识库配置里的文件处理模型是什么?与索引模型有什么区别?

* **文件处理模型**:用于数据处理的【增强处理】和【问答拆分】。在【增强处理】中,生成相关问题和摘要,在【问答拆分】中执行问答对生成。
* **索引模型**:用于向量化,即通过对文本数据进行处理和组织,构建出一个能够快速查询的数据结构。
* **索引模型**:用于向量化,即通过对文本数据进行处理和组织,构建出一个能够快速查询的数据结构。

## 基于知识库的查询,但是问题相关的答案过多。ai回答到一半就不继续回答。

FastGPT回复长度计算公式:

最大回复=min(配置的最大回复(内置的限制),最大上下文(输入和输出的总和)-历史记录)

18K模型->输入与输出的和

输出增多->输入减小

所以可以:

1. 检查配置的最大回复(回复上限)
2. 减小输入来增大输出,即减小历史记录,在工作流其实也就是“聊天记录”

配置的最大回复:

![](/imgs/dataset1.png)

![](/imgs/dataset2.png)

1. 私有化部署的时候,后台配模型参数,可以在配置最大上文时候,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出


## 受到模型上下文的限制,有时候达不到聊天记录的轮次,连续对话字数过多就会报上下文不够的错误。

FastGPT回复长度计算公式:

最大回复=min(配置的最大回复(内置的限制),最大上下文(输入和输出的总和)-历史记录)

18K模型->输入与输出的和

输出增多->输入减小

所以可以:

1. 检查配置的最大回复(回复上限)
2. 减小输入来增大输出,即减小历史记录,在工作流其实也就是“聊天记录”

配置的最大回复:

![](/imgs/dataset1.png)

![](/imgs/dataset2.png)

1. 私有化部署的时候,后台配模型参数,可以在配置最大上文时候,预留一些空间,比如 128000 的模型,可以只配置 120000, 剩余的空间后续会被安排给输出
12 changes: 12 additions & 0 deletions docSite/content/zh-cn/docs/guide/plugins/searxng_plugin_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,18 @@ default_doi_resolver: 'oadoi.org'
}
```

* 搜索结果为空时会返回友好提示:

```Bash
{
"result": "[]",
"error": {
"message": "No search results",
"code": 500
}
}
```

* 失败时通过 Promise.reject 可能返回错误信息:

```Bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ weight: 602

1. ### 创建应用模板

应用模板配置以及相关资源,都会在 **projects/app/public/appMarketTemplates** 目录下。
应用模板配置以及相关资源,都会在 **packages/templates/src** 目录下。

![](/imgs/template_submission2.png)

1. **projects/app/public/appMarketTemplates** 目录下,创建一个文件夹,名称为模板对应的 id。
1.**packages/templates/src** 目录下,创建一个文件夹,名称为模板对应的 id。
2. 在刚刚创建的文件夹中,再创建一个 **template.json** 文件,复制粘贴并填写如下配置:

```JSON
Expand Down Expand Up @@ -83,4 +83,4 @@ weight: 602

- 写清楚模板的介绍和功能
- 配上模板运行的效果图
- 模板参数填写说明,需要在 PR 中写清楚。例如,有些模板需要去某个提供商申请 key,需要附上对应的地址和教程,后续我们会加入到文档中。
- 模板参数填写说明,需要在 PR 中写清楚。例如,有些模板需要去某个提供商申请 key,需要附上对应的地址和教程,后续我们会加入到文档中。
6 changes: 6 additions & 0 deletions packages/global/common/error/code/common.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { i18nT } from '../../../../web/i18n/utils';
import { ErrType } from '../errorCode';

/* dataset: 507000 */
const startCode = 507000;
export enum CommonErrEnum {
invalidParams = 'invalidParams',
fileNotFound = 'fileNotFound',
unAuthFile = 'unAuthFile',
missingParams = 'missingParams',
inheritPermissionError = 'inheritPermissionError'
}
const datasetErr = [
{
statusText: CommonErrEnum.fileNotFound,
message: i18nT('common:error.invalid_params')
},
{
statusText: CommonErrEnum.fileNotFound,
message: 'error.fileNotFound'
Expand Down
43 changes: 42 additions & 1 deletion packages/global/common/error/code/team.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
import type { ErrType } from '../errorCode';
/* team: 500000 */
export enum TeamErrEnum {
notUser = 'notUser',
teamOverSize = 'teamOverSize',
unAuthTeam = 'unAuthTeam',
teamMemberOverSize = 'teamMemberOverSize',
aiPointsNotEnough = 'aiPointsNotEnough',
datasetSizeNotEnough = 'datasetSizeNotEnough',
datasetAmountNotEnough = 'datasetAmountNotEnough',
Expand All @@ -14,11 +16,22 @@ export enum TeamErrEnum {
groupNameEmpty = 'groupNameEmpty',
groupNameDuplicate = 'groupNameDuplicate',
groupNotExist = 'groupNotExist',
orgMemberNotExist = 'orgMemberNotExist',
orgMemberDuplicated = 'orgMemberDuplicated',
orgNotExist = 'orgNotExist',
orgParentNotExist = 'orgParentNotExist',
cannotMoveToSubPath = 'cannotMoveToSubPath',
cannotModifyRootOrg = 'cannotModifyRootOrg',
cannotDeleteNonEmptyOrg = 'cannotDeleteNonEmptyOrg',
cannotDeleteDefaultGroup = 'cannotDeleteDefaultGroup',
userNotActive = 'userNotActive'
}

const teamErr = [
{
statusText: TeamErrEnum.notUser,
message: i18nT('common:code_error.team_error.not_user')
},
{
statusText: TeamErrEnum.teamOverSize,
message: i18nT('common:code_error.team_error.over_size')
Expand Down Expand Up @@ -71,6 +84,34 @@ const teamErr = [
{
statusText: TeamErrEnum.userNotActive,
message: i18nT('common:code_error.team_error.user_not_active')
},
{
statusText: TeamErrEnum.orgMemberNotExist,
message: i18nT('common:code_error.team_error.org_member_not_exist')
},
{
statusText: TeamErrEnum.orgMemberDuplicated,
message: i18nT('common:code_error.team_error.org_member_duplicated')
},
{
statusText: TeamErrEnum.orgNotExist,
message: i18nT('common:code_error.team_error.org_not_exist')
},
{
statusText: TeamErrEnum.orgParentNotExist,
message: i18nT('common:code_error.team_error.org_parent_not_exist')
},
{
statusText: TeamErrEnum.cannotMoveToSubPath,
message: i18nT('common:code_error.team_error.cannot_move_to_sub_path')
},
{
statusText: TeamErrEnum.cannotModifyRootOrg,
message: i18nT('common:code_error.team_error.cannot_modify_root_org')
},
{
statusText: TeamErrEnum.cannotDeleteNonEmptyOrg,
message: i18nT('common:code_error.team_error.cannot_delete_non_empty_org')
}
];

Expand Down
15 changes: 3 additions & 12 deletions packages/global/common/error/code/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,16 @@ import { ErrType } from '../errorCode';
import { i18nT } from '../../../../web/i18n/utils';
/* team: 503000 */
export enum UserErrEnum {
unAuthUser = 'unAuthUser',
unAuthRole = 'unAuthRole',
binVisitor = 'binVisitor',
account_psw_error = 'account_psw_error',
balanceNotEnough = 'balanceNotEnough',
unAuthSso = 'unAuthSso'
}
const errList = [
{
statusText: UserErrEnum.unAuthUser,
message: i18nT('common:code_error.user_error.un_auth_user')
statusText: UserErrEnum.account_psw_error,
message: i18nT('common:code_error.account_error')
},
{
statusText: UserErrEnum.binVisitor,
message: i18nT('common:code_error.user_error.bin_visitor')
}, // 身份校验未通过
{
statusText: UserErrEnum.binVisitor,
message: i18nT('common:code_error.user_error.bin_visitor_guest')
}, // 游客身份
{
statusText: UserErrEnum.balanceNotEnough,
message: i18nT('common:code_error.user_error.balance_not_enough')
Expand Down
5 changes: 1 addition & 4 deletions packages/global/common/file/api.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { MongoImageTypeEnum } from './image/constants';
import { OutLinkChatAuthProps } from '../../support/permission/chat.d';

export type preUploadImgProps = OutLinkChatAuthProps & {
type: `${MongoImageTypeEnum}`;

expiredTime?: Date;
// expiredTime?: Date;
metadata?: Record<string, any>;
};
export type UploadImgProps = preUploadImgProps & {
Expand Down
56 changes: 0 additions & 56 deletions packages/global/common/file/image/constants.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,5 @@
export const imageBaseUrl = '/api/system/img/';

export enum MongoImageTypeEnum {
systemAvatar = 'systemAvatar',
appAvatar = 'appAvatar',
pluginAvatar = 'pluginAvatar',
datasetAvatar = 'datasetAvatar',
userAvatar = 'userAvatar',
teamAvatar = 'teamAvatar',
groupAvatar = 'groupAvatar',

chatImage = 'chatImage',
collectionImage = 'collectionImage'
}
export const mongoImageTypeMap = {
[MongoImageTypeEnum.systemAvatar]: {
label: 'appAvatar',
unique: true
},
[MongoImageTypeEnum.appAvatar]: {
label: 'appAvatar',
unique: true
},
[MongoImageTypeEnum.pluginAvatar]: {
label: 'pluginAvatar',
unique: true
},
[MongoImageTypeEnum.datasetAvatar]: {
label: 'datasetAvatar',
unique: true
},
[MongoImageTypeEnum.userAvatar]: {
label: 'userAvatar',
unique: true
},
[MongoImageTypeEnum.teamAvatar]: {
label: 'teamAvatar',
unique: true
},
[MongoImageTypeEnum.groupAvatar]: {
label: 'groupAvatar',
unique: true
},

[MongoImageTypeEnum.chatImage]: {
label: 'chatImage',
unique: false
},
[MongoImageTypeEnum.collectionImage]: {
label: 'collectionImage',
unique: false
}
};

export const uniqueImageTypeList = Object.entries(mongoImageTypeMap)
.filter(([key, value]) => value.unique)
.map(([key]) => key as `${MongoImageTypeEnum}`);

export const FolderIcon = 'file/fill/folder';
export const FolderImgUrl = '/imgs/files/folder.svg';
export const HttpPluginImgUrl = '/imgs/app/httpPluginFill.svg';
Expand Down
4 changes: 0 additions & 4 deletions packages/global/common/file/image/type.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { MongoImageTypeEnum } from './constants';

export type MongoImageSchemaType = {
_id: string;
teamId: string;
binary: Buffer;
createTime: Date;
expiredTime?: Date;
type: `${MongoImageTypeEnum}`;

metadata?: {
mime?: string; // image mime type.
Expand Down
Loading

0 comments on commit 10d8c56

Please sign in to comment.