⚠️ DISCLAIMER: LEGACY LEARNING PROJECTThis repository represents an early-stage learning project. The code is functional but does not reflect current quality standards or my current skill level. It has been preserved here to demonstrate my learning curve, experimentation with Streamlit and LangChain, and the ability to build an end-to-end working application.
AI Tutor Chat is an interactive web application built with Streamlit and LangChain. It provides a user-friendly interface for chatting with OpenAI's language models (GPT-3.5, GPT-4).
Key features include:
- Multi-session management: Create, rename, and switch between multiple chat histories.
- Customizable Settings: Adjust model parameters (temperature) and switch between available models.
- BYOK (Bring Your Own Key): Users can securely input their own OpenAI API key for session-based usage.
- Persistent History: Chat sessions are stored locally, preserving context between reloads.
- Utility Features: Token counting, chat export to text, and "quick prompt" templates for common tasks.
This project was created during an early learning phase to experiment with LLM integration and web application development. The primary goals were to:
- Explore the LangChain ecosystem.
- Understand state management in Streamlit.
- Build a functional "Bring Your Own Key" system to safely share the app without exposing personal API quotas.
- Deliver a complete, end-to-end working system.
As a legacy learning project, it has several known limitations:
- Project Structure: The structure is not optimal, with mixed responsibilities in the main application file.
- Documentation: Documentation was partially AI-generated during exploration, leading to some fragmentation across multiple files.
- Code Quality: Coding standards and error handling are inconsistent compared to production-grade software.
- Storage: Local JSON file storage is used for simplicity, which is not scalable for multi-user deployments.
With more experience, I would improve the following aspects:
- Clearer Project Structure: Separate UI, business logic, and data access layers more strictly.
- Better Separation of Concerns: Decouple the Streamlit frontend from the LangChain logic.
- Cleaner Documentation Approach: Use a centralized documentation system and maintain a decision log instead of scattered markdown files.
- Explicit Requirements: Define scope and requirements more clearly upfront to avoid "feature creep."
- Testing: Implement a proper testing suite (Unit/Integration) which is currently absent.
🛑 Archived / Legacy – not under active development.
Интерактивный чат-ассистент на базе LangChain и Streamlit с поддержкой нескольких сессий, настраиваемых параметров модели и персистентного хранения истории.
- 💬 Множественные чаты: создавайте и переключайтесь между разными беседами
- 📝 Пользовательские названия: автоматическая генерация и ручное переименование чатов
- ⚙️ Настройка моделей: выбор модели (GPT-3.5, GPT-4o, etc.) и температуры
- 💾 Персистентное хранилище: история чатов сохраняется между перезапусками
- 🎨 Современный UI: удобный интерфейс на Streamlit
- Клонируйте репозиторий:
git clone https://github.com/Johndmn/AI-Tutor.git
cd AI-Tutor- Создайте виртуальное окружение и активируйте его:
python -m venv venv
# Windows
venv\Scripts\activate
# Linux/Mac
source venv/bin/activate- Установите зависимости:
pip install -r requirements.txt- Создайте файл
.envи добавьте ваш API ключ OpenAI:
OPENAI_API_KEY=sk-proj-your-key-here
OPENAI_MODEL_NAME=gpt-3.5-turbo
OPENAI_TEMPERATURE=0.7
OPENAI_AVAILABLE_MODELS=gpt-3.5-turbo,gpt-4o-mini,gpt-4ostreamlit run app.pyПриложение откроется в браузере по адресу http://localhost:8501
AI Tutor/
├── app.py # Главный файл Streamlit приложения
├── src/
│ ├── __init__.py
│ ├── chat_manager.py # Менеджер чатов и LangChain логика
│ ├── config.py # Конфигурация и переменные окружения
│ └── storage.py # Персистентное хранилище для чатов
├── data/ # Директория с сохранёнными чатами (создаётся автоматически)
│ └── chats/
├── requirements.txt # Зависимости Python
├── .env # Переменные окружения (не в git)
├── .gitignore
└── README.md
Нажмите кнопку "🆕 Новый чат" в сайдбаре
- Выберите чат из списка
- Введите новое название в поле "Название текущего чата"
- Нажмите "💾 Сохранить название"
В разделе "Настройки" можно:
- Изменить температуру (0.0-1.0)
- Выбор модели из доступных
- Сбросить настройки к значениям по умолчанию
Все чаты автоматически сохраняются в директорию data/chats/ в формате JSON. При следующем запуске приложения история будет восстановлена.
- LangChain - фреймворк для работы с LLM
- Streamlit - веб-интерфейс
- OpenAI API - языковые модели
- Python 3.8+
MIT