Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -697,7 +697,7 @@ class PersonalizedKazakhAssistant:
|
|
| 697 |
elif message.lower().startswith('/help'):
|
| 698 |
return self.get_help_message()
|
| 699 |
|
| 700 |
-
retrieved_docs = self.vectorstore.similarity_search(message, k=
|
| 701 |
context = "\n".join([doc.page_content for doc in retrieved_docs])
|
| 702 |
|
| 703 |
memory = self.get_user_memory(user_id)
|
|
@@ -754,7 +754,7 @@ class PersonalizedKazakhAssistant:
|
|
| 754 |
if not hasattr(self.llm, 'generate_content'):
|
| 755 |
raise AttributeError("LLM does not have generate_content method")
|
| 756 |
response = self.llm.generate_content(full_prompt).text
|
| 757 |
-
print(f"Full LLM response:\n{response}\n{'-'*50}")
|
| 758 |
except Exception as e:
|
| 759 |
print(f"Error generating LLM response: {e}")
|
| 760 |
return f"Error generating response: {str(e)}. Please try again."
|
|
@@ -773,10 +773,10 @@ class PersonalizedKazakhAssistant:
|
|
| 773 |
for term, category, definition in unique_terms.values():
|
| 774 |
self.tracker.track_word_encounter(user_id, term, definition, category)
|
| 775 |
|
| 776 |
-
if unique_terms:
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
|
| 781 |
return response
|
| 782 |
|
|
|
|
| 697 |
elif message.lower().startswith('/help'):
|
| 698 |
return self.get_help_message()
|
| 699 |
|
| 700 |
+
retrieved_docs = self.vectorstore.similarity_search(message, k=12)
|
| 701 |
context = "\n".join([doc.page_content for doc in retrieved_docs])
|
| 702 |
|
| 703 |
memory = self.get_user_memory(user_id)
|
|
|
|
| 754 |
if not hasattr(self.llm, 'generate_content'):
|
| 755 |
raise AttributeError("LLM does not have generate_content method")
|
| 756 |
response = self.llm.generate_content(full_prompt).text
|
| 757 |
+
# print(f"Full LLM response:\n{response}\n{'-'*50}")
|
| 758 |
except Exception as e:
|
| 759 |
print(f"Error generating LLM response: {e}")
|
| 760 |
return f"Error generating response: {str(e)}. Please try again."
|
|
|
|
| 773 |
for term, category, definition in unique_terms.values():
|
| 774 |
self.tracker.track_word_encounter(user_id, term, definition, category)
|
| 775 |
|
| 776 |
+
# if unique_terms:
|
| 777 |
+
# response += "\n\n📚 **Tracked Bolded Terms**:\n"
|
| 778 |
+
# for term, category, definition in sorted(unique_terms.values()):
|
| 779 |
+
# response += f"- **{term}** ({category}): {definition}\n"
|
| 780 |
|
| 781 |
return response
|
| 782 |
|