feat(#7): get all info about current product
Description: Previously, the AI consultant did not have access to the product data the user was viewing. This limited its ability to provide accurate and context-aware responses. This update introduces logic to fetch product details based on the product page the user is currently on.
Changes:
- Added endpoint GET /api/products/{id} that reads product data from a JSON file.
- Implemented getProductFromSite(productID) to fetch and decode the product data.
- Integrated product context into the AI consultant response logic using the productID provided by the client.
- Handled file not found and malformed JSON errors gracefully.
- Ensured correct product data is loaded by mounting the data/ directory inside Docker.
Testing steps:
- Add a test JSON file to the data/ folder (e.g. product1.json).
- Start the server via Docker Compose.
- Send a POST request to /api/message with a valid productID.
- Observe that the assistant now references actual product details in its responses.
- Verify in logs that product file is successfully read.
Closes #7 (closed)