ganeshkumar383 commited on
Commit
265da50
·
verified ·
1 Parent(s): 950ce64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -255,13 +255,16 @@ def reset_conversation(
255
  # GRADIO UI INTERFACE
256
  # ============================================================================
257
 
258
- def format_history_for_chatbot(history: List[Tuple[str, str]]) -> List[Tuple[str, str]]:
259
  """
260
  Convert internal (question, answer) tuples into
261
- Gradio Chatbot display format.
262
- Returns the history as-is since Gradio expects [(user_msg, bot_msg), ...]
263
  """
264
- return history
 
 
 
 
265
 
266
 
267
  def generate_visual_topic_suggestions(
 
255
  # GRADIO UI INTERFACE
256
  # ============================================================================
257
 
258
+ def format_history_for_chatbot(history: List[Tuple[str, str]]) -> List[dict]:
259
  """
260
  Convert internal (question, answer) tuples into
261
+ Gradio v4 Chatbot message format.
 
262
  """
263
+ messages = []
264
+ for q, a in history:
265
+ messages.append({"role": "user", "content": q})
266
+ messages.append({"role": "assistant", "content": a})
267
+ return messages
268
 
269
 
270
  def generate_visual_topic_suggestions(