import type { Meta, StoryObj } from 'storybook-solidjs-vite'; import { createSignal } from 'solid-js'; import { Message, MessageAvatar, MessageContent, MessageActions } from '../components/message'; import { ChatContainer } from '../components/chat-container'; import { ChatConfig } from '../primitives/chat-config'; import { PromptInput, PromptInputTextarea, PromptInputActions } from '../components/prompt-input'; import { Button } from '../ui/button'; import { ScrollButton } from '../components/scroll-button'; import { Copy, ArrowUp } from 'lucide-solid'; const meta: Meta = { title: 'Patterns/Chat Panel Layout', parameters: { layout: 'centered' }, }; export default meta; type Story = StoryObj; const assistantMsg1 = `The document is a transcript of a YouTube video by Cole Medin, where he discusses building a self-evolving memory system for coding agents using Large Language Models (LLMs), inspired by Andre Karpathy's ideas on LLM knowledge bases.`; const assistantMsg2 = `Short answer: **it has to be a separate browser window** (or tab/iframe), not just a normal component in your application. Here's why: - The OAuth flow requires redirecting to the provider's login page - The callback URL needs to be a real URL the browser can navigate to - Security policies prevent embedding auth pages in iframes`; const userMsg1 = 'What is this video about?'; const userMsg2 = 'And from what I understand, does that need to be another browser window pop-up that happens, or can I just have a component that does that in my application?'; function CopyButton(props: { text: string }) { return ( ); } /** * Reference layout — uses variant props, no custom class overrides. */ export const ChatGPTStyle: Story = { render: () => { const [input, setInput] = createSignal(''); return (
{/* Header */}
Chat Panel GPT-4o Mini
{/* Messages */} {/* Assistant message 1 — with avatar */}
{assistantMsg1}
{/* User message 1 */} {userMsg1} {/* Assistant message 2 — with avatar, markdown */}
{assistantMsg2}
{/* User message 2 — longer */} {userMsg2} {/* Assistant message 3 — with avatar, short */}
Got it — let me know if you have more questions!
{/* Input */}
setInput('')} >
); }, };