mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-09 20:18:50 +01:00
wip: needs to be pared down so much, but is functional and relatively robust
This commit is contained in:
parent
94c329680f
commit
dd8a9d5d45
27 changed files with 1767 additions and 285 deletions
|
|
@ -40,3 +40,76 @@ export const useGetToolCalls = <TData = t.ToolCallResults>(
|
|||
},
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook for getting MCP connection status
|
||||
*/
|
||||
export const useMCPConnectionStatusQuery = <TData = t.TMCPConnectionStatusResponse>(
|
||||
config?: UseQueryOptions<t.TMCPConnectionStatusResponse, unknown, TData>,
|
||||
): QueryObserverResult<TData, unknown> => {
|
||||
return useQuery<t.TMCPConnectionStatusResponse, unknown, TData>(
|
||||
[QueryKeys.mcpConnectionStatus],
|
||||
() => dataService.getMCPConnectionStatus(),
|
||||
{
|
||||
// refetchOnWindowFocus: false,
|
||||
// refetchOnReconnect: false,
|
||||
// refetchOnMount: true,
|
||||
...config,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook for getting MCP auth value flags for a specific server
|
||||
*/
|
||||
export const useMCPAuthValuesQuery = (
|
||||
serverName: string,
|
||||
config?: UseQueryOptions<
|
||||
{ success: boolean; serverName: string; authValueFlags: Record<string, boolean> },
|
||||
unknown,
|
||||
{ success: boolean; serverName: string; authValueFlags: Record<string, boolean> }
|
||||
>,
|
||||
): QueryObserverResult<
|
||||
{ success: boolean; serverName: string; authValueFlags: Record<string, boolean> },
|
||||
unknown
|
||||
> => {
|
||||
return useQuery<
|
||||
{ success: boolean; serverName: string; authValueFlags: Record<string, boolean> },
|
||||
unknown,
|
||||
{ success: boolean; serverName: string; authValueFlags: Record<string, boolean> }
|
||||
>([QueryKeys.mcpAuthValues, serverName], () => dataService.getMCPAuthValues(serverName), {
|
||||
// refetchOnWindowFocus: false,
|
||||
// refetchOnReconnect: false,
|
||||
// refetchOnMount: true,
|
||||
enabled: !!serverName,
|
||||
...config,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Hook for getting MCP OAuth status for a specific flow
|
||||
*/
|
||||
export const useMCPOAuthStatusQuery = (
|
||||
flowId: string,
|
||||
config?: UseQueryOptions<
|
||||
{ status: string; completed: boolean; failed: boolean; error?: string },
|
||||
unknown,
|
||||
{ status: string; completed: boolean; failed: boolean; error?: string }
|
||||
>,
|
||||
): QueryObserverResult<
|
||||
{ status: string; completed: boolean; failed: boolean; error?: string },
|
||||
unknown
|
||||
> => {
|
||||
return useQuery<
|
||||
{ status: string; completed: boolean; failed: boolean; error?: string },
|
||||
unknown,
|
||||
{ status: string; completed: boolean; failed: boolean; error?: string }
|
||||
>([QueryKeys.mcpOAuthStatus, flowId], () => dataService.getMCPOAuthStatus(flowId), {
|
||||
refetchOnWindowFocus: false,
|
||||
refetchOnReconnect: false,
|
||||
refetchOnMount: true,
|
||||
staleTime: 1000, // Consider data stale after 1 second for polling
|
||||
enabled: !!flowId,
|
||||
...config,
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue