This project integrates a FastAPI backend with an Angular frontend to create a conversational AI interface. The backend is responsible for communicating with OpenAI's APIs for chat generation and image creation. The frontend provides the interactive user interface for chat and displays the generated images.
The backend service is built with FastAPI. It handles requests from the frontend, communicates with OpenAI's API, and returns the AI's responses and images back to the frontend.
To set up and run the backend:
-
Navigate to the
backend
directory from the root of the project. -
Install the dependencies using
pip
:
pip install -r requirements.txt
Start the FastAPI server:
uvicorn app:app --reload --port 8000
Ensure that you have the following environment variables set:
OPENAI_API_KEY
: Your OpenAI API key.
The frontend is an Angular application that provides the chat UI. Users can send messages, receive responses, and view images generated by the AI.
To get the frontend up and running:
-
Navigate to the
frontend
directory from the root of the project. -
Install the dependencies with npm:
npm install
Serve the application locally:
ng serve
Open your web browser and go to http://localhost:4200 to view the application.
Make sure the backend service is running as the frontend will need to communicate with it to function properly.