Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.8.6 merge #1943

Merged
merged 19 commits into from
Jul 4, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ https://github.com/labring/FastGPT/assets/15308462/7d3a38df-eb0e-4388-9250-2409b

## 🏘️ 社区交流群

扫码加入飞书话题群新开,逐渐弃用微信群
扫码加入飞书话题群 (新开,逐渐弃用微信群)

![](https://oss.laf.run/otnvvf-imgs/1719505774252.jpg)

Expand Down
42 changes: 42 additions & 0 deletions docSite/content/zh-cn/docs/development/upgrading/486.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: 'V4.8.6(进行中)'
description: 'FastGPT V4.8.6 更新说明'
icon: 'upgrade'
draft: false
toc: true
weight: 818
---

## 升级指南

### 1. 做好数据库备份

### 2. 修改镜像

- fastgpt 镜像 tag 修改成 v4.8.6-alpha
- fastgpt-sandbox 镜像 tag 修改成 v4.8.6-alpha
- 商业版镜像 tag 修改成 v4.8.6-alpha

### 3. 执行初始化

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

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

会初始化应用的继承权限

-------

## V4.8.6 更新说明

1. 新增 - 知识库支持单个集合禁用功能
2. 新增 - 文件夹权限继承
3. 新增 - 网页抓取和数学计算器系统插件
4. 新增 - 移动文本加工和自定义反馈到基础节点中
5. 优化 - Read file 默认选中从节点,实现 MongoDB 读写分离,减轻主节点压力
6. 修复 - 工作流中团队插件加载异常
7. 修复 - 知识库集合目录导航失效
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ weight: 404
"x": 1623.9214305901633,
"y": 22.777089001645862
},
"version": "481",
"version": "486",
"inputs": [
{
"key": "system_addInputParam",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export default async function (ctx: FunctionContext) {
},
{
"nodeId": "NOgbnBzUwDgT",
"name": "工具调用(实验)",
"name": "工具调用",
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
"avatar": "/imgs/workflow/tool.svg",
"flowNodeType": "tools",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ HTTP模块中,需要设置 3 个工具参数:
},
{
"nodeId": "fYxwWym8flYL",
"name": "工具调用(实验)",
"name": "工具调用",
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
"avatar": "/imgs/workflow/tool.svg",
"flowNodeType": "tools",
Expand Down
7 changes: 6 additions & 1 deletion packages/global/common/error/code/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ const startCode = 507000;
export enum CommonErrEnum {
fileNotFound = 'fileNotFound',
unAuthFile = 'unAuthFile',
missingParams = 'missingParams'
missingParams = 'missingParams',
inheritPermissionError = 'inheritPermissionError'
}
const datasetErr = [
{
Expand All @@ -19,6 +20,10 @@ const datasetErr = [
{
statusText: CommonErrEnum.missingParams,
message: 'error.missingParams'
},
{
statusText: CommonErrEnum.inheritPermissionError,
message: 'error.inheritPermissionError'
}
];
export default datasetErr.reduce((acc, cur, index) => {
Expand Down
1 change: 1 addition & 0 deletions packages/global/common/string/time.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import dayjs from 'dayjs';
import cronParser from 'cron-parser';

export const formatTime2YMDHMW = (time?: Date) => dayjs(time).format('YYYY-MM-DD HH:mm:ss dddd');
export const formatTime2YMDHM = (time?: Date) =>
time ? dayjs(time).format('YYYY-MM-DD HH:mm') : '';
export const formatTime2YMD = (time?: Date) => (time ? dayjs(time).format('YYYY-MM-DD') : '');
Expand Down
2 changes: 2 additions & 0 deletions packages/global/core/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export enum AppTypeEnum {
httpPlugin = 'httpPlugin'
}

export const AppFolderTypeList = [AppTypeEnum.folder, AppTypeEnum.httpPlugin];

export const defaultTTSConfig: AppTTSConfigType = { type: 'web' };

export const defaultWhisperConfig: AppWhisperConfigType = {
Expand Down
82 changes: 20 additions & 62 deletions packages/global/core/app/httpPlugin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import yaml from 'js-yaml';
import { OpenAPIV3 } from 'openapi-types';
import { FlowNodeInputItemType, FlowNodeOutputItemType } from '../../workflow/type/io';
import { FlowNodeInputTypeEnum, FlowNodeOutputTypeEnum } from '../../workflow/node/constant';
import { NodeInputKeyEnum, WorkflowIOValueTypeEnum } from '../../workflow/constants';
import { WorkflowIOValueTypeEnum } from '../../workflow/constants';
import { PluginInputModule } from '../../workflow/template/system/pluginInput';
import { PluginOutputModule } from '../../workflow/template/system/pluginOutput';
import { HttpModule468 } from '../../workflow/template/system/http468';
import { HttpNode468 } from '../../workflow/template/system/http468';
import { HttpParamAndHeaderItemType } from '../../workflow/api';
import { StoreNodeItemType } from '../../workflow/type';
import { StoreNodeItemType } from '../../workflow/type/node';
import { HttpImgUrl } from '../../../common/file/image/constants';
import SwaggerParser from '@apidevtools/swagger-parser';
import { getHandleId } from '../../workflow/utils';
Expand Down Expand Up @@ -116,16 +116,7 @@ export const httpApiSchema2Plugins = async ({
required: param.required,
description: param.description,
toolDescription: param.description,
canEdit: true,
editField: {
key: true,
name: true,
description: true,
required: true,
dataType: true,
inputType: true,
isToolInput: true
}
canEdit: true
};
}) || []),
...(propsKeys?.map((key) => {
Expand All @@ -138,16 +129,7 @@ export const httpApiSchema2Plugins = async ({
required: false,
description: prop.description,
toolDescription: prop.description,
canEdit: true,
editField: {
key: true,
name: true,
description: true,
required: true,
dataType: true,
inputType: true,
isToolInput: true
}
canEdit: true
};
}) || [])
];
Expand Down Expand Up @@ -186,10 +168,6 @@ export const httpApiSchema2Plugins = async ({
label: param.name,
renderTypeList: [FlowNodeInputTypeEnum.reference],
canEdit: true,
editField: {
key: true,
valueType: true
},
value: [pluginInputId, inputIdMap.get(param.name)]
};
}) || []),
Expand All @@ -200,10 +178,6 @@ export const httpApiSchema2Plugins = async ({
label: key,
renderTypeList: [FlowNodeInputTypeEnum.reference],
canEdit: true,
editField: {
key: true,
valueType: true
},
value: [pluginInputId, inputIdMap.get(key)]
};
}) || [])
Expand Down Expand Up @@ -271,7 +245,7 @@ export const httpApiSchema2Plugins = async ({
}

/* Combine complete modules */
const modules: StoreNodeItemType[] = [
const nodes: StoreNodeItemType[] = [
{
nodeId: pluginInputId,
name: PluginInputModule.name,
Expand All @@ -280,8 +254,8 @@ export const httpApiSchema2Plugins = async ({
flowNodeType: PluginInputModule.flowNodeType,
showStatus: PluginInputModule.showStatus,
position: {
x: 616.4226348688949,
y: -165.05298493910115
x: 473.55206291900333,
y: -145.65080850146154
},
version: PluginInputModule.version,
inputs: pluginInputs,
Expand All @@ -295,8 +269,8 @@ export const httpApiSchema2Plugins = async ({
flowNodeType: PluginOutputModule.flowNodeType,
showStatus: PluginOutputModule.showStatus,
position: {
x: 1607.7142331269126,
y: -151.8669210746189
x: 1847.5956872650024,
y: 5.114324648101558
},
version: PluginOutputModule.version,
inputs: [
Expand All @@ -308,11 +282,6 @@ export const httpApiSchema2Plugins = async ({
required: false,
description: '',
canEdit: true,
editField: {
key: true,
description: true,
valueType: true
},
value: [httpId, 'httpRawResponse']
}
],
Expand All @@ -328,29 +297,18 @@ export const httpApiSchema2Plugins = async ({
},
{
nodeId: httpId,
name: HttpModule468.name,
intro: HttpModule468.intro,
avatar: HttpModule468.avatar,
flowNodeType: HttpModule468.flowNodeType,
name: HttpNode468.name,
intro: HttpNode468.intro,
avatar: HttpNode468.avatar,
flowNodeType: HttpNode468.flowNodeType,
showStatus: true,
position: {
x: 1042.549746602742,
y: -447.77496332641647
x: 1188.947986995841,
y: -473.52694296182904
},
version: HttpModule468.version,
version: HttpNode468.version,
inputs: [
{
key: NodeInputKeyEnum.addInputParam,
renderTypeList: [FlowNodeInputTypeEnum.addInputParam],
valueType: WorkflowIOValueTypeEnum.dynamic,
label: '',
required: false,
description: 'core.module.input.description.HTTP Dynamic Input',
editField: {
key: true,
valueType: true
}
},
HttpNode468.inputs[0],
...httpInputs,
{
key: 'system_httpMethod',
Expand Down Expand Up @@ -397,7 +355,7 @@ export const httpApiSchema2Plugins = async ({
required: false
}
],
outputs: HttpModule468.outputs
outputs: HttpNode468.outputs
}
];

Expand All @@ -422,7 +380,7 @@ export const httpApiSchema2Plugins = async ({
intro: item.description,
parentId,
type: AppTypeEnum.plugin,
modules,
modules: nodes,
edges,
pluginData: {
pluginUniId: item.name
Expand Down
12 changes: 5 additions & 7 deletions packages/global/core/app/type.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type';
import type { FlowNodeTemplateType, StoreNodeItemType } from '../workflow/type/node';
import { AppTypeEnum } from './constants';
import { PermissionTypeEnum } from '../../support/permission/constant';
import { VariableInputEnum } from '../workflow/constants';
import { SelectedDatasetType } from '../workflow/api';
import { DatasetSearchModeEnum } from '../dataset/constants';
import { TeamTagSchema as TeamTagsSchemaType } from '@fastgpt/global/support/user/team/type.d';
import { StoreEdgeItemType } from '../workflow/type/edge';
import { PermissionValueType } from '../../support/permission/type';
import { PermissionSchemaType, PermissionValueType } from '../../support/permission/type';
import { AppPermission } from '../../support/permission/app/controller';
import { ParentIdType } from '../../common/parentFolder/type';

Expand Down Expand Up @@ -39,8 +39,7 @@ export type AppSchema = {

inited?: boolean;
teamTags: string[];
defaultPermission: PermissionValueType;
};
} & PermissionSchemaType;

export type AppListItemType = {
_id: string;
Expand All @@ -50,10 +49,9 @@ export type AppListItemType = {
intro: string;
type: AppTypeEnum;
updateTime: Date;
defaultPermission: PermissionValueType;
permission: AppPermission;
pluginData?: AppSchema['pluginData'];
};
permission: AppPermission;
} & PermissionSchemaType;

export type AppDetailType = AppSchema & {
permission: AppPermission;
Expand Down
2 changes: 1 addition & 1 deletion packages/global/core/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FlowNodeTypeEnum } from '../workflow/node/constant';
import { NodeInputKeyEnum, FlowNodeTemplateTypeEnum } from '../workflow/constants';
import type { FlowNodeInputItemType } from '../workflow/type/io.d';
import { getAppChatConfig } from '../workflow/utils';
import { StoreNodeItemType } from '../workflow/type';
import { StoreNodeItemType } from '../workflow/type/node';
import { DatasetSearchModeEnum } from '../dataset/constants';

export const getDefaultAppForm = (): AppSimpleEditFormType => ({
Expand Down
1 change: 0 additions & 1 deletion packages/global/core/app/version.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { StoreNodeItemType } from '../workflow/type';
import { StoreEdgeItemType } from '../workflow/type/edge';
import { AppChatConfigType, AppSchema } from './type';

Expand Down
2 changes: 1 addition & 1 deletion packages/global/core/chat/type.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClassifyQuestionAgentItemType } from '../workflow/type';
import { ClassifyQuestionAgentItemType } from '../workflow/template/system/classifyQuestion/type';
import { SearchDataResponseItemType } from '../dataset/type';
import {
ChatFileTypeEnum,
Expand Down
11 changes: 11 additions & 0 deletions packages/global/core/dataset/collection/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { DatasetCollectionTypeEnum, TrainingModeEnum, TrainingTypeMap } from '../constants';
import { CollectionWithDatasetType, DatasetCollectionSchemaType } from '../type';

export const getCollectionSourceData = (
Expand All @@ -12,3 +13,13 @@ export const getCollectionSourceData = (
sourceName: collection?.name || ''
};
};

export const checkCollectionIsFolder = (type: DatasetCollectionTypeEnum) => {
return type === DatasetCollectionTypeEnum.folder || type === DatasetCollectionTypeEnum.virtual;
};

export const getTrainingTypeLabel = (type?: TrainingModeEnum) => {
if (!type) return '';
if (!TrainingTypeMap[type]) return '';
return TrainingTypeMap[type].label;
};
Loading
Loading