Update app.py
Browse files
app.py
CHANGED
|
@@ -41,14 +41,17 @@ def save_history(history):
|
|
| 41 |
except Exception as e:
|
| 42 |
print(f"Error saving history: {e}")
|
| 43 |
|
| 44 |
-
# Function to
|
| 45 |
def clear_conversation_history():
|
|
|
|
| 46 |
try:
|
| 47 |
with open(CONVERSATION_FILE, "w") as file:
|
| 48 |
json.dump([], file)
|
| 49 |
-
|
|
|
|
| 50 |
except Exception as e:
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
# Function to get response from the LLM based on category
|
| 54 |
def get_groq_response(message, category, history=[]):
|
|
|
|
| 41 |
except Exception as e:
|
| 42 |
print(f"Error saving history: {e}")
|
| 43 |
|
| 44 |
+
# Function to Clear conversation history
|
| 45 |
def clear_conversation_history():
|
| 46 |
+
print("Clearing conversation history...")
|
| 47 |
try:
|
| 48 |
with open(CONVERSATION_FILE, "w") as file:
|
| 49 |
json.dump([], file)
|
| 50 |
+
print("History cleared successfully.")
|
| 51 |
+
return [], load_history()
|
| 52 |
except Exception as e:
|
| 53 |
+
print(f"Error clearing history: {e}")
|
| 54 |
+
return f"Error clearing history: {e}", load_history()
|
| 55 |
|
| 56 |
# Function to get response from the LLM based on category
|
| 57 |
def get_groq_response(message, category, history=[]):
|