Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions chat-interface/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
.git
.DS_Store
1 change: 1 addition & 0 deletions chat-interface/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_COHERE_API_KEY=rkWRPBlxOLKUoBP6z23M1oGs5P0uiJWcRyigtmde
Binary file added chat-interface/.gitignore
Binary file not shown.
Binary file not shown.
20 changes: 20 additions & 0 deletions chat-interface/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use official Node.js LTS image
FROM node:18-alpine

# Set working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the entire project into the container
COPY . .

# Expose port 5173
EXPOSE 5173

# Start the React application
CMD ["npm", "start"]
109 changes: 109 additions & 0 deletions chat-interface/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Chat Interface Project

## 🚀 Project Overview
This is a modern chat interface built using React (Vite) with support for speech recognition, theme toggling, and responsive design. The project is containerized using Docker for seamless deployment.

## 📂 Project Structure
```
chat-interface/
├── src/
│ ├── assets/
│ ├── components/
│ │ ├── chat/
│ │ │ ├── ChatContainer.tsx
│ │ │ ├── InputArea.tsx
│ │ │ ├── MessageBubble.tsx
│ │ │ └── MessageThread.tsx
│ │ ├── settings/
│ │ │ └── ThemeToggle.tsx
│ │ ├── context/
│ │ │ └── ChatContext.tsx
│ │ ├── services/
│ │ │ └── api.ts
│ │ └── types/
│ │ └── chat.ts
│ ├── App.css
│ ├── App.tsx
│ ├── index.css
│ └── main.tsx
├── Dockerfile
├── docker-compose.yml
├── package.json
├── tsconfig.json
└── README.md
```

## 🛠️ Setup Instructions
### Prerequisites
Ensure you have the following installed on your system:
- [Node.js](https://nodejs.org/) (v16+ recommended)
- [Docker](https://www.docker.com/get-started)
- [Git](https://git-scm.com/)

### 1️⃣ Clone the Repository
```sh
git clone [your-repository-url]
cd chat-interface
```

### 2️⃣ Install Dependencies
```sh
npm install
```

### 3️⃣ Run Locally
```sh
npm run dev
```
The application will be available at `http://localhost:5173`.

## 🐳 Running with Docker
### 1️⃣ Build and Run the Docker Container
```sh
docker-compose up --build
```
This will start the app in a Docker container.

### 2️⃣ Access the Application
Open `http://localhost:5173` in your browser.

## 🏗️ Architecture Overview
This project follows a modular architecture:
- **Components**: Divided into `chat`, `settings`, and shared UI components.
- **Context**: Manages global state using React Context API.
- **Services**: Handles API interactions.
- **Types**: Stores TypeScript interfaces for type safety.

## 🎯 Implementation Decisions
- **React (Vite)**: Faster development with optimized build performance.
- **Context API**: Lightweight state management.
- **Docker**: Ensures consistency across environments.
- **Responsive UI**: Optimized for mobile and desktop devices.

## 🧪 Testing Approach
- Unit tests using Jest and React Testing Library.
- Integration tests for API interactions.
- Manual testing on different devices.

## 📜 Docker Configuration
### Dockerfile
```dockerfile
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5173
CMD ["npm", "start"]
```

### docker-compose.yml
```yaml
services:
app:
build: .
ports:
- "5173:5173"
environment:
- NODE_ENV=production
```
7 changes: 7 additions & 0 deletions chat-interface/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
app:
build: .
ports:
- "5173:5173"
environment:
- NODE_ENV=production
28 changes: 28 additions & 0 deletions chat-interface/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
13 changes: 13 additions & 0 deletions chat-interface/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/assets/chatbubble.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>AI Chat</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading