Skip to content

A chatbot app using FastAPI, LangChain and OpenAI, with session-based memory and a simple HTML/JS frontend.

Notifications You must be signed in to change notification settings

iremhazald/chatbot-memory-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💬 Chatbot with Memory using LangChain, FastAPI & OpenAI

This project is a simple yet powerful chatbot built with FastAPI and LangChain, integrating OpenAI's GPT-3.5-Turbo model. It supports session-based message memory, a customizable user interface with HTML/JS, dark mode, and persistent chat history using localStorage.

🚀 Features

  • ✅ Session-based memory using LangChain
  • ✅ FastAPI-powered backend
  • ✅ Lightweight HTML + JavaScript frontend
  • ✅ Username prompt on first visit
  • ✅ Persistent chat history (localStorage)
  • ✅ Dark mode toggle
  • ✅ Clear chat button

🛠 Installation

  1. Clone the repository:
git clone https://github.com/iremhazald/chatbot-memory-app.git
cd chatbot-memory-app
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a .env file and add your OpenAI API key:
OPENAI_API_KEY=your_openai_key_here
  1. Run the server:
uvicorn main:app --reload
  1. Open in your browser:
http://127.0.0.1:8000

💻 Usage

  • When the page loads, you’ll be prompted to enter your name.
  • Type your message and click Send.
  • Messages will appear in the chat box along with AI responses.
  • You can toggle dark mode or clear chat history at any time.

📁 Project Structure

├── main.py               # FastAPI app and routes
├── chat_logic.py         # LangChain logic for session memory
├── templates/
│   └── index.html        # Frontend user interface
├── requirements.txt      # Python dependencies
└── .env                  # Your OpenAI API key (not tracked)

🛠 Technologies Used

👩‍💻 Developer

İrem Hazal Deveci
LinkedInGitHub)


📃 License

This project is licensed under the MIT License. Feel free to use, modify, and share.

About

A chatbot app using FastAPI, LangChain and OpenAI, with session-based memory and a simple HTML/JS frontend.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published