File size: 2,886 Bytes
330b6e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Multi-Language Chat Agent

A Flask-based chat agent that supports multiple programming languages with Python as the default. The agent maintains proper chat history, integrates with Groq LangChain API for LLM capabilities, and provides language-specific assistance to students learning to code.

## Project Structure

```

chat_agent/

├── chat_agent/                 # Main application package

│   ├── __init__.py

│   ├── api/                    # REST API endpoints

│   ├── models/                 # Data models

│   ├── services/               # Business logic services

│   ├── utils/                  # Utility functions

│   └── websocket/              # WebSocket handlers

├── static/                     # Static assets (CSS, JS)

│   ├── css/

│   └── js/

├── templates/                  # HTML templates

├── tests/                      # Test suite

│   ├── unit/                   # Unit tests

│   └── integration/            # Integration tests

├── app.py                      # Application entry point

├── config.py                   # Configuration management

├── requirements.txt            # Python dependencies

└── .env.example               # Environment variables template

```

## Setup Instructions

1. **Clone and navigate to the project directory**

2. **Create a virtual environment**
   ```bash

   python -m venv venv

   source venv/bin/activate  # On Windows: venv\Scripts\activate

   ```

3. **Install dependencies**
   ```bash

   pip install -r requirements.txt

   ```

4. **Set up environment variables**
   ```bash

   cp .env.example .env

   # Edit .env with your actual configuration values

   ```

5. **Set up databases**
   - Install and start PostgreSQL
   - Install and start Redis
   - Update database connection strings in .env

6. **Run the application**
   ```bash

   python app.py

   ```

## Environment Variables

Copy `.env.example` to `.env` and configure the following:

- `GROQ_API_KEY`: Your Groq API key for LLM integration
- `DATABASE_URL`: PostgreSQL connection string
- `REDIS_URL`: Redis connection string
- `SECRET_KEY`: Flask secret key for sessions

## Features

- Multi-language programming support (Python, JavaScript, Java, C++, etc.)
- Real-time chat with WebSocket communication
- Persistent chat history with Redis caching
- Groq LangChain API integration
- Session management for concurrent users
- Language context switching mid-conversation

## Development

This project follows the spec-driven development methodology. See the implementation tasks in `.kiro/specs/multi-language-chat-agent/tasks.md` for detailed development steps.

## Testing

Run tests with:
```bash

pytest tests/

```

## License

MIT License