import { useChatStore, useConnectionStore, useMessageStore, useUserStore } from "@/store"; import { CreatorRole } from "@/types"; import { generateUUID } from "@/utils"; 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: () => Promise; } const EmptyView = (props: Props) => { const { className, sendMessage } = props; const connectionStore = useConnectionStore(); const chatStore = useChatStore(); const userStore = useUserStore(); const messageStore = useMessageStore(); const handleExampleClick = async (content: string) => { let chat = chatStore.currentChat; if (!chat) { const currentConnectionCtx = connectionStore.currentConnectionCtx; if (!currentConnectionCtx) { chat = chatStore.createChat(); } else { chat = chatStore.createChat(currentConnectionCtx.connection.id, currentConnectionCtx.database?.name); } } messageStore.addMessage({ id: generateUUID(), chatId: chat.id, creatorId: userStore.currentUser.id, creatorRole: CreatorRole.User, createdAt: Date.now(), content: content, isGenerated: true, }); await sendMessage(); }; return (

SQLChat

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;