Commit
·
02a452a
1
Parent(s):
94c1e6b
add event data to events
Browse files- app/app.py +3 -3
app/app.py
CHANGED
@@ -83,11 +83,11 @@ def _process_content(content) -> str | list[str]:
|
|
83 |
return content
|
84 |
|
85 |
|
86 |
-
def remove_last_message(history: list) -> list:
|
87 |
return history[:-1]
|
88 |
|
89 |
|
90 |
-
def retry_respond_system_message(history: list) -> list:
|
91 |
"""Respond to the user message with a system message"""
|
92 |
history = remove_last_message(history)
|
93 |
return respond_system_message(history)
|
@@ -143,7 +143,7 @@ def wrangle_edit_data(x: gr.EditData, history: list) -> list:
|
|
143 |
index = x.index[0]
|
144 |
|
145 |
history = history[:index]
|
146 |
-
if history[
|
147 |
return respond_system_message(history)
|
148 |
return history
|
149 |
|
|
|
83 |
return content
|
84 |
|
85 |
|
86 |
+
def remove_last_message(x: gr.UndoData, history: list) -> list:
|
87 |
return history[:-1]
|
88 |
|
89 |
|
90 |
+
def retry_respond_system_message(x: gr.RetryData, history: list) -> list:
|
91 |
"""Respond to the user message with a system message"""
|
92 |
history = remove_last_message(history)
|
93 |
return respond_system_message(history)
|
|
|
143 |
index = x.index[0]
|
144 |
|
145 |
history = history[:index]
|
146 |
+
if history[-1]["role"] == "user":
|
147 |
return respond_system_message(history)
|
148 |
return history
|
149 |
|