Phoenix21 commited on
Commit
be50d0f
·
verified ·
1 Parent(s): 5a5fa80

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -4,7 +4,7 @@ from my_memory_logic import run_with_session_memory
4
  def chat_interface_fn(message, history):
5
  """
6
  Multi-turn chat function for Gradio's ChatInterface.
7
- Returns response and history in the format expected by Gradio.
8
  """
9
  # Initialize history if None
10
  history = history or []
@@ -16,9 +16,8 @@ def chat_interface_fn(message, history):
16
  print(f"Error in run_with_session_memory: {str(e)}")
17
  answer = "I apologize, but I encountered an error processing your request."
18
 
19
- # Return the answer and append to history
20
- history.append((message, answer))
21
- return history
22
 
23
  # Custom CSS for chat interface
24
  my_chat_css = """
 
4
  def chat_interface_fn(message, history):
5
  """
6
  Multi-turn chat function for Gradio's ChatInterface.
7
+ Returns strings for both message and history to match Gradio's expected format.
8
  """
9
  # Initialize history if None
10
  history = history or []
 
16
  print(f"Error in run_with_session_memory: {str(e)}")
17
  answer = "I apologize, but I encountered an error processing your request."
18
 
19
+ # Return strings directly - this is what Gradio's ChatInterface expects
20
+ return str(answer)
 
21
 
22
  # Custom CSS for chat interface
23
  my_chat_css = """