Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- app/ai_features.py +3 -2
app/ai_features.py
CHANGED
@@ -18,6 +18,7 @@ from .xero_utils import trigger_invoice_creation,trigger_contact_creation
|
|
18 |
from .email_utils import send_order_confirmation_email
|
19 |
# +++ START: WHATSAPP FEATURE IMPORTS +++
|
20 |
import requests
|
|
|
21 |
from twilio.twiml.messaging_response import MessagingResponse
|
22 |
# +++ END: WHATSAPP FEATURE IMPORTS +++
|
23 |
|
@@ -335,7 +336,7 @@ def handle_ai_chat():
|
|
335 |
product_context_list.append(f"{p['name']} (available units: {', '.join(available_modes)})")
|
336 |
else:
|
337 |
product_context_list.append(p['name'])
|
338 |
-
client = genai.Client(api_key="
|
339 |
|
340 |
min_delivery_date = (datetime.now() + timedelta(days=2)).strftime('%Y-%m-%d')
|
341 |
|
@@ -496,7 +497,7 @@ def whatsapp_reply():
|
|
496 |
return str(twilio_resp)
|
497 |
|
498 |
# --- 2. Setup AI Client and Product Context ---
|
499 |
-
client = genai.Client(api_key=os.getenv("
|
500 |
all_products = list(mongo.db.products.find({}, {'name': 1, 'modes': 1, '_id': 0}))
|
501 |
product_context_list = []
|
502 |
for p in all_products:
|
|
|
18 |
from .email_utils import send_order_confirmation_email
|
19 |
# +++ START: WHATSAPP FEATURE IMPORTS +++
|
20 |
import requests
|
21 |
+
import random
|
22 |
from twilio.twiml.messaging_response import MessagingResponse
|
23 |
# +++ END: WHATSAPP FEATURE IMPORTS +++
|
24 |
|
|
|
336 |
product_context_list.append(f"{p['name']} (available units: {', '.join(available_modes)})")
|
337 |
else:
|
338 |
product_context_list.append(p['name'])
|
339 |
+
client = genai.Client(api_key=random.choice(json.loads(os.getenv("GEMINI_KEY_LIST"))))
|
340 |
|
341 |
min_delivery_date = (datetime.now() + timedelta(days=2)).strftime('%Y-%m-%d')
|
342 |
|
|
|
497 |
return str(twilio_resp)
|
498 |
|
499 |
# --- 2. Setup AI Client and Product Context ---
|
500 |
+
client = genai.Client(api_key=random.choice(json.loads(os.getenv("GEMINI_KEY_LIST"))))
|
501 |
all_products = list(mongo.db.products.find({}, {'name': 1, 'modes': 1, '_id': 0}))
|
502 |
product_context_list = []
|
503 |
for p in all_products:
|