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
bebe2138
authored
Jul 22, 2025
by
Archer
Committed by
GitHub
Jul 22, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: read file internal (#5282)
parent
5c95fa2b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
25 deletions
+9
-25
packages/service/core/workflow/dispatch/tools/http468.ts
+5
-0
packages/service/core/workflow/dispatch/tools/readFiles.ts
+4
-0
projects/app/src/pages/api/common/system/writefile.ts
+0
-25
No files found.
packages/service/core/workflow/dispatch/tools/http468.ts
View file @
bebe2138
...
@@ -27,6 +27,7 @@ import type { StoreSecretValueType } from '@fastgpt/global/common/secret/type';
...
@@ -27,6 +27,7 @@ import type { StoreSecretValueType } from '@fastgpt/global/common/secret/type';
import
{
addLog
}
from
'../../../../common/system/log'
;
import
{
addLog
}
from
'../../../../common/system/log'
;
import
{
SERVICE_LOCAL_HOST
}
from
'../../../../common/system/tools'
;
import
{
SERVICE_LOCAL_HOST
}
from
'../../../../common/system/tools'
;
import
{
formatHttpError
}
from
'../utils'
;
import
{
formatHttpError
}
from
'../utils'
;
import
{
isInternalAddress
}
from
'../../../../common/system/utils'
;
type
PropsArrType
=
{
type
PropsArrType
=
{
key
:
string
;
key
:
string
;
...
@@ -414,6 +415,10 @@ async function fetchData({
...
@@ -414,6 +415,10 @@ async function fetchData({
params
:
Record
<
string
,
any
>
;
params
:
Record
<
string
,
any
>
;
timeout
:
number
;
timeout
:
number
;
})
{
})
{
if
(
isInternalAddress
(
url
))
{
return
Promise
.
reject
(
'Url is invalid'
);
}
const
{
data
:
response
}
=
await
axios
({
const
{
data
:
response
}
=
await
axios
({
method
,
method
,
baseURL
:
`http://
${
SERVICE_LOCAL_HOST
}
`
,
baseURL
:
`http://
${
SERVICE_LOCAL_HOST
}
`
,
...
...
packages/service/core/workflow/dispatch/tools/readFiles.ts
View file @
bebe2138
...
@@ -15,6 +15,7 @@ import { addLog } from '../../../../common/system/log';
...
@@ -15,6 +15,7 @@ import { addLog } from '../../../../common/system/log';
import
{
addRawTextBuffer
,
getRawTextBuffer
}
from
'../../../../common/buffer/rawText/controller'
;
import
{
addRawTextBuffer
,
getRawTextBuffer
}
from
'../../../../common/buffer/rawText/controller'
;
import
{
addMinutes
}
from
'date-fns'
;
import
{
addMinutes
}
from
'date-fns'
;
import
{
getNodeErrResponse
}
from
'../utils'
;
import
{
getNodeErrResponse
}
from
'../utils'
;
import
{
isInternalAddress
}
from
'../../../../common/system/utils'
;
type
Props
=
ModuleDispatchProps
<
{
type
Props
=
ModuleDispatchProps
<
{
[
NodeInputKeyEnum
.
fileUrlList
]:
string
[];
[
NodeInputKeyEnum
.
fileUrlList
]:
string
[];
...
@@ -175,6 +176,9 @@ export const getFileContentFromLinks = async ({
...
@@ -175,6 +176,9 @@ export const getFileContentFromLinks = async ({
}
}
try
{
try
{
if
(
isInternalAddress
(
url
))
{
return
Promise
.
reject
(
'Url is invalid'
);
}
// Get file buffer data
// Get file buffer data
const
response
=
await
axios
.
get
(
url
,
{
const
response
=
await
axios
.
get
(
url
,
{
baseURL
:
serverRequestBaseUrl
,
baseURL
:
serverRequestBaseUrl
,
...
...
projects/app/src/pages/api/common/system/writefile.ts
deleted
100644 → 0
View file @
5c95fa2b
import
type
{
ApiRequestProps
,
ApiResponseType
}
from
'@fastgpt/service/type/next'
;
import
{
NextAPI
}
from
'@/service/middleware/entry'
;
import
*
as
fs
from
'fs'
;
import
{
authCert
}
from
'@fastgpt/service/support/permission/auth/common'
;
export
type
writefileQuery
=
{};
export
type
writefileBody
=
{
name
:
string
;
content
:
string
;
};
export
type
writefileResponse
=
{};
async
function
handler
(
req
:
ApiRequestProps
<
writefileBody
,
writefileQuery
>
,
res
:
ApiResponseType
<
any
>
):
Promise
<
writefileResponse
>
{
await
authCert
({
req
,
authRoot
:
true
});
const
{
name
,
content
}
=
req
.
body
;
await
fs
.
promises
.
writeFile
(
`public/
${
name
}
`
,
content
);
return
{};
}
export
default
NextAPI
(
handler
);
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