arpit13 commited on
Commit
e2a6e8f
·
verified ·
1 Parent(s): d96783c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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 clear conversation history
45
  def clear_conversation_history():
 
46
  try:
47
  with open(CONVERSATION_FILE, "w") as file:
48
  json.dump([], file)
49
- return "Conversation history cleared successfully.", ""
 
50
  except Exception as e:
51
- return f"Error clearing history: {e}", ""
 
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=[]):