import { useConversationStore, useConnectionStore, useMessageStore } from "@/store"; import useDarkMode from "@/hooks/useDarkmode"; import Icon from "./Icon"; // examples are used to show some examples to the user. const examples = ["Give me an example schema about employee", "How to create a view in MySQL?"]; interface Props { className?: string; sendMessage: (content: string) => Promise; } const EmptyView = (props: Props) => { const { className, sendMessage } = props; const connectionStore = useConnectionStore(); const conversationStore = useConversationStore(); const messageStore = useMessageStore(); const isDarkMode = useDarkMode(); const handleExampleClick = async (content: string) => { let conversation = conversationStore.getConversationById(conversationStore.currentConversationId); if (!conversation) { const currentConnectionCtx = connectionStore.currentConnectionCtx; if (!currentConnectionCtx) { conversation = conversationStore.createConversation(); } else { conversation = conversationStore.createConversation(currentConnectionCtx.connection.id, currentConnectionCtx.database?.name); } } await sendMessage(content); }; return (
sql-chat-logo
Examples {examples.map((example) => (
handleExampleClick(example)} > {`"${example}"`} →
))}
Capabilities
Remembers what user said earlier in the conversation
Allows user to provide follow-up corrections
Limitations
May occasionally generate incorrect information
May occasionally produce harmful instructions or biased content
); }; export default EmptyView;