import type { Meta, StoryObj } from "@storybook/react";
import {
CopilotChatUserMessage,
CopilotChatConfigurationProvider,
type CopilotChatUserMessageProps,
} from "@copilotkit/react-core/v2";
// Simple default message
const simpleMessage = {
id: "simple-user-message",
content: "Hello! Can you help me build a React component?",
timestamp: new Date(),
role: "user" as const,
};
// Longer user message
const longMessage = {
id: "long-user-message",
content: `I need help with creating a complex React component that handles user authentication. Here are my requirements:
1. The component should have login and signup forms
2. It needs to integrate with Firebase Auth
3. Should handle form validation
4. Must be responsive and work on mobile
5. Include forgot password functionality
6. Support social login (Google, GitHub)
Can you help me implement this step by step? I'm particularly struggling with the form validation and state management parts.`,
timestamp: new Date(),
role: "user" as const,
};
// Code-related user message
const codeMessage = {
id: "code-user-message",
content: `I'm getting this error in my React app:
TypeError: Cannot read property 'map' of undefined
The error happens in this component:
function UserList({ users }) {
return (
{users.map(user => (
{user.name}
))}
);
}
How can I fix this?`,
timestamp: new Date(),
role: "user" as const,
};
// Short question
const shortMessage = {
id: "short-user-message",
content: "What's the difference between useState and useReducer?",
timestamp: new Date(),
role: "user" as const,
};
const meta = {
title: "UI/CopilotChatUserMessage",
component: CopilotChatUserMessage,
decorators: [
(Story) => (