Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
7494ce84
authored
Jun 08, 2025
by
Archer
Committed by
GitHub
Jun 08, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: async read file (#4978)
* perf: async read file * package * doc
parent
18800825
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
32 deletions
+37
-32
packages/service/core/ai/config/utils.ts
+1
-1
packages/service/worker/readFile/extension/csv.ts
+1
-1
packages/service/worker/readFile/extension/html.ts
+1
-1
packages/service/worker/readFile/extension/rawText.ts
+4
-1
packages/templates/register.ts
+2
-2
pnpm-lock.yaml
+4
-4
projects/app/package.json
+1
-1
projects/app/public/docs/versionIntro.md
+18
-16
projects/app/src/pageComponents/dashboard/apps/CreateModal.tsx
+5
-5
No files found.
packages/service/core/ai/config/utils.ts
View file @
7494ce84
...
@@ -103,7 +103,7 @@ export const loadSystemModels = async (init = false) => {
...
@@ -103,7 +103,7 @@ export const loadSystemModels = async (init = false) => {
// Load system model from local
// Load system model from local
const
modelsPath
=
getModelConfigBaseUrl
();
const
modelsPath
=
getModelConfigBaseUrl
();
const
providerList
=
fs
.
readdirSync
(
modelsPath
)
as
string
[]
;
const
providerList
=
await
fs
.
promises
.
readdir
(
modelsPath
)
;
await
Promise
.
all
(
await
Promise
.
all
(
providerList
.
map
(
async
(
name
)
=>
{
providerList
.
map
(
async
(
name
)
=>
{
const
fileContent
=
(
await
import
(
`./provider/
${
name
}
`
))?.
default
as
{
const
fileContent
=
(
await
import
(
`./provider/
${
name
}
`
))?.
default
as
{
...
...
packages/service/worker/readFile/extension/csv.ts
View file @
7494ce84
...
@@ -4,7 +4,7 @@ import { readFileRawText } from './rawText';
...
@@ -4,7 +4,7 @@ import { readFileRawText } from './rawText';
// 加载源文件内容
// 加载源文件内容
export
const
readCsvRawText
=
async
(
params
:
ReadRawTextByBuffer
):
Promise
<
ReadFileResponse
>
=>
{
export
const
readCsvRawText
=
async
(
params
:
ReadRawTextByBuffer
):
Promise
<
ReadFileResponse
>
=>
{
const
{
rawText
}
=
readFileRawText
(
params
);
const
{
rawText
}
=
await
readFileRawText
(
params
);
const
csvArr
=
Papa
.
parse
(
rawText
).
data
as
string
[][];
const
csvArr
=
Papa
.
parse
(
rawText
).
data
as
string
[][];
...
...
packages/service/worker/readFile/extension/html.ts
View file @
7494ce84
...
@@ -3,7 +3,7 @@ import { readFileRawText } from './rawText';
...
@@ -3,7 +3,7 @@ import { readFileRawText } from './rawText';
import
{
html2md
}
from
'../../htmlStr2Md/utils'
;
import
{
html2md
}
from
'../../htmlStr2Md/utils'
;
export
const
readHtmlRawText
=
async
(
params
:
ReadRawTextByBuffer
):
Promise
<
ReadFileResponse
>
=>
{
export
const
readHtmlRawText
=
async
(
params
:
ReadRawTextByBuffer
):
Promise
<
ReadFileResponse
>
=>
{
const
{
rawText
:
html
}
=
readFileRawText
(
params
);
const
{
rawText
:
html
}
=
await
readFileRawText
(
params
);
const
{
rawText
,
imageList
}
=
html2md
(
html
);
const
{
rawText
,
imageList
}
=
html2md
(
html
);
...
...
packages/service/worker/readFile/extension/rawText.ts
View file @
7494ce84
...
@@ -18,7 +18,10 @@ const rawEncodingList = [
...
@@ -18,7 +18,10 @@ const rawEncodingList = [
];
];
// 加载源文件内容
// 加载源文件内容
export
const
readFileRawText
=
({
buffer
,
encoding
}:
ReadRawTextByBuffer
):
ReadFileResponse
=>
{
export
const
readFileRawText
=
async
({
buffer
,
encoding
}:
ReadRawTextByBuffer
):
Promise
<
ReadFileResponse
>
=>
{
const
content
=
(()
=>
{
const
content
=
(()
=>
{
try
{
try
{
if
(
rawEncodingList
.
includes
(
encoding
))
{
if
(
rawEncodingList
.
includes
(
encoding
))
{
...
...
packages/templates/register.ts
View file @
7494ce84
...
@@ -14,11 +14,11 @@ const getTemplateNameList = () => {
...
@@ -14,11 +14,11 @@ const getTemplateNameList = () => {
);
);
const
templatesPath
=
path
.
join
(
path
.
dirname
(
filePath
),
'src'
);
const
templatesPath
=
path
.
join
(
path
.
dirname
(
filePath
),
'src'
);
return
fs
.
readdirSync
(
templatesPath
)
as
string
[]
;
return
fs
.
promises
.
readdir
(
templatesPath
)
;
};
};
const
getFileTemplates
=
async
():
Promise
<
AppTemplateSchemaType
[]
>
=>
{
const
getFileTemplates
=
async
():
Promise
<
AppTemplateSchemaType
[]
>
=>
{
const
templateNames
=
getTemplateNameList
();
const
templateNames
=
await
getTemplateNameList
();
return
Promise
.
all
(
return
Promise
.
all
(
templateNames
.
map
<
Promise
<
AppTemplateSchemaType
>>
(
async
(
name
)
=>
{
templateNames
.
map
<
Promise
<
AppTemplateSchemaType
>>
(
async
(
name
)
=>
{
...
...
pnpm-lock.yaml
View file @
7494ce84
...
@@ -15142,7 +15142,7 @@ snapshots:
...
@@ -15142,7 +15142,7 @@ snapshots:
transitivePeerDependencies
:
transitivePeerDependencies
:
-
supports-color
-
supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.56.0)
:
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0
(eslint-plugin-import@2.31.0)(eslint@8.56.0)
)(eslint@8.56.0)
:
dependencies
:
dependencies
:
debug
:
3.2.7
debug
:
3.2.7
optionalDependencies
:
optionalDependencies
:
...
@@ -15153,7 +15153,7 @@ snapshots:
...
@@ -15153,7 +15153,7 @@ snapshots:
transitivePeerDependencies
:
transitivePeerDependencies
:
-
supports-color
-
supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.57.1)
:
eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0
(eslint-plugin-import@2.31.0)(eslint@8.57.1)
)(eslint@8.57.1)
:
dependencies
:
dependencies
:
debug
:
3.2.7
debug
:
3.2.7
optionalDependencies
:
optionalDependencies
:
...
@@ -15175,7 +15175,7 @@ snapshots:
...
@@ -15175,7 +15175,7 @@ snapshots:
doctrine
:
2.1.0
doctrine
:
2.1.0
eslint
:
8.56.0
eslint
:
8.56.0
eslint-import-resolver-node
:
0.3.9
eslint-import-resolver-node
:
0.3.9
eslint-module-utils
:
2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.56.0)
eslint-module-utils
:
2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.56.0)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0
(eslint-plugin-import@2.31.0)(eslint@8.56.0)
)(eslint@8.56.0)
hasown
:
2.0.2
hasown
:
2.0.2
is-core-module
:
2.16.1
is-core-module
:
2.16.1
is-glob
:
4.0.3
is-glob
:
4.0.3
...
@@ -15204,7 +15204,7 @@ snapshots:
...
@@ -15204,7 +15204,7 @@ snapshots:
doctrine
:
2.1.0
doctrine
:
2.1.0
eslint
:
8.57.1
eslint
:
8.57.1
eslint-import-resolver-node
:
0.3.9
eslint-import-resolver-node
:
0.3.9
eslint-module-utils
:
2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0)(eslint@8.57.1)
eslint-module-utils
:
2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.8.2))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.9.0
(eslint-plugin-import@2.31.0)(eslint@8.57.1)
)(eslint@8.57.1)
hasown
:
2.0.2
hasown
:
2.0.2
is-core-module
:
2.16.1
is-core-module
:
2.16.1
is-glob
:
4.0.3
is-glob
:
4.0.3
...
...
projects/app/package.json
View file @
7494ce84
{
{
"name"
:
"
app
"
,
"name"
:
"
app
"
,
"version"
:
"4.9.1
0
"
,
"version"
:
"4.9.1
1
"
,
"private"
:
false
,
"private"
:
false
,
"scripts"
:
{
"scripts"
:
{
"dev"
:
"next dev"
,
"dev"
:
"next dev"
,
...
...
projects/app/public/docs/versionIntro.md
View file @
7494ce84
### FastGPT V4.9.
0
更新说明
### FastGPT V4.9.
11
更新说明
##
## 弃用 & 兼
容
##
🚀 新增内
容
1.
弃用 - 之前私有化部署的自定义文件解析方案,请同步更新到最新的配置方案。
[
点击查看 PDF 增强解析配置
](
/docs/development/configuration/#使用-doc2x-解析-pdf-文件
)
1.
支持图片知识库。
2.
弃用 - 弃用旧版本地文件上传 API:/api/core/dataset/collection/create/file(以前仅商业版可用的 API,该接口已放切换成:/api/core/dataset/collection/create/localFile)
2.
工作流中增加节点搜索功能。
3.
停止维护,即将弃用 - 外部文件库相关 API,可通过 API 文件库替代。
3.
工作流中,子流程版本控制,可选择“保持最新版本”,无需手动更新。
4.
API更新 - 上传文件至知识库、创建连接集合、API 文件库、推送分块数据等带有
`trainingType`
字段的接口,
`trainingType`
字段未来仅支持
`chunk`
和
`QA`
两种模式。增强索引模式将设置单独字段:
`autoIndexes`
,目前仍有适配旧版
`trainingType=auto`
代码,但请尽快变更成新接口类型。具体可见:
[
知识库 OpenAPI 文档
](
/docs/development/openapi/dataset.md
)
4.
增加更多审计操作日志。
5.
知识库增加文档解析异步队列,导入文档时,无需等待文档解析完毕才进行导入。
##
## 功能更新
##
⚙️ 优化
1.
新增 - PDF 增强解析,可以识别图片、公式、扫描件,并将内容转化成 Markdown 格式。
1.
原文缓存改用 gridfs 存储,提高上限。
2.
新增 - 支持对文档中的图片链接,进行图片索引,提高图片内容的检索精度。
3.
新增 - 语义检索增加迭代搜索,减少漏检。
4.
优化 - 知识库数据不再限制索引数量,可无限自定义。同时可自动更新输入文本的索引,不影响自定义索引。
5.
优化 - Markdown 解析,增加链接后中文标点符号检测,增加空格。
6.
优化 - Prompt 模式工具调用,支持思考模型。同时优化其格式检测,减少空输出的概率。
7.
优化 - 优化文件读取代码,极大提高大文件读取速度。50M PDF 读取时间提高 3 倍。
8.
优化 - HTTP Body 适配,增加对字符串对象的适配。
9.
修复 - 批量运行时,全局变量未进一步传递到下一次运行中,导致最终变量更新错误。
## 🐛 修复
1.
工作流中,管理员声明的全局系统工具,无法进行版本管理。
2.
工具调用节点前,有交互节点时,上下文异常。
3.
修复备份导入,小于 1000 字时,无法分块问题。
4.
自定义 PDF 解析,无法保存 base64 图片。
5.
非流请求,未进行 CITE 标记替换。
6.
Python 沙盒存在隐藏风险。
\ No newline at end of file
projects/app/src/pageComponents/dashboard/apps/CreateModal.tsx
View file @
7494ce84
...
@@ -305,21 +305,21 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
...
@@ -305,21 +305,21 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
w=
{
'560px'
}
w=
{
'560px'
}
h=
{
'260px'
}
h=
{
'260px'
}
bg=
{
'myGray.50'
}
bg=
{
'myGray.50'
}
{
...
register
('
curlContent
')}
{
...
register
('
curlContent
'
,
{
required
:
true
}
)}
/>
/>
</
Box
>
</
Box
>
)
}
)
}
</
ModalBody
>
</
ModalBody
>
<
ModalFooter
gap=
{
4
}
>
<
ModalFooter
gap=
{
4
}
>
{
!
isTemplateMode
&&
(
<
Button
variant=
{
'whiteBase'
}
onClick=
{
onClose
}
>
{
t
(
'common:Close'
)
}
</
Button
>
{
currentCreateType
===
'curl'
&&
(
<
Button
variant=
{
'primary'
}
onClick=
{
handleSubmit
((
data
)
=>
onclickCreate
(
data
))
}
>
<
Button
variant=
{
'primary'
}
onClick=
{
handleSubmit
((
data
)
=>
onclickCreate
(
data
))
}
>
{
t
(
'common:Confirm'
)
}
{
t
(
'common:Confirm'
)
}
</
Button
>
</
Button
>
)
}
)
}
<
Button
variant=
{
'whiteBase'
}
onClick=
{
onClose
}
>
{
t
(
'common:Close'
)
}
</
Button
>
</
ModalFooter
>
</
ModalFooter
>
<
File
<
File
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment