Repository: stackblitz/bolt.new Branch: main Commit: eda10b121221 Files: 129 Total size: 281.1 KB Directory structure: gitextract_pf42qdrs/ ├── .editorconfig ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.yml │ │ ├── config.yml │ │ └── feature_request.md │ ├── actions/ │ │ └── setup-and-build/ │ │ └── action.yaml │ └── workflows/ │ ├── ci.yaml │ └── semantic-pr.yaml ├── .gitignore ├── .husky/ │ └── commit-msg ├── .prettierignore ├── .prettierrc ├── .tool-versions ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── app/ │ ├── components/ │ │ ├── chat/ │ │ │ ├── Artifact.tsx │ │ │ ├── AssistantMessage.tsx │ │ │ ├── BaseChat.module.scss │ │ │ ├── BaseChat.tsx │ │ │ ├── Chat.client.tsx │ │ │ ├── CodeBlock.module.scss │ │ │ ├── CodeBlock.tsx │ │ │ ├── Markdown.module.scss │ │ │ ├── Markdown.tsx │ │ │ ├── Messages.client.tsx │ │ │ ├── SendButton.client.tsx │ │ │ └── UserMessage.tsx │ │ ├── editor/ │ │ │ └── codemirror/ │ │ │ ├── BinaryContent.tsx │ │ │ ├── CodeMirrorEditor.tsx │ │ │ ├── cm-theme.ts │ │ │ ├── indent.ts │ │ │ └── languages.ts │ │ ├── header/ │ │ │ ├── Header.tsx │ │ │ └── HeaderActionButtons.client.tsx │ │ ├── sidebar/ │ │ │ ├── HistoryItem.tsx │ │ │ ├── Menu.client.tsx │ │ │ └── date-binning.ts │ │ ├── ui/ │ │ │ ├── Dialog.tsx │ │ │ ├── IconButton.tsx │ │ │ ├── LoadingDots.tsx │ │ │ ├── PanelHeader.tsx │ │ │ ├── PanelHeaderButton.tsx │ │ │ ├── Slider.tsx │ │ │ └── ThemeSwitch.tsx │ │ └── workbench/ │ │ ├── EditorPanel.tsx │ │ ├── FileBreadcrumb.tsx │ │ ├── FileTree.tsx │ │ ├── PortDropdown.tsx │ │ ├── Preview.tsx │ │ ├── Workbench.client.tsx │ │ └── terminal/ │ │ ├── Terminal.tsx │ │ └── theme.ts │ ├── entry.client.tsx │ ├── entry.server.tsx │ ├── lib/ │ │ ├── .server/ │ │ │ └── llm/ │ │ │ ├── api-key.ts │ │ │ ├── constants.ts │ │ │ ├── model.ts │ │ │ ├── prompts.ts │ │ │ ├── stream-text.ts │ │ │ └── switchable-stream.ts │ │ ├── crypto.ts │ │ ├── fetch.ts │ │ ├── hooks/ │ │ │ ├── index.ts │ │ │ ├── useMessageParser.ts │ │ │ ├── usePromptEnhancer.ts │ │ │ ├── useShortcuts.ts │ │ │ └── useSnapScroll.ts │ │ ├── persistence/ │ │ │ ├── ChatDescription.client.tsx │ │ │ ├── db.ts │ │ │ ├── index.ts │ │ │ └── useChatHistory.ts │ │ ├── runtime/ │ │ │ ├── __snapshots__/ │ │ │ │ └── message-parser.spec.ts.snap │ │ │ ├── action-runner.ts │ │ │ ├── message-parser.spec.ts │ │ │ └── message-parser.ts │ │ ├── stores/ │ │ │ ├── chat.ts │ │ │ ├── editor.ts │ │ │ ├── files.ts │ │ │ ├── previews.ts │ │ │ ├── settings.ts │ │ │ ├── terminal.ts │ │ │ ├── theme.ts │ │ │ └── workbench.ts │ │ └── webcontainer/ │ │ ├── auth.client.ts │ │ └── index.ts │ ├── root.tsx │ ├── routes/ │ │ ├── _index.tsx │ │ ├── api.chat.ts │ │ ├── api.enhancer.ts │ │ └── chat.$id.tsx │ ├── styles/ │ │ ├── animations.scss │ │ ├── components/ │ │ │ ├── code.scss │ │ │ ├── editor.scss │ │ │ ├── resize-handle.scss │ │ │ ├── terminal.scss │ │ │ └── toast.scss │ │ ├── index.scss │ │ ├── variables.scss │ │ └── z-index.scss │ ├── types/ │ │ ├── actions.ts │ │ ├── artifact.ts │ │ ├── terminal.ts │ │ └── theme.ts │ └── utils/ │ ├── buffer.ts │ ├── classNames.ts │ ├── constants.ts │ ├── debounce.ts │ ├── diff.ts │ ├── easings.ts │ ├── logger.ts │ ├── markdown.ts │ ├── mobile.ts │ ├── promises.ts │ ├── react.ts │ ├── shell.ts │ ├── stripIndent.ts │ ├── terminal.ts │ └── unreachable.ts ├── bindings.sh ├── eslint.config.mjs ├── functions/ │ └── [[path]].ts ├── load-context.ts ├── package.json ├── tsconfig.json ├── types/ │ └── istextorbinary.d.ts ├── uno.config.ts ├── vite.config.ts ├── worker-configuration.d.ts └── wrangler.toml ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ root = true [*] indent_style = space end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true max_line_length = 120 indent_size = 2 [*.md] trim_trailing_whitespace = false ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.yml ================================================ name: "Bug report" description: Create a report to help us improve body: - type: markdown attributes: value: | Thank you for reporting an issue :pray:. This issue tracker is for bugs and issues found with [Bolt.new](https://bolt.new). If you experience issues related to WebContainer, please file an issue in our [WebContainer repo](https://github.com/stackblitz/webcontainer-core), or file an issue in our [StackBlitz core repo](https://github.com/stackblitz/core) for issues with StackBlitz. The more information you fill in, the better we can help you. - type: textarea id: description attributes: label: Describe the bug description: Provide a clear and concise description of what you're running into. validations: required: true - type: input id: link attributes: label: Link to the Bolt URL that caused the error description: Please do not delete it after reporting! validations: required: true - type: checkboxes id: checkboxes attributes: label: Validations description: Before submitting the issue, please make sure you do the following options: - label: "Please make your project public or accessible by URL. This will allow anyone trying to help you to easily reproduce the issue and provide assistance." required: true - type: markdown attributes: value: | ![Making your project public](https://github.com/stackblitz/bolt.new/blob/main/public/project-visibility.jpg?raw=true) - type: textarea id: steps attributes: label: Steps to reproduce description: Describe the steps we have to take to reproduce the behavior. placeholder: | 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error validations: required: true - type: textarea id: expected attributes: label: Expected behavior description: Provide a clear and concise description of what you expected to happen. validations: required: true - type: textarea id: screenshots attributes: label: Screen Recording / Screenshot description: If applicable, **please include a screen recording** (preferably) or screenshot showcasing the issue. This will assist us in resolving your issue quickly. - type: textarea id: platform attributes: label: Platform value: | - OS: [e.g. macOS, Windows, Linux] - Browser: [e.g. Chrome, Safari, Firefox] - Version: [e.g. 91.1] - type: textarea id: additional attributes: label: Additional context description: Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false contact_links: - name: Bolt.new Help Center url: https://support.bolt.new about: Official central repository for tips, tricks, tutorials, known issues, and best practices for bolt.new usage. - name: Billing Issues url: https://support.bolt.new/Billing-13fd971055d680ebb393cb80973710b6 about: Instructions for billing and subscription related support - name: Discord Chat url: https://discord.gg/stackblitz about: Build, share, and learn with other Bolters in real time. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe:** **Describe the solution you'd like:** **Describe alternatives you've considered:** **Additional context:** ================================================ FILE: .github/actions/setup-and-build/action.yaml ================================================ name: Setup and Build description: Generic setup action inputs: pnpm-version: required: false type: string default: '9.4.0' node-version: required: false type: string default: '20.15.1' runs: using: composite steps: - uses: pnpm/action-setup@v4 with: version: ${{ inputs.pnpm-version }} run_install: false - name: Set Node.js version to ${{ inputs.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ inputs.node-version }} cache: pnpm - name: Install dependencies and build project shell: bash run: | pnpm install pnpm run build ================================================ FILE: .github/workflows/ci.yaml ================================================ name: CI/CD on: push: branches: - master pull_request: jobs: test: name: Test runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup and Build uses: ./.github/actions/setup-and-build - name: Run type check run: pnpm run typecheck # - name: Run ESLint # run: pnpm run lint - name: Run tests run: pnpm run test ================================================ FILE: .github/workflows/semantic-pr.yaml ================================================ name: Semantic Pull Request on: pull_request_target: types: [opened, reopened, edited, synchronize] permissions: pull-requests: read jobs: main: name: Validate PR Title runs-on: ubuntu-latest steps: # https://github.com/amannn/action-semantic-pull-request/releases/tag/v5.5.3 - uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: subjectPattern: ^(?![A-Z]).+$ subjectPatternError: | The subject "{subject}" found in the pull request title "{title}" didn't match the configured pattern. Please ensure that the subject doesn't start with an uppercase character. types: | fix feat chore build ci perf docs refactor revert test ================================================ FILE: .gitignore ================================================ logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* node_modules dist dist-ssr *.local .vscode/* !.vscode/launch.json !.vscode/extensions.json .idea .DS_Store *.suo *.ntvs* *.njsproj *.sln *.sw? /.cache /build .env* *.vars .wrangler _worker.bundle ================================================ FILE: .husky/commit-msg ================================================ #!/usr/bin/env sh . "$(dirname "$0")/_/husky.sh" npx commitlint --edit $1 exit 0 ================================================ FILE: .prettierignore ================================================ pnpm-lock.yaml .astro ================================================ FILE: .prettierrc ================================================ { "printWidth": 120, "singleQuote": true, "useTabs": false, "tabWidth": 2, "semi": true, "bracketSpacing": true } ================================================ FILE: .tool-versions ================================================ nodejs 20.15.1 pnpm 9.4.0 ================================================ FILE: CONTRIBUTING.md ================================================ [![Bolt Open Source Codebase](./public/social_preview_index.jpg)](https://bolt.new) > Welcome to the **Bolt** open-source codebase! This repo contains a simple example app using the core components from bolt.new to help you get started building **AI-powered software development tools** powered by StackBlitz’s **WebContainer API**. ### Why Build with Bolt + WebContainer API By building with the Bolt + WebContainer API you can create browser-based applications that let users **prompt, run, edit, and deploy** full-stack web apps directly in the browser, without the need for virtual machines. With WebContainer API, you can build apps that give AI direct access and full control over a **Node.js server**, **filesystem**, **package manager** and **dev terminal** inside your users browser tab. This powerful combination allows you to create a new class of development tools that support all major JavaScript libraries and Node packages right out of the box, all without remote environments or local installs. ### What’s the Difference Between Bolt (This Repo) and [Bolt.new](https://bolt.new)? - **Bolt.new**: This is the **commercial product** from StackBlitz—a hosted, browser-based AI development tool that enables users to prompt, run, edit, and deploy full-stack web applications directly in the browser. Built on top of the [Bolt open-source repo](https://github.com/stackblitz/bolt.new) and powered by the StackBlitz **WebContainer API**. - **Bolt (This Repo)**: This open-source repository provides the core components used to make **Bolt.new**. This repo contains the UI interface for Bolt as well as the server components, built using [Remix Run](https://remix.run/). By leveraging this repo and StackBlitz’s **WebContainer API**, you can create your own AI-powered development tools and full-stack applications that run entirely in the browser. # Get Started Building with Bolt Bolt combines the capabilities of AI with sandboxed development environments to create a collaborative experience where code can be developed by the assistant and the programmer together. Bolt combines [WebContainer API](https://webcontainers.io/api) with [Claude Sonnet 3.5](https://www.anthropic.com/news/claude-3-5-sonnet) using [Remix](https://remix.run/) and the [AI SDK](https://sdk.vercel.ai/). ### WebContainer API Bolt uses [WebContainers](https://webcontainers.io/) to run generated code in the browser. WebContainers provide Bolt with a full-stack sandbox environment using [WebContainer API](https://webcontainers.io/api). WebContainers run full-stack applications directly in the browser without the cost and security concerns of cloud hosted AI agents. WebContainers are interactive and editable, and enables Bolt's AI to run code and understand any changes from the user. The [WebContainer API](https://webcontainers.io) is free for personal and open source usage. If you're building an application for commercial usage, you can learn more about our [WebContainer API commercial usage pricing here](https://stackblitz.com/pricing#webcontainer-api). ### Remix App Bolt is built with [Remix](https://remix.run/) and deployed using [CloudFlare Pages](https://pages.cloudflare.com/) and [CloudFlare Workers](https://workers.cloudflare.com/). ### AI SDK Integration Bolt uses the [AI SDK](https://github.com/vercel/ai) to integrate with AI models. At this time, Bolt supports using Anthropic's Claude Sonnet 3.5. You can get an API key from the [Anthropic API Console](https://console.anthropic.com/) to use with Bolt. Take a look at how [Bolt uses the AI SDK](https://github.com/stackblitz/bolt.new/tree/main/app/lib/.server/llm) ## Prerequisites Before you begin, ensure you have the following installed: - Node.js (v20.15.1) - pnpm (v9.4.0) ## Setup 1. Clone the repository (if you haven't already): ```bash git clone https://github.com/stackblitz/bolt.new.git ``` 2. Install dependencies: ```bash pnpm install ``` 3. Create a `.env.local` file in the root directory and add your Anthropic API key: ``` ANTHROPIC_API_KEY=XXX ``` Optionally, you can set the debug level: ``` VITE_LOG_LEVEL=debug ``` **Important**: Never commit your `.env.local` file to version control. It's already included in .gitignore. ## Available Scripts - `pnpm run dev`: Starts the development server. - `pnpm run build`: Builds the project. - `pnpm run start`: Runs the built application locally using Wrangler Pages. This script uses `bindings.sh` to set up necessary bindings so you don't have to duplicate environment variables. - `pnpm run preview`: Builds the project and then starts it locally, useful for testing the production build. Note, HTTP streaming currently doesn't work as expected with `wrangler pages dev`. - `pnpm test`: Runs the test suite using Vitest. - `pnpm run typecheck`: Runs TypeScript type checking. - `pnpm run typegen`: Generates TypeScript types using Wrangler. - `pnpm run deploy`: Builds the project and deploys it to Cloudflare Pages. ## Development To start the development server: ```bash pnpm run dev ``` This will start the Remix Vite development server. ## Testing Run the test suite with: ```bash pnpm test ``` ## Deployment To deploy the application to Cloudflare Pages: ```bash pnpm run deploy ``` Make sure you have the necessary permissions and Wrangler is correctly configured for your Cloudflare account. ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2024 StackBlitz, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ [![Bolt.new: AI-Powered Full-Stack Web Development in the Browser](./public/social_preview_index.jpg)](https://bolt.new) # Bolt.new: AI-Powered Full-Stack Web Development in the Browser Bolt.new is an AI-powered web development agent that allows you to prompt, run, edit, and deploy full-stack applications directly from your browser—no local setup required. If you're here to build your own AI-powered web dev agent using the Bolt open source codebase, [click here to get started!](./CONTRIBUTING.md) ## What Makes Bolt.new Different Claude, v0, etc are incredible- but you can't install packages, run backends or edit code. That’s where Bolt.new stands out: - **Full-Stack in the Browser**: Bolt.new integrates cutting-edge AI models with an in-browser development environment powered by **StackBlitz’s WebContainers**. This allows you to: - Install and run npm tools and libraries (like Vite, Next.js, and more) - Run Node.js servers - Interact with third-party APIs - Deploy to production from chat - Share your work via a URL - **AI with Environment Control**: Unlike traditional dev environments where the AI can only assist in code generation, Bolt.new gives AI models **complete control** over the entire environment including the filesystem, node server, package manager, terminal, and browser console. This empowers AI agents to handle the entire app lifecycle—from creation to deployment. Whether you’re an experienced developer, a PM or designer, Bolt.new allows you to build production-grade full-stack applications with ease. For developers interested in building their own AI-powered development tools with WebContainers, check out the open-source Bolt codebase in this repo! ## Tips and Tricks Here are some tips to get the most out of Bolt.new: - **Be specific about your stack**: If you want to use specific frameworks or libraries (like Astro, Tailwind, ShadCN, or any other popular JavaScript framework), mention them in your initial prompt to ensure Bolt scaffolds the project accordingly. - **Use the enhance prompt icon**: Before sending your prompt, try clicking the 'enhance' icon to have the AI model help you refine your prompt, then edit the results before submitting. - **Scaffold the basics first, then add features**: Make sure the basic structure of your application is in place before diving into more advanced functionality. This helps Bolt understand the foundation of your project and ensure everything is wired up right before building out more advanced functionality. - **Batch simple instructions**: Save time by combining simple instructions into one message. For example, you can ask Bolt to change the color scheme, add mobile responsiveness, and restart the dev server, all in one go saving you time and reducing API credit consumption significantly. ## FAQs **Where do I sign up for a paid plan?** Bolt.new is free to get started. If you need more AI tokens or want private projects, you can purchase a paid subscription in your [Bolt.new](https://bolt.new) settings, in the lower-left hand corner of the application. **What happens if I hit the free usage limit?** Once your free daily token limit is reached, AI interactions are paused until the next day or until you upgrade your plan. **Is Bolt in beta?** Yes, Bolt.new is in beta, and we are actively improving it based on feedback. **How can I report Bolt.new issues?** Check out the [Issues section](https://github.com/stackblitz/bolt.new/issues) to report an issue or request a new feature. Please use the search feature to check if someone else has already submitted the same issue/request. **What frameworks/libraries currently work on Bolt?** Bolt.new supports most popular JavaScript frameworks and libraries. If it runs on StackBlitz, it will run on Bolt.new as well. **How can I add make sure my framework/project works well in bolt?** We are excited to work with the JavaScript ecosystem to improve functionality in Bolt. Reach out to us via [hello@stackblitz.com](mailto:hello@stackblitz.com) to discuss how we can partner! ================================================ FILE: app/components/chat/Artifact.tsx ================================================ import { useStore } from '@nanostores/react'; import { AnimatePresence, motion } from 'framer-motion'; import { computed } from 'nanostores'; import { memo, useEffect, useRef, useState } from 'react'; import { createHighlighter, type BundledLanguage, type BundledTheme, type HighlighterGeneric } from 'shiki'; import type { ActionState } from '~/lib/runtime/action-runner'; import { workbenchStore } from '~/lib/stores/workbench'; import { classNames } from '~/utils/classNames'; import { cubicEasingFn } from '~/utils/easings'; const highlighterOptions = { langs: ['shell'], themes: ['light-plus', 'dark-plus'], }; const shellHighlighter: HighlighterGeneric = import.meta.hot?.data.shellHighlighter ?? (await createHighlighter(highlighterOptions)); if (import.meta.hot) { import.meta.hot.data.shellHighlighter = shellHighlighter; } interface ArtifactProps { messageId: string; } export const Artifact = memo(({ messageId }: ArtifactProps) => { const userToggledActions = useRef(false); const [showActions, setShowActions] = useState(false); const artifacts = useStore(workbenchStore.artifacts); const artifact = artifacts[messageId]; const actions = useStore( computed(artifact.runner.actions, (actions) => { return Object.values(actions); }), ); const toggleActions = () => { userToggledActions.current = true; setShowActions(!showActions); }; useEffect(() => { if (actions.length && !showActions && !userToggledActions.current) { setShowActions(true); } }, [actions]); return (
{actions.length && (
)}
{showActions && actions.length > 0 && (
)}
); }); interface ShellCodeBlockProps { classsName?: string; code: string; } function ShellCodeBlock({ classsName, code }: ShellCodeBlockProps) { return (
); } interface ActionListProps { actions: ActionState[]; } const actionVariants = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0 }, }; const ActionList = memo(({ actions }: ActionListProps) => { return (
    {actions.map((action, index) => { const { status, type, content } = action; const isLast = index === actions.length - 1; return (
    {status === 'running' ? (
    ) : status === 'pending' ? (
    ) : status === 'complete' ? (
    ) : status === 'failed' || status === 'aborted' ? (
    ) : null}
    {type === 'file' ? (
    Create{' '} {action.filePath}
    ) : type === 'shell' ? (
    Run command
    ) : null}
    {type === 'shell' && ( )}
    ); })}
); }); function getIconColor(status: ActionState['status']) { switch (status) { case 'pending': { return 'text-bolt-elements-textTertiary'; } case 'running': { return 'text-bolt-elements-loader-progress'; } case 'complete': { return 'text-bolt-elements-icon-success'; } case 'aborted': { return 'text-bolt-elements-textSecondary'; } case 'failed': { return 'text-bolt-elements-icon-error'; } default: { return undefined; } } } ================================================ FILE: app/components/chat/AssistantMessage.tsx ================================================ import { memo } from 'react'; import { Markdown } from './Markdown'; interface AssistantMessageProps { content: string; } export const AssistantMessage = memo(({ content }: AssistantMessageProps) => { return (
{content}
); }); ================================================ FILE: app/components/chat/BaseChat.module.scss ================================================ .BaseChat { &[data-chat-visible='false'] { --workbench-inner-width: 100%; --workbench-left: 0; .Chat { --at-apply: bolt-ease-cubic-bezier; transition-property: transform, opacity; transition-duration: 0.3s; will-change: transform, opacity; transform: translateX(-50%); opacity: 0; } } } .Chat { opacity: 1; } ================================================ FILE: app/components/chat/BaseChat.tsx ================================================ import type { Message } from 'ai'; import React, { type RefCallback } from 'react'; import { ClientOnly } from 'remix-utils/client-only'; import { Menu } from '~/components/sidebar/Menu.client'; import { IconButton } from '~/components/ui/IconButton'; import { Workbench } from '~/components/workbench/Workbench.client'; import { classNames } from '~/utils/classNames'; import { Messages } from './Messages.client'; import { SendButton } from './SendButton.client'; import styles from './BaseChat.module.scss'; interface BaseChatProps { textareaRef?: React.RefObject | undefined; messageRef?: RefCallback | undefined; scrollRef?: RefCallback | undefined; showChat?: boolean; chatStarted?: boolean; isStreaming?: boolean; messages?: Message[]; enhancingPrompt?: boolean; promptEnhanced?: boolean; input?: string; handleStop?: () => void; sendMessage?: (event: React.UIEvent, messageInput?: string) => void; handleInputChange?: (event: React.ChangeEvent) => void; enhancePrompt?: () => void; } const EXAMPLE_PROMPTS = [ { text: 'Build a todo app in React using Tailwind' }, { text: 'Build a simple blog using Astro' }, { text: 'Create a cookie consent form using Material UI' }, { text: 'Make a space invaders game' }, { text: 'How do I center a div?' }, ]; const TEXTAREA_MIN_HEIGHT = 76; export const BaseChat = React.forwardRef( ( { textareaRef, messageRef, scrollRef, showChat = true, chatStarted = false, isStreaming = false, enhancingPrompt = false, promptEnhanced = false, messages, input = '', sendMessage, handleInputChange, enhancePrompt, handleStop, }, ref, ) => { const TEXTAREA_MAX_HEIGHT = chatStarted ? 400 : 200; return (
{() => }
{!chatStarted && (

Where ideas begin

Bring ideas to life in seconds or get help on existing projects.

)}
{() => { return chatStarted ? ( ) : null; }}