fix: adapt systemTool (#6817)

This commit is contained in:
Archer
2026-04-25 21:37:55 +08:00
committed by GitHub
parent 0c39c7ba81
commit 1c8a47cff7
14 changed files with 163 additions and 63 deletions
@@ -655,6 +655,15 @@ const NodeVersion = React.memo(function NodeVersion({ node }: { node: FlowNodeIt
);
}, [node.isLatestVersion, node?.version, node?.versionLabel, t]);
const ScrollDataWrapper = useCallback(
(props: { children: React.ReactNode }) => (
<ScrollData minH={'100px'} maxH={'40vh'}>
{props.children}
</ScrollData>
),
[ScrollData]
);
return (
<MySelect
className="nowheel"
@@ -667,11 +676,7 @@ const NodeVersion = React.memo(function NodeVersion({ node }: { node: FlowNodeIt
variant={'whitePrimaryOutline'}
size={'sm'}
list={renderVersionList}
ScrollData={(props) => (
<ScrollData minH={'100px'} maxH={'40vh'}>
{props.children}
</ScrollData>
)}
ScrollData={ScrollDataWrapper}
valueLabel={valueLabel}
/>
);
@@ -150,30 +150,28 @@ export const useChatTest = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [variableList]);
const CustomChatContainer = useCallback(
() =>
appDetail.type === AppTypeEnum.workflowTool ? (
<Box p={5} pb={16}>
<PluginRunBox
appId={appId}
chatId={chatId}
onNewChat={restartChat}
onStartChat={startChat}
runtimeFileSelectConfig={chatConfig.fileSelectConfig}
/>
</Box>
) : (
<ChatBox
isReady={isReady}
const CustomChatContainer = useMemoizedFn(() =>
appDetail.type === AppTypeEnum.workflowTool ? (
<Box p={5} pb={16}>
<PluginRunBox
appId={appId}
chatId={chatId}
showMarkIcon
chatType={ChatTypeEnum.test}
enableAutoResume
onNewChat={restartChat}
onStartChat={startChat}
runtimeFileSelectConfig={chatConfig.fileSelectConfig}
/>
),
[appDetail.type, appId, chatId, isReady, restartChat, startChat, chatConfig]
</Box>
) : (
<ChatBox
isReady={isReady}
appId={appId}
chatId={chatId}
showMarkIcon
chatType={ChatTypeEnum.test}
enableAutoResume
onStartChat={startChat}
/>
)
);
return {
@@ -6,7 +6,10 @@ import { type ApiRequestProps } from '@fastgpt/service/type/next';
import { authApp } from '@fastgpt/service/support/permission/app/auth';
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
import { parsePaginationRequest } from '@fastgpt/service/common/api/pagination';
import { getSystemToolByIdAndVersionId } from '@fastgpt/service/core/app/tool/controller';
import {
getSystemToolById,
getSystemToolByIdAndVersionId
} from '@fastgpt/service/core/app/tool/controller';
import { AppToolSourceEnum } from '@fastgpt/global/core/app/tool/constants';
import { PluginErrEnum } from '@fastgpt/global/common/error/code/plugin';
import { Types } from '@fastgpt/service/common/mongo';
@@ -35,7 +38,7 @@ async function handler(
};
}
const { source, pluginId: formatPluginId, authAppId } = splitCombineToolId(pluginId);
const { source, authAppId } = splitCombineToolId(pluginId);
// System tool plugin
if (source === AppToolSourceEnum.systemTool) {
@@ -62,7 +65,13 @@ async function handler(
});
return app._id;
} else {
return formatPluginId;
// Get appId from pluginId
const tool = await getSystemToolById(pluginId);
if (!tool.associatedPluginId) {
return Promise.reject(PluginErrEnum.unExist);
}
return tool.associatedPluginId;
}
})();