fix(support-chat): ground identity and improve widget UX
Deploy Canina / deploy (push) Successful in 3m43s

This commit is contained in:
devops committed 2026-10-15 21:39:29 +00:00
1 parent d9ff4aef58
commit c1a5223798
8 files changed
+43 -29

No files matched your search

+3 -3
View File
@@ -36,11 +36,11 @@ def research_query(message):
try: m=validate_message(message).lower()
except ValueError: return None
if re.search(r"تماس|شماره|آدرس|contact|phone|address|shomare|tamas|telefon",m):return "Canina official contact phone address"
if not re.search(r"مقایسه|رقیب|جستجو|compare|research",m,re.I):return None
if not re.search(r"مقایسه|مقایسه|رقیب|رقبا|محصول رقیب|جستجو|compare|competitor|competitors|rival|rivals|research|raqib|moghayese",m,re.I):return None
brands=" ".join(n for pat,n in [(r"رویال|royal","Royal Canin"),(r"بیفار|beaphar","Beaphar"),(r"وت.?اکسپرت|vet.?expert","VetExpert")] if re.search(pat,m,re.I))
return "pet dog cat supplement product comparison Canina "+brands
return "public pet supplement competitor product comparison Canina "+brands
def safe_intent(result):
if not isinstance(result,dict) or result.get("failed") or result.get("error") or result.get("partial") or result.get("completed") is False:raise ValueError("unavailable")
o=json.loads(result.get("final_response",""))
if not isinstance(o,dict) or set(o)!={"intent"} or o["intent"] not in ("public","orders","wallet"):raise ValueError("intent")
if not isinstance(o,dict) or set(o)!={"intent"} or o["intent"] not in ("public","orders","wallet","profile"):raise ValueError("intent")
return o["intent"]