chat / client /src /Providers /ToolCallsMapContext.tsx
helloya20's picture
Upload 2345 files
f0743f4 verified
import { createContext, useContext } from 'react';
import useToolCallsMap from '~/hooks/Plugins/useToolCallsMap';
type ToolCallsMapContextType = ReturnType<typeof useToolCallsMap>;
export const ToolCallsMapContext = createContext<ToolCallsMapContextType>(
{} as ToolCallsMapContextType,
);
export const useToolCallsMapContext = () => useContext(ToolCallsMapContext);
interface ToolCallsMapProviderProps {
children: React.ReactNode;
conversationId: string;
}
export function ToolCallsMapProvider({ children, conversationId }: ToolCallsMapProviderProps) {
const toolCallsMap = useToolCallsMap({ conversationId });
return (
<ToolCallsMapContext.Provider value={toolCallsMap}>{children}</ToolCallsMapContext.Provider>
);
}