mclemcrew commited on
Commit
288729f
·
1 Parent(s): 025287d

another update

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -122,7 +122,8 @@ def generate_response(audio_path, message, chat_history=None):
122
  if chat_history:
123
  history_limit = min(len(chat_history), 3)
124
  for user_msg, bot_msg in chat_history[-history_limit:]:
125
- conversation.append({"role": "user", "content": user_msg})
 
126
  if bot_msg and bot_msg != "⏳ Generating response, please wait...":
127
  conversation.append({"role": "assistant", "content": bot_msg})
128
 
@@ -207,7 +208,7 @@ def create_interface():
207
  with gr.Row():
208
  with gr.Column(scale=2):
209
  # Chat interface
210
- chatbot = gr.Chatbot(height=400, label="Conversation", type="messages")
211
 
212
  with gr.Row():
213
  msg = gr.Textbox(
 
122
  if chat_history:
123
  history_limit = min(len(chat_history), 3)
124
  for user_msg, bot_msg in chat_history[-history_limit:]:
125
+ if user_msg: # Skip None entries
126
+ conversation.append({"role": "user", "content": user_msg})
127
  if bot_msg and bot_msg != "⏳ Generating response, please wait...":
128
  conversation.append({"role": "assistant", "content": bot_msg})
129
 
 
208
  with gr.Row():
209
  with gr.Column(scale=2):
210
  # Chat interface
211
+ chatbot = gr.Chatbot(height=400, label="Conversation")
212
 
213
  with gr.Row():
214
  msg = gr.Textbox(