-
Notifications
You must be signed in to change notification settings - Fork 4
Add dev:noconvex script to package.json and update README.md for local Convex setup instructions #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,98 +1,235 @@ | ||
| # T3 Chat Clone Setup | ||
| # T3 Chat Clone | ||
|
|
||
| A modern AI-powered chatbot with file search and web search. | ||
| <div align="center"> | ||
|
|
||
| This project uses [pnpm](https://pnpm.io/) for dependency management. Install it globally if you don't have it. | ||
| [](https://app.netlify.com/start/deploy?repository=https://github.com/heymaaz/t3.chat.cloneathon) | ||
|
|
||
| ## Quick Start | ||
| _A modern AI-powered chatbot with intelligent file search and real-time web search capabilities. Try it out at https://t3chatcloneathon.netlify.app_ | ||
|
|
||
| [Features](#-features) • [Quick Start](#-quick-start) • [Self Hosting](#️-self-hosting) • [Usage](#-usage) • [Tech Stack](#️-tech-stack) | ||
|
|
||
| </div> | ||
|
|
||
| --- | ||
|
|
||
| ## ✨ Features | ||
|
|
||
| ### 🔍 **Intelligent File Search** | ||
|
|
||
| - **Multi-format support**: PDF, TXT, DOCX | ||
| - **AI-powered citations**: Click on file references to preview documents | ||
| - **Contextual understanding**: Conversation-specific vector stores | ||
| - **Smart indexing**: Automatic document processing and search optimization | ||
|
|
||
| ### 🌐 **Real-time Web Search** | ||
|
|
||
| - **Toggle control**: Enable/disable web search per message | ||
| - **Live information**: Access current data and recent events | ||
| - **Source citations**: Clickable links to original sources | ||
| - **Combined search**: Seamlessly merge file and web results | ||
|
|
||
| ### 💬 **Advanced Chat Experience** | ||
|
|
||
| - **Streaming responses**: Real-time AI interaction | ||
| - **Conversation memory**: Persistent chat history | ||
| - **Auto-generated titles**: Smart conversation naming | ||
| - **Modern UI**: Clean, responsive design with dark/light themes | ||
|
|
||
| --- | ||
|
|
||
| ## 🚀 Quick Start | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| - [Node.js 18+](https://nodejs.org/) (`nvm install 18 && nvm use 18`) | ||
| - [pnpm](https://pnpm.io/) (install globally: `npm install -g pnpm`) | ||
|
|
||
| ### Installation | ||
|
|
||
| ```bash | ||
| # Clone the repository | ||
| git clone <repository-url> | ||
| cd chatbot_using_convex | ||
| cd <repo-directory> | ||
|
|
||
| # Install dependencies | ||
| pnpm install | ||
| cp .env.example .env.local | ||
| # edit .env.local with your Convex keys | ||
| # Add your OpenAI API key to convex dashboard | ||
| npx convex env set CONVEX_OPENAI_API_KEY {YOUR_CONVEX_OPENAI_API_KEY} | ||
|
|
||
| # Set up environment variables | ||
| npx convex dev | ||
| ``` | ||
|
heymaaz marked this conversation as resolved.
|
||
|
|
||
| ### Development | ||
|
|
||
| ```bash | ||
| # Option 1: Cloud Convex (recommended for production) | ||
| pnpm dev | ||
|
|
||
| # Option 2: Local Convex (for development) | ||
| # Terminal 1: | ||
| npx convex dev | ||
| # Terminal 2: | ||
| pnpm dev:noconvex | ||
| ``` | ||
|
|
||
| The `dev` script spins up both the Vite frontend and Convex backend. | ||
| Open [http://localhost:5173](http://localhost:5173) in your browser. | ||
|
|
||
| --- | ||
|
|
||
| ## 🏗️ Self Hosting | ||
|
|
||
| ### Environment variables | ||
| ### Using Local Convex | ||
|
|
||
| `.env.example` contains the variables required to run the app: | ||
| Perfect for development and testing: | ||
|
|
||
| ```text | ||
| CONVEX_DEPLOYMENT=your-convex-deployment | ||
| VITE_CONVEX_URL=your-vite-convex-url | ||
| ```bash | ||
| # Ensure Node.js 18 | ||
| nvm install 18 && nvm use 18 | ||
|
|
||
| # Install dependencies | ||
| pnpm install | ||
|
|
||
| # Start local Convex backend | ||
| npx convex dev | ||
| # Follow the prompts: | ||
| # ✓ Start without an account (run Convex locally) | ||
| # ✓ Choose "new" project | ||
| # ✓ Name your project (e.g., "cloneathalon") | ||
|
|
||
| # In a new terminal, start the frontend | ||
| nvm use 18 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| pnpm dev:noconvex | ||
| ``` | ||
|
|
||
| Copy this file to `.env.local` and fill in your own values. | ||
| ### Cloud Deployment | ||
|
|
||
| #### Deploy to Netlify | ||
|
|
||
| [](https://app.netlify.com/start/deploy?repository=https://github.com/heymaaz/t3.chat.cloneathon) | ||
|
|
||
| #### Manual Deployment | ||
|
|
||
| ```bash | ||
| # Build for production | ||
| pnpm build | ||
|
|
||
| # Deploy the dist/ folder to your hosting provider | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 📖 Usage | ||
|
|
||
| ### 🔍 Web Search | ||
|
|
||
| 1. Click the **search icon (🔍)** next to the attachment button | ||
| 2. When enabled, the button highlights in **blue** | ||
| 3. Messages show **"Web search enabled"** indicator | ||
| 4. AI responses include **clickable web citations** | ||
|
|
||
| ### Common scripts | ||
| ### 📁 File Upload | ||
|
|
||
| - `pnpm dev` – start the frontend and backend in development mode | ||
| - `pnpm build` – build the production bundle | ||
| - `pnpm lint` – run ESLint | ||
| - `pnpm typecheck` – run TypeScript type checks | ||
| - `pnpm format` – run prettier checks and fixes | ||
| - `pnpm format:check` – run prettier checks without fixing | ||
| 1. Click the **plus (+) button** to upload files | ||
| 2. **Drag & drop** or browse for supported formats | ||
| 3. Files are **automatically indexed** for intelligent search | ||
| 4. AI provides **clickable citations** with document previews | ||
|
|
||
| ## Features | ||
| ### 💡 Pro Tips | ||
|
|
||
| ### File Search | ||
| - **Combine searches**: Use both file and web search for comprehensive answers | ||
| - **Citation preview**: Click any file citation to view the referenced content | ||
| - **Conversation context**: Files remain available throughout the chat session | ||
|
|
||
| - Upload and search through documents (PDF, TXT, DOC, DOCX, MD) | ||
| - AI can reference specific files and provide citations | ||
| - **Clickable citations** - Click on file citations to preview the referenced document | ||
| - Conversation-specific vector stores for context | ||
| --- | ||
|
|
||
| ### Web Search | ||
| ## 🛠️ Tech Stack | ||
|
|
||
| - Toggle web search on/off for individual messages | ||
| - AI can search the web for real-time information | ||
| - Web results are cited with clickable links | ||
| - Combine with file search for comprehensive answers | ||
| ### Frontend | ||
|
|
||
| ### Real-time Chat | ||
| - **React 19** - Modern UI library with latest features | ||
| - **TypeScript** - Type-safe development | ||
| - **Vite** - Lightning-fast build tool | ||
| - **Tailwind CSS** - Utility-first styling | ||
| - **Tanstack Router** - Type-safe routing | ||
|
|
||
| - Streaming AI responses | ||
| - Message history per conversation | ||
| - Automatic conversation title generation | ||
| ### Backend | ||
|
|
||
| - **Convex** - Real-time database and backend platform | ||
| - **Convex Auth** - Secure authentication system | ||
|
|
||
| ### AI & Search | ||
|
|
||
| - **OpenAI GPT-4.1** - Advanced language model | ||
| - **OpenAI Responses API** - Streaming responses, file search and web search | ||
| - **Vector Stores** - Intelligent document search | ||
| - **Web Search API** - Real-time information retrieval | ||
| - **OpenRouter** - API for Anthropic, xAI, Google and more models | ||
|
|
||
| ### Development Tools | ||
|
|
||
| - **ESLint** - Code linting and quality | ||
| - **Prettier** - Code formatting | ||
| - **Vitest** - Unit testing framework | ||
| - **TypeScript** - Static type checking | ||
|
|
||
| --- | ||
|
|
||
| ## 📋 Available Scripts | ||
|
|
||
| | Command | Description | | ||
| | ------------------- | ------------------------------------------- | | ||
| | `pnpm dev` | Start frontend + cloud Convex backend | | ||
| | `pnpm dev:noconvex` | Start frontend only (requires local Convex) | | ||
| | `pnpm build` | Build production bundle | | ||
| | `pnpm lint` | Run ESLint checks | | ||
| | `pnpm typecheck` | Run TypeScript validation | | ||
| | `pnpm format` | Format code with Prettier | | ||
| | `pnpm format:check` | Check code formatting | | ||
| | `pnpm test` | Run test suite | | ||
|
|
||
| --- | ||
|
|
||
| ### Project Structure | ||
|
|
||
| ``` | ||
| <repo-directory>/ | ||
| ├── src/ # Frontend React application | ||
| │ ├── components/ # Reusable UI components | ||
| │ ├── pages/ # Application pages | ||
| │ └── lib/ # Utilities and helpers | ||
| ├── convex/ # Backend Convex functions | ||
| │ ├── schema.ts # Database schema | ||
| │ └── *.ts # API functions and mutations | ||
| └── public/ # Static assets | ||
| ``` | ||
|
|
||
| ## Usage | ||
| --- | ||
|
|
||
| ### Web Search | ||
| ## 🤝 Contributing | ||
|
|
||
| 1. Click the search icon (🔍) next to the attachment button to enable web search | ||
| 2. When enabled, the button will be highlighted in blue | ||
| 3. Your messages will show "Web search enabled" indicator | ||
| 4. AI responses will include web citations when relevant | ||
| 1. **Fork** the repository | ||
| 2. **Create** your feature branch (`git checkout -b feature/amazing-feature`) | ||
| 3. **Commit** your changes (`git commit -m 'Add amazing feature'`) | ||
| 4. **Push** to the branch (`git push origin feature/amazing-feature`) | ||
| 5. **Open** a Pull Request | ||
|
|
||
| ### File Upload | ||
| ### Development Guidelines | ||
|
|
||
| 1. Click the plus (+) button to upload files | ||
| 2. Supported formats: PDF, TXT, DOC, DOCX, MD | ||
| 3. Files are automatically indexed for search | ||
| 4. AI can reference and cite uploaded documents | ||
| - Run `pnpm lint`, `pnpm typecheck`, `pnpm format`, and `pnpm format:check` before committing | ||
| - Follow the existing code style and conventions | ||
| - Add tests for new features when applicable | ||
|
|
||
| ## Technical Implementation | ||
| --- | ||
|
|
||
| - **Frontend**: React with TypeScript, Tailwind CSS | ||
| - **Backend**: Convex for database and real-time updates | ||
| - **AI**: OpenAI GPT-4.1 with Responses API | ||
| - **File Search**: OpenAI Vector Stores | ||
| - **Web Search**: OpenAI Web Search Preview tool | ||
| ## 📄 License | ||
|
|
||
| ## Project structure | ||
| This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. | ||
|
|
||
| The frontend code is in the `src` directory and is built with [Vite](https://vitejs.dev/). | ||
| --- | ||
|
|
||
| The backend code is in the `convex` directory. | ||
| <div align="center"> | ||
|
|
||
| `pnpm dev` will start the frontend and backend servers. | ||
| **Built with ❤️ using modern web technologies** | ||
|
|
||
| ## App authentication | ||
| [Report Bug](https://github.com/heymaaz/t3.chat.cloneathon/issues) • [Request Feature](https://github.com/heymaaz/t3.chat.cloneathon/issues) | ||
|
|
||
| [Convex Auth](https://auth.convex.dev/) | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix broken navigation anchors
The link fragments (e.g.,
#-features,#️-self-hosting) don’t match the actual heading slugs that include emojis. Either remove emojis from headings (e.g.,## Features) or update anchors to#✨-features,#🏗️-self-hosting, etc., to ensure proper in-page navigation.🤖 Prompt for AI Agents