UNPKG

@copilotkit/react-ui

Version:

<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />

32 lines (31 loc) 875 B
// src/hooks/use-copilot-chat-suggestions.tsx import { useEffect } from "react"; import { useCopilotContext } from "@copilotkit/react-core"; import { randomId } from "@copilotkit/shared"; function useCopilotChatSuggestions({ available = "enabled", instructions, className, minSuggestions = 1, maxSuggestions = 3 }, dependencies = []) { const context = useCopilotContext(); useEffect(() => { if (available === "disabled") return; const id = randomId(); context.addChatSuggestionConfiguration(id, { instructions, minSuggestions, maxSuggestions, className }); return () => { context.removeChatSuggestionConfiguration(id); }; }, [...dependencies, instructions, minSuggestions, maxSuggestions, className, available]); } export { useCopilotChatSuggestions }; //# sourceMappingURL=chunk-Z4XPPVZT.mjs.map