Innopolis University DevOps Playground
Skip to content

feat(#7): get all info about current product

Rolan Muliukin requested to merge feature/proxy-session into main

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:

  1. Add a test JSON file to the data/ folder (e.g. product1.json).
  2. Start the server via Docker Compose.
  3. Send a POST request to /api/message with a valid productID.
  4. Observe that the assistant now references actual product details in its responses.
  5. Verify in logs that product file is successfully read.

Closes #7

Merge request reports

Loading