This is a Python application that maps user questions to database entries and now includes a web-based chat interface built with Flask. When a question closely matches an existing entry, the stored answer is retrieved. Otherwise, the OpenAI API (using the o3-mini model) is called to generate an answer, which is then stored and returned.
In developer mode, any changes you make to the code will be automatically applied thanks to volume mapping and Flask's auto-reload feature.
Before starting the application, ensure that you have your OpenAI API key set in your environment. You can create a .env file in the project root with the following content:
OPENAI_API_KEY=your_openai_api_key_here
Docker Compose will automatically pass this variable to the app service.
-
Build the Package:
When building the package, you will be prompted for your OpenAI API token if it is not set in the environment.make build -
Start the Application:
Run the following command to start both the PostgreSQL database and the Flask app in developer mode:make upAfter starting, you'll see a message with a clickable link. Click or copy the following link into your browser to access the chat interface: http://localhost:5000
-
Stop the Application:
To stop the application, run:make down