Files

57 lines
1.2 KiB
Markdown

# Streamlit Chat App Implementation Plan
## Project Setup
```bash
# Create and activate virtual environment
uv venv -p 3.12 env
source env/bin/activate
# Install dependencies using UV
uv pip install -e .
```
## Configuration Management
1. Edit `config/config.ini`:
```ini
[openai]
api_key = your_api_key_here
base_url = https://api.openai.com/v1
model = gpt-3.5-turbo
```
2. Security practices:
- Never commit config.ini to version control
- Use environment variables for production deployment
## Modular Code Structure
```mermaid
graph TD
A[app.py] --> B[OpenAIClient]
B --> C[config.ini]
A --> D[Streamlit Components]
style A fill:#4CAF50
style B fill:#2196F3
style C fill:#FF9800
```
### Key Modules:
1. `openai_client.py`: API communication layer
2. `app.py`: Streamlit UI and business logic
3. `config/`: Centralized configuration management
## Development Workflow
1. Testing:
```bash
streamlit run src/app.py
```
2. Maintenance:
- Update dependencies with `uv pip install -r requirements.txt`
- Validate config changes before deployment
## Best Practices
- Type hints for all function signatures
- Separate UI logic from business logic
- Use Streamlit session state judiciously