akhaliq HF Staff commited on
Commit
c9b2982
·
verified ·
1 Parent(s): b5d95a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -28,15 +28,11 @@ def respond(message, history):
28
 
29
  Args:
30
  message: The user's current message
31
- history: List of previous conversation messages (in ChatInterface format)
32
  """
33
- # Build messages from history - ChatInterface uses dict format
34
- messages = []
35
-
36
- # History from gr.ChatInterface comes as list of dicts with 'role' and 'content'
37
- if history:
38
- for msg in history:
39
- messages.append({"role": msg["role"], "content": msg["content"]})
40
 
41
  # Add current message
42
  messages.append({"role": "user", "content": message})
 
28
 
29
  Args:
30
  message: The user's current message
31
+ history: List of previous conversation messages (in ChatInterface messages format)
32
  """
33
+ # Build messages from history
34
+ # gr.ChatInterface with type="messages" passes history directly as a list of message dicts
35
+ messages = history if history else []
 
 
 
 
36
 
37
  # Add current message
38
  messages.append({"role": "user", "content": message})