Update app.py
Browse files
app.py
CHANGED
|
@@ -24,9 +24,8 @@ with gr.Blocks() as demo:
|
|
| 24 |
current_chat_id += 1
|
| 25 |
chat_name = f"chat history {current_chat_id}"
|
| 26 |
chat_histories[chat_name] = chat_history
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
return f"Saved as {chat_name}"
|
| 30 |
|
| 31 |
def load_chat(entered_chat_name):
|
| 32 |
# Fetch the specific chat history based on provided name
|
|
@@ -37,7 +36,7 @@ with gr.Blocks() as demo:
|
|
| 37 |
return "Chat not found!", []
|
| 38 |
|
| 39 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 40 |
-
save_button.click(save_chat, [chatbot])
|
| 41 |
load_button.click(load_chat, [enter_chat_name], outputs=[chatbot])
|
| 42 |
|
| 43 |
demo.launch()
|
|
|
|
| 24 |
current_chat_id += 1
|
| 25 |
chat_name = f"chat history {current_chat_id}"
|
| 26 |
chat_histories[chat_name] = chat_history
|
| 27 |
+
chat_names = "\n".join(chat_histories.keys())
|
| 28 |
+
return f"Saved as {chat_name}", chat_names
|
|
|
|
| 29 |
|
| 30 |
def load_chat(entered_chat_name):
|
| 31 |
# Fetch the specific chat history based on provided name
|
|
|
|
| 36 |
return "Chat not found!", []
|
| 37 |
|
| 38 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 39 |
+
save_button.click(save_chat, [chatbot], outputs=[chatbot, display_chat_names]) # Added display_chat_names as an output
|
| 40 |
load_button.click(load_chat, [enter_chat_name], outputs=[chatbot])
|
| 41 |
|
| 42 |
demo.launch()
|