Spaces:
Sleeping
Sleeping
Commit
·
b0f2f89
1
Parent(s):
4b954a0
Switch to DialoGPT-small and add direct AI response for non-Textilindo questions
Browse files
app.py
CHANGED
|
@@ -86,7 +86,7 @@ class TextilindoAI:
|
|
| 86 |
def __init__(self):
|
| 87 |
self.api_key = os.getenv('HUGGINGFACE_API_KEY')
|
| 88 |
# Use a more accessible model for free tier
|
| 89 |
-
self.model = os.getenv('DEFAULT_MODEL', 'microsoft/DialoGPT-
|
| 90 |
self.system_prompt = self.load_system_prompt()
|
| 91 |
|
| 92 |
if not self.api_key:
|
|
@@ -184,6 +184,11 @@ Minimum purchase is 1 roll (67-70 yards)."""
|
|
| 184 |
if len(assistant_response) < 10 or "I don't know" in assistant_response.lower():
|
| 185 |
logger.warning("AI response too short, using mock response")
|
| 186 |
return self.get_mock_response(user_message)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
|
| 188 |
return assistant_response
|
| 189 |
|
|
|
|
| 86 |
def __init__(self):
|
| 87 |
self.api_key = os.getenv('HUGGINGFACE_API_KEY')
|
| 88 |
# Use a more accessible model for free tier
|
| 89 |
+
self.model = os.getenv('DEFAULT_MODEL', 'microsoft/DialoGPT-small')
|
| 90 |
self.system_prompt = self.load_system_prompt()
|
| 91 |
|
| 92 |
if not self.api_key:
|
|
|
|
| 184 |
if len(assistant_response) < 10 or "I don't know" in assistant_response.lower():
|
| 185 |
logger.warning("AI response too short, using mock response")
|
| 186 |
return self.get_mock_response(user_message)
|
| 187 |
+
|
| 188 |
+
# For testing: if it's a non-Textilindo question, return the AI response directly
|
| 189 |
+
if not any(keyword in user_message.lower() for keyword in ['textilindo', 'lokasi', 'jam', 'katalog', 'produk', 'sample', 'pembelian', 'pembayaran', 'ongkir']):
|
| 190 |
+
logger.info("Non-Textilindo question detected, returning AI response directly")
|
| 191 |
+
return assistant_response
|
| 192 |
|
| 193 |
return assistant_response
|
| 194 |
|