Skip to content

Commit

Permalink
4.8.5 test fix (#1835)
Browse files Browse the repository at this point in the history
* faq

* perf: navbar name and fix dataset selector

* feat: app tag

* perf: icon

* fix: update workflow bug

* perf: dataset ui

* perf: menu

* fix: ts

* fix: auth file and app list ui

* app list

* app list

* perf: init api

* update per

* log level
  • Loading branch information
c121914yu committed Jun 25, 2024
1 parent d902d29 commit 5c8c7fb
Show file tree
Hide file tree
Showing 50 changed files with 9,161 additions and 11,855 deletions.
11 changes: 11 additions & 0 deletions docSite/content/zh-cn/docs/development/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,14 @@ mongo连接失败,查看mongo的运行状态**对应日志**。
### 无法导出知识库、无法使用语音输入/播报
没配置 SSL 证书,无权使用部分功能。
### 登录提示 Network Error
由于服务初始化错误,系统重启导致。
* 90%是由于配置文件写不对,导致 JSON 解析报错
* 剩下的基本是因为向量数据库连不上
### 如何修改密码
修改`docker-compose.yml`文件中`DEFAULT_ROOT_PSW`并重启即可,密码会自动更新。
22 changes: 18 additions & 4 deletions docSite/content/zh-cn/docs/development/upgrading/485.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: 'FastGPT V4.8.5 更新说明'
icon: 'upgrade'
draft: false
toc: true
weight: 820
weight: 819
---

## 升级指南
Expand All @@ -14,8 +14,7 @@ weight: 820
### 2. 修改镜像

- fastgpt 镜像 tag 修改成 v4.8.5-alpha
<!-- - fastgpt-sandbox 镜像 tag 修改成 v4.8.5 (选择性,无变更) -->
<!-- - 商业版镜像 tag 修改成 v4.8.5 -->
- 商业版镜像 tag 修改成 v4.8.5 -alpha

### 3. 执行初始化

Expand All @@ -29,6 +28,20 @@ curl --location --request POST 'https://{{host}}/api/admin/initv485' \

会把插件的数据表合并到应用中,插件表不会删除。

------

**商业版用户执行额外的初始化**

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

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

会重置知识库权限系统。

## V4.8.5 更新说明

1. 新增 - 合并插件和应用,统一成工作台
Expand All @@ -40,4 +53,5 @@ curl --location --request POST 'https://{{host}}/api/admin/initv485' \
7. 修复 - SSR渲染
8. 修复 - 定时任务无法实际关闭
9. 修复 - 输入引导特殊字符导致正则报错
10. 修复 - 文件包含特殊字符`%`,且为转义时会导致页面崩溃
10. 修复 - 文件包含特殊字符`%`,且为转义时会导致页面崩溃
11. 修复 - 自定义输入选择知识库引用时页面崩溃
3 changes: 2 additions & 1 deletion files/docker/docker-compose-milvus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ services:

# oneapi
mysql:
image: mysql:8.0.36
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mysql:8.0.36 # 阿里云
# image: mysql:8.0.36
container_name: mysql
restart: always
ports:
Expand Down
3 changes: 2 additions & 1 deletion files/docker/docker-compose-pgvector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ services:

# oneapi
mysql:
image: mysql:8.0.36
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mysql:8.0.36 # 阿里云
# image: mysql:8.0.36
container_name: mysql
restart: always
ports:
Expand Down
3 changes: 2 additions & 1 deletion files/docker/docker-compose-zilliz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ services:

# oneapi
mysql:
image: mysql:8.0.36
image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mysql:8.0.36 # 阿里云
# image: mysql:8.0.36
container_name: mysql
restart: always
ports:
Expand Down
4 changes: 3 additions & 1 deletion packages/global/core/app/type.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export type AppSchema = {
name: string;
avatar: string;
intro: string;
updateTime: number;
updateTime: Date;

modules: StoreNodeItemType[];
edges: StoreEdgeItemType[];
Expand All @@ -44,10 +44,12 @@ export type AppSchema = {

export type AppListItemType = {
_id: string;
tmbId: string;
name: string;
avatar: string;
intro: string;
type: AppTypeEnum;
updateTime: Date;
defaultPermission: PermissionValueType;
permission: AppPermission;
pluginData?: AppSchema['pluginData'];
Expand Down
2 changes: 1 addition & 1 deletion packages/global/support/permission/dataset/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ export const DatasetPermissionList = {
}
};

export const DatasetDefaultPermission = NullPermission;
export const DatasetDefaultPermissionVal = NullPermission;
4 changes: 2 additions & 2 deletions packages/service/common/middle/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const NextEntry = ({ beforeCallback = [] }: { beforeCallback?: Promise<an
return (...args: NextApiHandler[]): NextApiHandler => {
return async function api(req: ApiRequestProps, res: NextApiResponse) {
const start = Date.now();
addLog.info(`Request start ${req.url}`);
addLog.debug(`Request start ${req.url}`);
try {
await Promise.all([withNextCors(req, res), ...beforeCallback]);

Expand All @@ -24,7 +24,7 @@ export const NextEntry = ({ beforeCallback = [] }: { beforeCallback?: Promise<an

const contentType = res.getHeader('Content-Type');

addLog.info(`Request finish ${req.url}, time: ${Date.now() - start}ms`);
addLog.debug(`Request finish ${req.url}, time: ${Date.now() - start}ms`);

if ((!contentType || contentType === 'application/json') && !res.writableFinished) {
return jsonRes(res, {
Expand Down
4 changes: 2 additions & 2 deletions packages/service/core/dataset/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TeamMemberCollectionName
} from '@fastgpt/global/support/user/team/constant';
import { PermissionTypeEnum, PermissionTypeMap } from '@fastgpt/global/support/permission/constant';
import { DatasetDefaultPermission } from '@fastgpt/global/support/permission/dataset/constant';
import { DatasetDefaultPermissionVal } from '@fastgpt/global/support/permission/dataset/constant';

export const DatasetCollectionName = 'datasets';

Expand Down Expand Up @@ -94,7 +94,7 @@ const DatasetSchema = new Schema({
externalReadUrl: String,
defaultPermission: {
type: Number,
default: DatasetDefaultPermission
default: DatasetDefaultPermissionVal
}
});

Expand Down
2 changes: 1 addition & 1 deletion packages/service/support/permission/app/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const authAppByTmbId = async ({
return Promise.reject(AppErrEnum.unExist);
}

const isOwner = tmbPer.isOwner || String(app.tmbId) === tmbId;
const isOwner = tmbPer.isOwner || String(app.tmbId) === String(tmbId);
const Per = new AppPermission({ per: rp?.permission ?? app.defaultPermission, isOwner });

if (!Per.checkPer(per)) {
Expand Down
19 changes: 13 additions & 6 deletions packages/service/support/permission/auth/file.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import { AuthResponseType } from '@fastgpt/global/support/permission/type';
import { AuthModeType } from '../type';
import { DatasetFileSchema } from '@fastgpt/global/core/dataset/type';
import { parseHeaderCert } from '../controller';
import { getFileById } from '../../../common/file/gridfs/controller';
import { BucketNameEnum } from '@fastgpt/global/common/file/constants';
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
import { OwnerPermissionVal, ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { AuthPropsType, AuthResponseType } from '../type/auth';
import { Permission } from '@fastgpt/global/support/permission/controller';

export async function authFile({
fileId,
per = 'owner',
per = OwnerPermissionVal,
...props
}: AuthModeType & {
}: AuthPropsType & {
fileId: string;
}): Promise<
AuthResponseType & {
Expand All @@ -29,14 +31,19 @@ export async function authFile({
if (file.metadata?.teamId !== teamId) {
return Promise.reject(CommonErrEnum.unAuthFile);
}
if (per === 'owner' && file.metadata?.tmbId !== tmbId) {

const permission = new Permission({
per: ReadPermissionVal,
isOwner: file.metadata?.tmbId === tmbId
});

if (!permission.checkPer(per)) {
return Promise.reject(CommonErrEnum.unAuthFile);
}

return {
...authRes,
isOwner: per === 'owner',
canWrite: per === 'owner',
permission,
file
};
}
8 changes: 5 additions & 3 deletions packages/service/support/permission/dataset/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { getFileById } from '../../../common/file/gridfs/controller';
import { BucketNameEnum } from '@fastgpt/global/common/file/constants';
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
import { MongoDatasetData } from '../../../core/dataset/data/schema';
import { DatasetDefaultPermissionVal } from '@fastgpt/global/support/permission/dataset/constant';

export async function authDatasetByTmbId({
tmbId,
Expand Down Expand Up @@ -46,7 +47,7 @@ export async function authDatasetByTmbId({
return Promise.reject(DatasetErrEnum.unExist);
}

const isOwner = tmbPer.isOwner || String(dataset.tmbId) === tmbId;
const isOwner = tmbPer.isOwner || String(dataset.tmbId) === String(tmbId);
const Per = new DatasetPermission({
per: rp?.permission ?? dataset.defaultPermission,
isOwner
Expand All @@ -58,11 +59,12 @@ export async function authDatasetByTmbId({

return {
...dataset,
defaultPermission: dataset.defaultPermission ?? DatasetDefaultPermissionVal,
permission: Per
};
})();

return { dataset: dataset };
return { dataset };
}

// Auth Dataset
Expand Down Expand Up @@ -202,7 +204,7 @@ export async function authDatasetData({
collectionId: String(datasetData.collectionId),
sourceName: result.collection.name || '',
sourceId: result.collection?.fileId || result.collection?.rawLink,
isOwner: String(datasetData.tmbId) === result.tmbId,
isOwner: String(datasetData.tmbId) === String(result.tmbId),
canWrite: result.permission.hasWritePer
};

Expand Down
1 change: 1 addition & 0 deletions packages/web/components/common/Icon/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export const iconPaths = {
'modal/setting': () => import('./icons/modal/setting.svg'),
'modal/teamPlans': () => import('./icons/modal/teamPlans.svg'),
more: () => import('./icons/more.svg'),
moreLine: () => import('./icons/moreLine.svg'),
out: () => import('./icons/out.svg'),
'phoneTabbar/me': () => import('./icons/phoneTabbar/me.svg'),
'phoneTabbar/tool': () => import('./icons/phoneTabbar/tool.svg'),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5c8c7fb

Please sign in to comment.