UNPKG

@copilotkit/react-core

Version:

<div align="center"> <a href="https://copilotkit.ai" target="_blank"> <img src="https://github.com/copilotkit/copilotkit/raw/main/assets/banner.png" alt="CopilotKit Logo"> </a>

24 lines (22 loc) 861 B
import { useCopilotContext } from "./chunk-PTSWFERP.mjs"; // src/hooks/use-copilot-additional-instructions.ts import { useEffect } from "react"; function useCopilotAdditionalInstructions({ instructions, available = "enabled" }, dependencies) { const { setAdditionalInstructions } = useCopilotContext(); useEffect(() => { if (available === "disabled") return; setAdditionalInstructions((prevInstructions) => [...prevInstructions || [], instructions]); return () => { setAdditionalInstructions( (prevInstructions) => (prevInstructions == null ? void 0 : prevInstructions.filter((instruction) => instruction !== instructions)) || [] ); }; }, [available, instructions, setAdditionalInstructions, ...dependencies || []]); } export { useCopilotAdditionalInstructions }; //# sourceMappingURL=chunk-O3IIH54P.mjs.map