Commit 1127c1cf by Finley Ge Committed by GitHub

perf: tool invoke log (#7061)

* fix: workflow system tool use pluginModule

* fix: zip upload cancel && bump plugin sdk version

* pref(tool):invoke tool log
parent 8c6ddb46
...@@ -22,6 +22,7 @@ import type { RequireOnlyOne } from '@fastgpt/global/common/type/utils'; ...@@ -22,6 +22,7 @@ import type { RequireOnlyOne } from '@fastgpt/global/common/type/utils';
import { pluginClient } from '../../../../../../../thirdProvider/fastgptPlugin'; import { pluginClient } from '../../../../../../../thirdProvider/fastgptPlugin';
import { SystemToolRepo } from '../../../../../../app/tool/systemTool/systemTool.repo'; import { SystemToolRepo } from '../../../../../../app/tool/systemTool/systemTool.repo';
import { InvokeProcessor } from '../../../../../../../support/invoke/invoke'; import { InvokeProcessor } from '../../../../../../../support/invoke/invoke';
import { getLogger, LogCategories } from '../../../../../../../common/logger';
type SystemInputConfigType = { type SystemInputConfigType = {
type: SystemToolSecretInputTypeEnum; type: SystemToolSecretInputTypeEnum;
...@@ -81,6 +82,8 @@ export const dispatchTool = async ({ ...@@ -81,6 +82,8 @@ export const dispatchTool = async ({
}; };
}; };
const logger = getLogger(LogCategories.MODULE.APP.TOOL);
try { try {
if (toolConfig?.systemTool?.toolId) { if (toolConfig?.systemTool?.toolId) {
const systemToolRepo = SystemToolRepo.getInstance(); const systemToolRepo = SystemToolRepo.getInstance();
...@@ -152,6 +155,7 @@ export const dispatchTool = async ({ ...@@ -152,6 +155,7 @@ export const dispatchTool = async ({
const result: any = res.output || {}; const result: any = res.output || {};
if (res.error) { if (res.error) {
logger.error('Call tool error', { error: res.error });
return getErrResponse(res.error); return getErrResponse(res.error);
} }
...@@ -282,6 +286,7 @@ export const dispatchTool = async ({ ...@@ -282,6 +286,7 @@ export const dispatchTool = async ({
msg: getErrText(error) msg: getErrText(error)
}); });
} }
logger.error('Call tool error', { error });
return getErrResponse(error); return getErrResponse(error);
} }
}; };
...@@ -23,6 +23,7 @@ import { getToolRawId } from '@fastgpt/global/core/app/tool/utils'; ...@@ -23,6 +23,7 @@ import { getToolRawId } from '@fastgpt/global/core/app/tool/utils';
import { pluginClient } from '../../../../thirdProvider/fastgptPlugin'; import { pluginClient } from '../../../../thirdProvider/fastgptPlugin';
import { SystemToolRepo } from '../../../app/tool/systemTool/systemTool.repo'; import { SystemToolRepo } from '../../../app/tool/systemTool/systemTool.repo';
import { InvokeProcessor } from '../../../../support/invoke/invoke'; import { InvokeProcessor } from '../../../../support/invoke/invoke';
import { getLogger, LogCategories } from '../../../../common/logger';
type SystemInputConfigType = { type SystemInputConfigType = {
type: SystemToolSecretInputTypeEnum; type: SystemToolSecretInputTypeEnum;
...@@ -53,6 +54,7 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo ...@@ -53,6 +54,7 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo
node: { name, avatar, toolConfig, version, catchError } node: { name, avatar, toolConfig, version, catchError }
} = props; } = props;
const cTime = String(variableState.get('cTime') ?? ''); const cTime = String(variableState.get('cTime') ?? '');
const logger = getLogger(LogCategories.MODULE.APP.TOOL);
const { const {
uid: uId, uid: uId,
...@@ -152,6 +154,7 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo ...@@ -152,6 +154,7 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo
}; };
} }
logger.error('Tool Run Error', { error: res.error });
throw res.error; throw res.error;
} }
...@@ -327,6 +330,8 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo ...@@ -327,6 +330,8 @@ export const dispatchRunTool = async (props: RunToolProps): Promise<RunToolRespo
}); });
} }
logger.error('Tool Run Error', { error });
return getNodeErrResponse({ return getNodeErrResponse({
error, error,
[DispatchNodeResponseKeyEnum.nodeResponse]: { [DispatchNodeResponseKeyEnum.nodeResponse]: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment