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
37648d5c
authored
Aug 05, 2025
by
Archer
Committed by
GitHub
Aug 05, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: mcp not response output (#5388)
parent
f870a2de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
5 deletions
+13
-5
packages/service/common/file/image/controller.ts
+2
-1
packages/service/common/response/index.ts
+6
-1
packages/service/core/dataset/image/controller.ts
+3
-2
packages/service/core/workflow/dispatch/child/runTool.ts
+2
-1
No files found.
packages/service/common/file/image/controller.ts
View file @
37648d5c
...
...
@@ -7,6 +7,7 @@ import { readFromSecondary } from '../../mongo/utils';
import
{
addHours
}
from
'date-fns'
;
import
{
imageFileType
}
from
'@fastgpt/global/common/file/constants'
;
import
{
retryFn
}
from
'@fastgpt/global/common/system/utils'
;
import
{
UserError
}
from
'@fastgpt/global/common/error/utils'
;
export
const
maxImgSize
=
1024
*
1024
*
12
;
const
base64MimeRegex
=
/data:image
\/([^\)]
+
)
;base64/
;
...
...
@@ -105,7 +106,7 @@ export async function readMongoImg({ id }: { id: string }) {
...readFromSecondary
});
if (!data) {
return Promise.reject(
'Image not found'
);
return Promise.reject(
new UserError('Image not found')
);
}
return {
...
...
packages/service/common/response/index.ts
View file @
37648d5c
...
...
@@ -4,6 +4,7 @@ import { proxyError, ERROR_RESPONSE, ERROR_ENUM } from '@fastgpt/global/common/e
import
{
addLog
}
from
'../system/log'
;
import
{
clearCookie
}
from
'../../support/permission/controller'
;
import
{
replaceSensitiveText
}
from
'@fastgpt/global/common/string/tools'
;
import
{
UserError
}
from
'@fastgpt/global/common/error/utils'
;
export
interface
ResponseType
<
T
=
any
>
{
code
:
number
;
...
...
@@ -59,7 +60,11 @@ export const jsonRes = <T = any>(
msg
=
error
?.
error
?.
message
;
}
addLog
.
error
(
`Api response error:
${
url
}
,
${
msg
}
`
,
error
);
if
(
error
instanceof
UserError
)
{
addLog
.
info
(
`Request error:
${
url
}
,
${
msg
}
`
);
}
else
{
addLog
.
error
(
`System unexpected error:
${
url
}
,
${
msg
}
`
,
error
);
}
}
res
.
status
(
code
).
json
({
...
...
packages/service/core/dataset/image/controller.ts
View file @
37648d5c
...
...
@@ -9,6 +9,7 @@ import { setCron } from '../../../common/system/cron';
import
{
checkTimerLock
}
from
'../../../common/system/timerLock/utils'
;
import
{
TimerIdEnum
}
from
'../../../common/system/timerLock/constants'
;
import
{
addLog
}
from
'../../../common/system/log'
;
import
{
UserError
}
from
'@fastgpt/global/common/error/utils'
;
const
getGridBucket
=
()
=>
{
return
new
connectionMongo
.
mongo
.
GridFSBucket
(
connectionMongo
.
connection
.
db
!
,
{
...
...
@@ -69,7 +70,7 @@ export const getDatasetImageReadData = async (imageId: string) => {
_id
:
new
Types
.
ObjectId
(
imageId
)
}).
lean
();
if
(
!
fileInfo
)
{
return
Promise
.
reject
(
'Image not found'
);
return
Promise
.
reject
(
new
UserError
(
'Image not found'
)
);
}
const
gridBucket
=
getGridBucket
();
...
...
@@ -84,7 +85,7 @@ export const getDatasetImageBase64 = async (imageId: string) => {
_id
:
new
Types
.
ObjectId
(
imageId
)
}).
lean
();
if
(
!
fileInfo
)
{
return
Promise
.
reject
(
'Image not found'
);
return
Promise
.
reject
(
new
UserError
(
'Image not found'
)
);
}
// Get image stream from GridFS
...
...
packages/service/core/workflow/dispatch/child/runTool.ts
View file @
37648d5c
...
...
@@ -34,7 +34,7 @@ type RunToolProps = ModuleDispatchProps<{
type
RunToolResponse
=
DispatchNodeResultType
<
{
[
NodeOutputKeyEnum
.
rawResponse
]?:
any
;
[
NodeOutputKeyEnum
.
rawResponse
]?:
any
;
// MCP Tool
[
key
:
string
]:
any
;
},
Record
<
string
,
any
>
...
...
@@ -197,6 +197,7 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo
const
result
=
await
mcpClient
.
toolCall
(
toolName
,
params
);
return
{
data
:
{
[
NodeOutputKeyEnum
.
rawResponse
]:
result
},
[
DispatchNodeResponseKeyEnum
.
nodeResponse
]:
{
toolRes
:
result
,
moduleLogo
:
avatar
...
...
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