TejAndrewsACC commited on
Commit
848f587
·
verified ·
1 Parent(s): edb1715

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -19,7 +19,9 @@ def chat(user_input, history=None):
19
  history = []
20
 
21
  if user_input.lower() == "exit":
22
- return history + [{"role": "assistant", "content": "Ending session. Goodbye!"}]
 
 
23
 
24
  # Construct the modified input including system instructions and context
25
  modified_input = (
@@ -37,9 +39,9 @@ def chat(user_input, history=None):
37
  # Update the context with the latest conversation
38
  context += f"User: {user_input}\nAI: {ai_response}\n"
39
 
40
- # Append the conversation to the history in the correct format for Gradio
41
- history.append({"role": "user", "content": user_input})
42
- history.append({"role": "assistant", "content": ai_response})
43
 
44
  return history
45
 
 
19
  history = []
20
 
21
  if user_input.lower() == "exit":
22
+ # Append exit message in tuple format
23
+ history.append(["assistant", "Ending session. Goodbye!"])
24
+ return history
25
 
26
  # Construct the modified input including system instructions and context
27
  modified_input = (
 
39
  # Update the context with the latest conversation
40
  context += f"User: {user_input}\nAI: {ai_response}\n"
41
 
42
+ # Append the conversation to the history in the tuple format
43
+ history.append(["user", user_input])
44
+ history.append(["assistant", ai_response])
45
 
46
  return history
47