Spaces:
Sleeping
Sleeping
aaaaa
Browse files
app.py
CHANGED
|
@@ -129,7 +129,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 129 |
|
| 130 |
cancel_button = gr.Button("Cancel Inference", variant="danger")
|
| 131 |
|
| 132 |
-
def chat_fn(message):
|
| 133 |
response_gen = respond(
|
| 134 |
message,
|
| 135 |
system_message.value,
|
|
@@ -142,9 +142,11 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 142 |
for response in response_gen:
|
| 143 |
full_response += response # Accumulate the full response
|
| 144 |
|
| 145 |
-
|
|
|
|
|
|
|
| 146 |
|
| 147 |
-
user_input.submit(chat_fn, user_input, chat_history)
|
| 148 |
cancel_button.click(cancel_inference)
|
| 149 |
|
| 150 |
if __name__ == "__main__":
|
|
|
|
| 129 |
|
| 130 |
cancel_button = gr.Button("Cancel Inference", variant="danger")
|
| 131 |
|
| 132 |
+
def chat_fn(message, chat_history):
|
| 133 |
response_gen = respond(
|
| 134 |
message,
|
| 135 |
system_message.value,
|
|
|
|
| 142 |
for response in response_gen:
|
| 143 |
full_response += response # Accumulate the full response
|
| 144 |
|
| 145 |
+
# Append the new message-response pair to chat_history
|
| 146 |
+
chat_history.append((message, full_response))
|
| 147 |
+
return chat_history
|
| 148 |
|
| 149 |
+
user_input.submit(chat_fn, [user_input, chat_history], chat_history)
|
| 150 |
cancel_button.click(cancel_inference)
|
| 151 |
|
| 152 |
if __name__ == "__main__":
|