nileshhanotia commited on
Commit
e543b4d
·
verified ·
1 Parent(s): 42de116

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -19,7 +19,7 @@ class UnifiedSystem:
19
 
20
  if products and 'products' in products:
21
  results = "\n".join([
22
- f"Title: {p['title']}, Vendor: {p['vendor']}, URL: {self.base_url}{p['handle']}"
23
  for p in products['products']
24
  ])
25
  return f"Intent: Database Query (Confidence: {confidence:.2f})\n\n" \
@@ -29,13 +29,14 @@ class UnifiedSystem:
29
 
30
  elif intent == "product_description":
31
  rag_response = self.rag_system.process_query(query)
32
- # Assume the RAG system can return product handles for links
33
  product_handles = rag_response.get('product_handles', [])
34
  urls = [f"{self.base_url}{handle}" for handle in product_handles]
35
  response = rag_response.get('response', "No description available.")
36
 
37
  return f"Intent: Product Description (Confidence: {confidence:.2f})\n\n" \
38
- f"Response: {response}\n\nProduct URLs:\n" + "\n".join(urls)
 
 
39
 
40
  return "Intent not recognized."
41
 
 
19
 
20
  if products and 'products' in products:
21
  results = "\n".join([
22
+ f"Title: {p['title']}\nVendor: {p['vendor']}\nDescription: {p.get('body_html', 'No description available.')}\nURL: {self.base_url}{p['handle']}\n"
23
  for p in products['products']
24
  ])
25
  return f"Intent: Database Query (Confidence: {confidence:.2f})\n\n" \
 
29
 
30
  elif intent == "product_description":
31
  rag_response = self.rag_system.process_query(query)
 
32
  product_handles = rag_response.get('product_handles', [])
33
  urls = [f"{self.base_url}{handle}" for handle in product_handles]
34
  response = rag_response.get('response', "No description available.")
35
 
36
  return f"Intent: Product Description (Confidence: {confidence:.2f})\n\n" \
37
+ f"Response: {response}\n\nProduct Details:\n" + "\n".join(
38
+ [f"Product URL: {url}" for url in urls]
39
+ )
40
 
41
  return "Intent not recognized."
42