fix: update refresh logic for plugin list to avoid redundant request and fix model provider list update issue in settings (#14152)

This commit is contained in:
Wu Tianwei
2025-02-24 10:49:43 +08:00
committed by GitHub
parent 2ace9ae4e4
commit 3942e45cab
2 changed files with 18 additions and 10 deletions

View File

@@ -23,17 +23,15 @@ const useRefreshPluginList = () => {
// installed list
invalidateInstalledPluginList()
if (!manifest) return
// tool page, tool select
if (PluginType.tool.includes(manifest.category) || refreshAllType) {
if ((manifest && PluginType.tool.includes(manifest.category)) || refreshAllType) {
invalidateAllToolProviders()
invalidateAllBuiltInTools()
// TODO: update suggested tools. It's a function in hook useMarketplacePlugins,handleUpdatePlugins
}
// model select
if (PluginType.model.includes(manifest.category) || refreshAllType) {
if ((manifest && PluginType.model.includes(manifest.category)) || refreshAllType) {
refreshModelProviders()
refetchLLMModelList()
refetchEmbeddingModelList()
@@ -41,7 +39,7 @@ const useRefreshPluginList = () => {
}
// agent select
if (PluginType.agent.includes(manifest.category) || refreshAllType)
if ((manifest && PluginType.agent.includes(manifest.category)) || refreshAllType)
invalidateStrategyProviders()
},
}