@@ -8,7 +8,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
88import MyBox from '@fastgpt/web/components/common/MyBox' ;
99import MyIconButton from '@fastgpt/web/components/common/Icon/button' ;
1010import MyMenu from '@fastgpt/web/components/common/MyMenu' ;
11- import { useState , useMemo , useRef , useEffect , useCallback , useReducer } from 'react' ;
11+ import { useState , useMemo , useRef , useEffect , useCallback } from 'react' ;
1212import { useDebounce , useMount , useSet } from 'ahooks' ;
1313import ToolCard , { type ToolCardItemType } from '@fastgpt/web/components/core/plugin/tool/ToolCard' ;
1414import ToolTagFilterBox from '@fastgpt/web/components/core/plugin/tool/TagFilterBox' ;
@@ -153,18 +153,20 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
153153 // Controler
154154 const { runAsync : handleInstallTool } = useRequest2 (
155155 async ( tool : ToolCardItemType ) => {
156- const downloadUrl = await getMarketplaceDownloadURL ( tool . id ) ;
157- if ( ! downloadUrl ) return ;
158-
159156 const existingPromise = operatingPromisesRef . current . get ( tool . id ) ;
160157 if ( existingPromise ) {
161158 await existingPromise ;
162159 return ;
163160 }
164161
165- const operationPromise = ( async ( ) => {
166- installingOrDeletingToolIdsDispatch . add ( tool . id ) ;
162+ installingOrDeletingToolIdsDispatch . add ( tool . id ) ;
163+ const downloadUrl = await getMarketplaceDownloadURL ( tool . id ) ;
164+ if ( ! downloadUrl ) {
165+ installingOrDeletingToolIdsDispatch . remove ( tool . id ) ;
166+ return ;
167+ }
167168
169+ const operationPromise = ( async ( ) => {
168170 try {
169171 await intallPluginWithUrl ( {
170172 downloadUrls : [ downloadUrl ]
@@ -173,10 +175,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
173175 if ( selectedTool ?. id === tool . id ) {
174176 setSelectedTool ( ( prev ) => ( prev ? { ...prev , status : 3 } : null ) ) ;
175177 }
178+ await refreshInstalledPlugins ( ) ;
176179 } finally {
177180 installingOrDeletingToolIdsDispatch . remove ( tool . id ) ;
178181 operatingPromisesRef . current . delete ( tool . id ) ;
179- await refreshInstalledPlugins ( ) ;
180182 }
181183 } ) ( ) ;
182184 operatingPromisesRef . current . set ( tool . id , operationPromise ) ;
@@ -213,10 +215,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
213215 if ( selectedTool ?. id === tool . id ) {
214216 setSelectedTool ( ( prev ) => ( prev ? { ...prev , status : 3 } : null ) ) ;
215217 }
218+ await refreshInstalledPlugins ( ) ;
216219 } finally {
217220 updatingToolIdsDispatch . remove ( tool . id ) ;
218221 operatingPromisesRef . current . delete ( tool . id ) ;
219- await refreshInstalledPlugins ( ) ;
220222 }
221223 } ) ( ) ;
222224
@@ -243,10 +245,10 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
243245 if ( selectedTool ?. id === tool . id ) {
244246 setSelectedTool ( ( prev ) => ( prev ? { ...prev , status : 1 } : null ) ) ;
245247 }
248+ await refreshInstalledPlugins ( ) ;
246249 } finally {
247250 installingOrDeletingToolIdsDispatch . remove ( tool . id ) ;
248251 operatingPromisesRef . current . delete ( tool . id ) ;
249- await refreshInstalledPlugins ( ) ;
250252 }
251253 } ) ( ) ;
252254 operatingPromisesRef . current . set ( tool . id , operationPromise ) ;
@@ -374,6 +376,7 @@ const ToolkitMarketplace = ({ marketplaceUrl }: { marketplaceUrl: string }) => {
374376 onClick = { ( ) => router . push ( '/config/tool' ) }
375377 position = { 'absolute' }
376378 top = { 4 }
379+ zIndex = { 1000 }
377380 { ...( showCompactSearch ? { right : 4 } : { left : 4 } ) }
378381 />
379382 { ! showCompactSearch && (
0 commit comments