+13
-5
lines changedFilter options
+13
-5
lines changed Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import { readFromSecondary } from '../../mongo/utils';
7
7
import { addHours } from 'date-fns';
8
8
import { imageFileType } from '@fastgpt/global/common/file/constants';
9
9
import { retryFn } from '@fastgpt/global/common/system/utils';
10
+
import { UserError } from '@fastgpt/global/common/error/utils';
10
11
11
12
export const maxImgSize = 1024 * 1024 * 12;
12
13
const base64MimeRegex = /data:image\/([^\)]+);base64/;
@@ -105,7 +106,7 @@ export async function readMongoImg({ id }: { id: string }) {
105
106
...readFromSecondary
106
107
});
107
108
if (!data) {
108
-
return Promise.reject('Image not found');
109
+
return Promise.reject(new UserError('Image not found'));
109
110
}
110
111
111
112
return {
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import { proxyError, ERROR_RESPONSE, ERROR_ENUM } from '@fastgpt/global/common/e
4
4
import { addLog } from '../system/log';
5
5
import { clearCookie } from '../../support/permission/controller';
6
6
import { replaceSensitiveText } from '@fastgpt/global/common/string/tools';
7
+
import { UserError } from '@fastgpt/global/common/error/utils';
7
8
8
9
export interface ResponseType<T = any> {
9
10
code: number;
@@ -59,7 +60,11 @@ export const jsonRes = <T = any>(
59
60
msg = error?.error?.message;
60
61
}
61
62
62
-
addLog.error(`Api response error: ${url}, ${msg}`, error);
63
+
if (error instanceof UserError) {
64
+
addLog.info(`Request error: ${url}, ${msg}`);
65
+
} else {
66
+
addLog.error(`System unexpected error: ${url}, ${msg}`, error);
67
+
}
63
68
}
64
69
65
70
res.status(code).json({
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import { setCron } from '../../../common/system/cron';
9
9
import { checkTimerLock } from '../../../common/system/timerLock/utils';
10
10
import { TimerIdEnum } from '../../../common/system/timerLock/constants';
11
11
import { addLog } from '../../../common/system/log';
12
+
import { UserError } from '@fastgpt/global/common/error/utils';
12
13
13
14
const getGridBucket = () => {
14
15
return new connectionMongo.mongo.GridFSBucket(connectionMongo.connection.db!, {
@@ -69,7 +70,7 @@ export const getDatasetImageReadData = async (imageId: string) => {
69
70
_id: new Types.ObjectId(imageId)
70
71
}).lean();
71
72
if (!fileInfo) {
72
-
return Promise.reject('Image not found');
73
+
return Promise.reject(new UserError('Image not found'));
73
74
}
74
75
75
76
const gridBucket = getGridBucket();
@@ -84,7 +85,7 @@ export const getDatasetImageBase64 = async (imageId: string) => {
84
85
_id: new Types.ObjectId(imageId)
85
86
}).lean();
86
87
if (!fileInfo) {
87
-
return Promise.reject('Image not found');
88
+
return Promise.reject(new UserError('Image not found'));
88
89
}
89
90
90
91
// Get image stream from GridFS
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ type RunToolProps = ModuleDispatchProps<{
34
34
35
35
type RunToolResponse = DispatchNodeResultType<
36
36
{
37
-
[NodeOutputKeyEnum.rawResponse]?: any;
37
+
[NodeOutputKeyEnum.rawResponse]?: any; // MCP Tool
38
38
[key: string]: any;
39
39
},
40
40
Record<string, any>
@@ -197,6 +197,7 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo
197
197
198
198
const result = await mcpClient.toolCall(toolName, params);
199
199
return {
200
+
data: { [NodeOutputKeyEnum.rawResponse]: result },
200
201
[DispatchNodeResponseKeyEnum.nodeResponse]: {
201
202
toolRes: result,
202
203
moduleLogo: avatar
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4