masadonline commited on
Commit
f071b38
·
verified ·
1 Parent(s): 362a50b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -110,7 +110,7 @@ def generate_answer_with_groq(question, context):
110
  payload = {
111
  "model": "llama3-8b-8192",
112
  "messages": [
113
- {"role": "system", "content": "You are ToyBot, a friendly WhatsApp assistant specialized in toy shop customer service."},
114
  {"role": "user", "content": prompt},
115
  ],
116
  "temperature": 0.5,
@@ -167,11 +167,10 @@ def load_orders():
167
  return {}
168
 
169
  def extract_order_id(text):
170
- # Extract pattern: "order_id <digits>"
171
- pattern = r"order_id\s+(\d+)"
172
  match = re.search(pattern, text, re.IGNORECASE)
173
  if match:
174
- return match.group(1) # just digits as string
175
  return None
176
 
177
  def format_order_response(order_id, order_data):
 
110
  payload = {
111
  "model": "llama3-8b-8192",
112
  "messages": [
113
+ {"role": "system", "content": "You are ToyBot, a friendly WhatsApp assistant..."},
114
  {"role": "user", "content": prompt},
115
  ],
116
  "temperature": 0.5,
 
167
  return {}
168
 
169
  def extract_order_id(text):
170
+ pattern = r"\bORD\d{3,}\b"
 
171
  match = re.search(pattern, text, re.IGNORECASE)
172
  if match:
173
+ return match.group(0).upper()
174
  return None
175
 
176
  def format_order_response(order_id, order_data):