montassarTester commited on
Commit
9211c9e
·
verified ·
1 Parent(s): dea600c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -93,8 +93,13 @@ def text_to_speech(text):
93
 
94
  # Wrap groq_chatbot so it also clears audio on new input
95
  def chatbot_with_audio(input_text, chat_history):
96
- chat_history, cleared_msg = groq_chatbot(input_text, chat_history)
97
- return chat_history, cleared_msg, None # None clears audio player on new chat input
 
 
 
 
 
98
 
99
  def on_tts_click(chat_history):
100
  if chat_history and chat_history[-1][1]:
 
93
 
94
  # Wrap groq_chatbot so it also clears audio on new input
95
  def chatbot_with_audio(input_text, chat_history):
96
+ chat_history, cleared_msg, _ = groq_chatbot(input_text, chat_history)
97
+ new_history = []
98
+ for user_msg, bot_msg in chat_history:
99
+ new_history.append({"role": "user", "content": user_msg})
100
+ new_history.append({"role": "assistant", "content": bot_msg})
101
+ return new_history, cleared_msg, None
102
+
103
 
104
  def on_tts_click(chat_history):
105
  if chat_history and chat_history[-1][1]: