Skip to content

Commit 3a5d725

Browse files
c121914yunewfish-cmykdreamer6680dreamer6680
authored
feature: 4.10.1 (#5201)
* add dynamic inputRender (#5127) * dynamic input component * fix * fix * fix * perf: dynamic render input * update doc * perf: error catch * num input ui * fix form render (#5177) * perf: i18n check * add log * doc * Sync dataset (#5181) * perf: api dataset create (#5047) * Sync dataset (#5120) * add * wait * restructure dataset sync, update types and APIs, add sync hints, and remove legacy logic * feat: add function to retrieve real file ID from third-party doc library and rename team permission check function for clarity * fix come console * refactor: rename team dataset limit check functions for clarity, update API dataset sync limit usage, and rename root directory to "ROOT_FOLDER" * frat: update sync dataset login * fix delete.ts * feat: update pnpm-lock.yaml to include bullmq, fix comments in api.d.ts and type.d.ts, rename API file ID field, optimize dataset sync logic, and add website sync feature with related APIs * feat: update CollectionCard to support site dataset sync, add API root ID constant and init sync API * feat: add RootCollectionId constant to replace hardcoded root ID --------- Co-authored-by: dreamer6680 <[email protected]> * perf: code * feat: update success message for dataset sync, revise related i18n texts, and optimize file selection logic (#5166) Co-authored-by: dreamer6680 <[email protected]> * perf: select file * Sync dataset (#5180) * feat: update success message for dataset sync, revise related i18n texts, and optimize file selection logic * fix: make listfile function return rawid string --------- Co-authored-by: dreamer6680 <[email protected]> * init sh * fix: ts --------- Co-authored-by: dreamer6680 <[email protected]> Co-authored-by: dreamer6680 <[email protected]> * update doc * i18n --------- Co-authored-by: heheer <[email protected]> Co-authored-by: dreamer6680 <[email protected]> Co-authored-by: dreamer6680 <[email protected]>
1 parent 2865419 commit 3a5d725

File tree

92 files changed

+2335
-2234
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2335
-2234
lines changed

docSite/content/zh-cn/docs/development/upgrading/4101.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,48 @@ toc: true
77
weight: 784
88
---
99

10+
## 更新指南
1011

11-
## 🚀 新增内容
12+
### 1. 更新镜像:
1213

14+
- 更新 FastGPT 镜像
15+
- 更新 FastGPT 商业版镜像
16+
- 更新 fastgpt-plugin 镜像
17+
- mcp_server 无需更新
18+
- Sandbox 无需更新
19+
- AIProxy 无需更新
20+
21+
### 2. 执行升级脚本
22+
23+
该脚本仅需商业版用户执行。
24+
25+
从任意终端,发起 1 个 HTTP 请求。其中 {{rootkey}} 替换成环境变量里的 `rootkey`;{{host}} 替换成**FastGPT 域名**
26+
27+
```bash
28+
curl --location --request POST 'https://{{host}}/api/admin/initv4101' \
29+
--header 'rootkey: {{rootkey}}' \
30+
--header 'Content-Type: application/json'
31+
```
32+
33+
- 给自动同步的知识库加入新的定时任务。
1334

1435
## ⚙️ 优化
1536

16-
1. 定时任务报错日志记录到对话日志
37+
1. 定时任务报错日志记录到对话日志。
38+
2. 封装应用动态form渲染组件。
39+
3. 商业版第三方知识库定时同步,支持全量同步,可以同步整个目录。
40+
4. 目录面包屑导航溢出省略。
1741

1842
## 🐛 修复
1943

20-
1. 搜索类型系统工具无法正常显示
21-
2. 部分系统工具向下兼容问题
44+
1. 搜索类型系统工具无法正常显示
45+
2. 部分系统工具向下兼容问题
2246
3. AI 节点,手动选择历史记录时,会导致 system 记录重复。
47+
4. 知识库 tag 无法滚动到底。
48+
49+
## 🔨 工具更新
50+
51+
1. 新增 Flux 官方绘图工具。
52+
2. 新增 JinaAI 工具集。
53+
3. 新增阿里百炼 Flux 和通义万相绘图。
54+
4. 纠正硅基流动画图工具输出值类型。

docSite/content/zh-cn/docs/development/upgrading/4913.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ weight: 787
3232
1. 对话日志,日期范围选择问题。
3333
2. API 调用时,传入的 system 提示词可能会重复。
3434
3. AI 对话/工具调用,未选择文件链接时,也会从历史记录读取文件。
35-
4. 手动更新知识库索引时,错误的删除旧索引,导致手动索引无效。
35+
4. 手动更新知识库索引时,错误的删除旧索引,导致手动索引无效。

docSite/content/zh-cn/docs/guide/knowledge_base/api_dataset.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type FileListItem = {
4646
parentId: string //也可能为 null 或者 undefined 类型;
4747
name: string;
4848
type: 'file' | 'folder';
49+
hasChild?: boolean; // 是否有子文档(folder 强制为 true)
4950
updateTime: Date;
5051
createTime: Date;
5152
}
@@ -89,6 +90,7 @@ curl --location --request POST '{{baseURL}}/v1/file/list' \
8990
"id": "xxxx",
9091
"parentId": "xxxx",
9192
"type": "file", // file | folder
93+
"hasChild": true, // 是否有子文档(folder 会强制为 true)
9294
"name":"test.json",
9395
"updateTime":"2024-11-26T03:05:24.759Z",
9496
"createTime":"2024-11-26T03:05:24.759Z"
@@ -210,9 +212,13 @@ curl --location --request GET '{{baseURL}}/v1/file/detail?id=xx' \
210212
"success": true,
211213
"message": "",
212214
"data": {
213-
"id": "docs",
214-
"parentId": "",
215-
"name": "docs"
215+
"id": "xxxx",
216+
"parentId": "xxxx",
217+
"type": "file", // file | folder
218+
"hasChild": true, // 是否有子文档(folder 会强制为 true)
219+
"name":"test.json",
220+
"updateTime":"2024-11-26T03:05:24.759Z",
221+
"createTime":"2024-11-26T03:05:24.759Z"
216222
}
217223
}
218224
```

docSite/content/zh-cn/docs/guide/knowledge_base/third_dataset.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ export type YuqueServer = {
4545

4646
### 2. 创建 Hook 文件
4747

48-
每个第三方文档库都会采用 Hook 的方式来实现一套 API 接口的维护,Hook 里包含 4 个函数需要完成。
48+
每个第三方文档库都会采用 Hook 的方式来实现一套 API 接口的维护,Hook 里包含 5 个函数需要完成。
4949

5050
-`FastGPT\packages\service\core\dataset\apiDataset\`下创建一个文档库的文件夹,然后在文件夹下创建一个`api.ts`文件
51-
-`api.ts`文件中,需要完成 4 个函数的定义,分别是:
51+
-`api.ts`文件中,需要完成 5 个函数的定义,分别是:
5252
- `listFiles`:获取文件列表
5353
- `getFileContent`:获取文件内容/文件链接
5454
- `getFileDetail`:获取文件详情信息
5555
- `getFilePreviewUrl`:获取原文预览地址
56+
- `getFileId`: 获取原文件真实Id
5657

5758
### 3. 添加知识库类型
5859

packages/global/common/string/time.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ export const getNextTimeByCronStringAndTimezone = ({
9797
};
9898
const interval = cronParser.parseExpression(cronString, options);
9999
const date = interval.next().toString();
100+
100101
return new Date(date);
101102
} catch (error) {
102-
return new Date('2099');
103+
console.log('getNextTimeByCronStringAndTimezone error', error);
104+
return new Date();
103105
}
104106
};

packages/global/core/app/jsonschema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type JSONSchemaInputType = {
1717
required?: string[];
1818
};
1919

20-
const getNodeInputTypeFromSchemaInputType = ({
20+
export const getNodeInputTypeFromSchemaInputType = ({
2121
type,
2222
arrayItems
2323
}: {

packages/global/core/dataset/api.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import type {
1313
ParagraphChunkAIModeEnum
1414
} from './constants';
1515
import type { ParentIdType } from '../../common/parentFolder/type';
16+
import type { APIFileItemType } from './apiDataset/type';
1617

1718
/* ================= dataset ===================== */
1819
export type DatasetUpdateBody = {
@@ -57,6 +58,7 @@ export type CreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
5758
externalFileId?: string;
5859
externalFileUrl?: string;
5960
apiFileId?: string;
61+
apiFileParentId?: string; //when file is imported by folder, the parentId is the folderId
6062

6163
rawTextLength?: number;
6264
hashRawText?: string;
@@ -65,7 +67,6 @@ export type CreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
6567

6668
createTime?: Date;
6769
updateTime?: Date;
68-
nextSyncTime?: Date;
6970
};
7071

7172
export type ApiCreateDatasetCollectionParams = DatasetCollectionStoreDataType & {
@@ -83,6 +84,9 @@ export type ApiDatasetCreateDatasetCollectionParams = ApiCreateDatasetCollection
8384
name: string;
8485
apiFileId: string;
8586
};
87+
export type ApiDatasetCreateDatasetCollectionV2Params = ApiCreateDatasetCollectionParams & {
88+
apiFiles: APIFileItemType[];
89+
};
8690
export type FileIdCreateDatasetCollectionParams = ApiCreateDatasetCollectionParams & {
8791
fileId: string;
8892
};
@@ -139,7 +143,7 @@ export type PushDatasetDataChunkProps = {
139143
indexes?: Omit<DatasetDataIndexItemType, 'dataId'>[];
140144
};
141145

142-
export type PostWebsiteSyncParams = {
146+
export type PostDatasetSyncParams = {
143147
datasetId: string;
144148
};
145149

packages/global/core/dataset/apiDataset/type.d.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { RequireOnlyOne } from '../../../common/type/utils';
22
import type { ParentIdType } from '../../../common/parentFolder/type';
33

4-
export type APIFileItem = {
4+
export type APIFileItemType = {
55
id: string;
6+
rawId: string;
67
parentId: ParentIdType;
78
name: string;
89
type: 'file' | 'folder';
@@ -36,8 +37,6 @@ export type ApiDatasetServerType = {
3637

3738
// Api dataset api
3839

39-
export type APIFileListResponse = APIFileItem[];
40-
4140
export type ApiFileReadContentResponse = {
4241
title?: string;
4342
rawText: string;
@@ -47,8 +46,4 @@ export type APIFileReadResponse = {
4746
url: string;
4847
};
4948

50-
export type ApiDatasetDetailResponse = {
51-
id: string;
52-
name: string;
53-
parentId: ParentIdType;
54-
};
49+
export type ApiDatasetDetailResponse = APIFileItemType;

packages/global/core/dataset/collection/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ export enum CollectionSourcePrefixEnum {
44
link = 'link',
55
external = 'external'
66
}
7+
8+
export const RootCollectionId = 'SYSTEM_ROOT';

packages/global/core/dataset/type.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ export type DatasetCollectionSchemaType = ChunkSettingsType & {
106106

107107
// Status
108108
forbid?: boolean;
109-
nextSyncTime?: Date;
110109

111110
// Collection metadata
112111
fileId?: string; // local file id
113112
rawLink?: string; // link url
114113
externalFileId?: string; //external file id
115114
apiFileId?: string; // api file id
115+
apiFileParentId?: string;
116116
externalFileUrl?: string; // external import url
117117

118118
rawTextLength?: number;

0 commit comments

Comments
 (0)