A modern, clean, and fully functional AI chat web application built with Next.js, TypeScript, and Tailwind CSS. Inspired by ChatGPT, this app features a minimalistic, responsive design and modular code structure.
/image your prompt here
(e.g., /image a cat riding a skateboard in space
) and press Send. The AI will generate and display an image based on your prompt.useState
, useEffect
)npm install
npm run dev
ai-chat-app/
├── app/
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Main chat page
│ └── globals.css # Global styles
├── components/
│ ├── avatar.tsx # User/AI avatar
│ ├── chat-container.tsx # Scrollable chat area
│ ├── chat-input.tsx # Input bar
│ ├── chat-message.tsx # Single message
│ └── header.tsx # Top bar
├── hooks/
│ └── use-chat.ts # Chat state logic
├── lib/
│ └── ai.ts # AI response logic (text & image)
├── public/
│ └── avatar/
│ ├── user.png # User avatar (placeholder)
│ └── ai.png # AI avatar (placeholder)
├── types/
│ └── message.ts # Message type
├── utils/
│ └── format-timestamp.ts# Timestamp formatting
├── README.md
└── ... (config files)
lib/ai.ts
.public/avatar/
for custom branding.MIT
If you encounter issues with image uploads or downloads (e.g., CORS errors), follow these steps:
your-project-id.appspot.com
(e.g., aichatapp-text-text2imag.appspot.com
).gsutil cors set cors.json gs://your-project-id.appspot.com
gsutil cors set cors.json gs://aichatapp-text-text2imag.appspot.com
NotFoundException: 404 The specified bucket does not exist.
gcloud config set project aichatapp-text-text2imag
cors.json
origins and methods.For more help, see the Firebase and Google Cloud documentation.