Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,9 @@ def chat(user_input, history=None):
|
|
19 |
history = []
|
20 |
|
21 |
if user_input.lower() == "exit":
|
22 |
-
|
|
|
|
|
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
|
41 |
-
history.append(
|
42 |
-
history.append(
|
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 |
|