mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
fix(ui): build MCP catalog query options once
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
68d61cc970
commit
85e7e2cd97
1 changed files with 14 additions and 13 deletions
|
|
@ -201,27 +201,28 @@ const MCPToolsViewer = ({
|
|||
},
|
||||
});
|
||||
|
||||
const {
|
||||
data: mcpPromptsResponse,
|
||||
isLoading: isLoadingPrompts,
|
||||
refetch: refetchPrompts,
|
||||
} = useQuery({
|
||||
queryKey: ["mcpPrompts", serverId, passthroughHeaders, oauthToken],
|
||||
queryFn: () => listMCPPrompts(accessToken ?? "", serverId, buildCustomHeaders()),
|
||||
const catalogQueryOptions = <T,>(name: "mcpPrompts" | "mcpResources", fetchCatalog: () => Promise<T>) => ({
|
||||
queryKey: [name, serverId, passthroughHeaders, oauthToken],
|
||||
queryFn: fetchCatalog,
|
||||
enabled: catalogQueriesEnabled,
|
||||
staleTime: 30000,
|
||||
});
|
||||
|
||||
const {
|
||||
data: mcpPromptsResponse,
|
||||
isLoading: isLoadingPrompts,
|
||||
refetch: refetchPrompts,
|
||||
} = useQuery(
|
||||
catalogQueryOptions("mcpPrompts", () => listMCPPrompts(accessToken ?? "", serverId, buildCustomHeaders())),
|
||||
);
|
||||
|
||||
const {
|
||||
data: mcpResourcesResponse,
|
||||
isLoading: isLoadingResources,
|
||||
refetch: refetchResources,
|
||||
} = useQuery({
|
||||
queryKey: ["mcpResources", serverId, passthroughHeaders, oauthToken],
|
||||
queryFn: () => listMCPResources(accessToken ?? "", serverId, buildCustomHeaders()),
|
||||
enabled: catalogQueriesEnabled,
|
||||
staleTime: 30000,
|
||||
});
|
||||
} = useQuery(
|
||||
catalogQueryOptions("mcpResources", () => listMCPResources(accessToken ?? "", serverId, buildCustomHeaders())),
|
||||
);
|
||||
|
||||
const refetchCatalog = useCallback(() => {
|
||||
refetchTools();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue