Spaces:
Build error
Build error
Update services/chat_service.py
Browse files- services/chat_service.py +11 -10
services/chat_service.py
CHANGED
|
@@ -68,13 +68,13 @@ class ChatService:
|
|
| 68 |
|
| 69 |
# Await the search calls since they're coroutines
|
| 70 |
products = await self.data_service.search(query, top_k)
|
| 71 |
-
pdfs = await self.pdf_service.search(query, top_k)
|
| 72 |
-
faqs = await self.faq_service.search_faqs(query, top_k)
|
| 73 |
|
| 74 |
results = {
|
| 75 |
'products': products or [],
|
| 76 |
-
'documents': pdfs or [],
|
| 77 |
-
'faqs': faqs or []
|
| 78 |
}
|
| 79 |
|
| 80 |
print("Search results:", results)
|
|
@@ -153,12 +153,13 @@ class ChatService:
|
|
| 153 |
|
| 154 |
# Add recent chat history
|
| 155 |
if chat_history:
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
| 162 |
|
| 163 |
print("\n\n".join(context_parts))
|
| 164 |
return "\n\n".join(context_parts)
|
|
|
|
| 68 |
|
| 69 |
# Await the search calls since they're coroutines
|
| 70 |
products = await self.data_service.search(query, top_k)
|
| 71 |
+
#pdfs = await self.pdf_service.search(query, top_k)
|
| 72 |
+
#faqs = await self.faq_service.search_faqs(query, top_k)
|
| 73 |
|
| 74 |
results = {
|
| 75 |
'products': products or [],
|
| 76 |
+
#'documents': pdfs or [],
|
| 77 |
+
#'faqs': faqs or []
|
| 78 |
}
|
| 79 |
|
| 80 |
print("Search results:", results)
|
|
|
|
| 153 |
|
| 154 |
# Add recent chat history
|
| 155 |
if chat_history:
|
| 156 |
+
print("--- historiy--- ")
|
| 157 |
+
#recent_history = chat_history[-3:] # Last 3 interactions
|
| 158 |
+
#history_text = "\n".join(
|
| 159 |
+
# f"User: {h['user_input']}\nAssistant: {h['response']}"
|
| 160 |
+
# for h in recent_history
|
| 161 |
+
#)
|
| 162 |
+
#context_parts.append(f"Letzte Interaktionen:\n{history_text}")
|
| 163 |
|
| 164 |
print("\n\n".join(context_parts))
|
| 165 |
return "\n\n".join(context_parts)
|