This repository contains a FastAPI backend and a React user interface that together implement a multi-round chatbot powered by Azure OpenAI services.
- Backend (
chat-backend/) – FastAPI application exposing endpoints for the chatbot. It uses Azure OpenAI to process messages and can call helper tools. - Frontend (
chat-ui/) – React application providing a simple chat UI. It communicates with the backend to display assistant responses.
chat-backend/main.py– FastAPI server entry point.chat-backend/tools.py– Azure utility functions used by the chatbot.chat-ui/src/App.tsx– Main React component for the chat interface.
- Python 3
- Node.js
- Azure credentials placed in a
.envfile with variables in backend folder:AZURE_OPENAI_API_KEYAZURE_OPENAI_ENDPOINTAZURE_OPENAI_MODEL_NAMEAZURE_SUBSCRIPTION_IDAZURE_OPENAI_API_VERSION
cd chat-backend- Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Ensure the environment variables above are available (e.g., via the
.envfile). - Run the development server:
The API will be available at http://localhost:8000.
uvicorn main:app --reload
cd chat-ui- Install packages:
npm install
- Start the dev server:
The UI will open at http://localhost:5173.
npm run dev
Visit http://localhost:5173 after both servers start. The frontend communicates with the FastAPI backend running on port 8000.
For more details see the READMEs in chat-backend/ and chat-ui/.