Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -39,8 +39,7 @@ def load_chat_file(filename):
|
|
39 |
try:
|
40 |
with open(os.path.join(CHAT_DIR, filename), "r", encoding="utf-8") as f:
|
41 |
history = json.load(f)
|
42 |
-
|
43 |
-
return chat_display, history
|
44 |
except Exception as e:
|
45 |
print(f"Load error: {e}")
|
46 |
return [], []
|
@@ -93,7 +92,7 @@ textarea, input[type='text'] { border: 1px solid #ccc; border-radius: 20px; padd
|
|
93 |
with gr.Column(scale=1):
|
94 |
gr.Markdown("<h2 style='text-align:center;'>Chats</h2>")
|
95 |
new_chat = gr.Button("π New Chat")
|
96 |
-
|
97 |
|
98 |
with gr.Column(scale=3):
|
99 |
gr.Markdown("<h1 style='text-align:center;'>Neobot</h1>")
|
@@ -108,7 +107,6 @@ textarea, input[type='text'] { border: 1px solid #ccc; border-radius: 20px; padd
|
|
108 |
files = list_saved_chats()
|
109 |
return gr.update(choices=[f[:-5] for f in files])
|
110 |
|
111 |
-
chat_list = gr.Dropdown(label="Select Chat", choices=[], interactive=True)
|
112 |
chat_list.change(lambda name: load_chat_file(f"{name}.json"), inputs=[chat_list], outputs=[chatbot, state])
|
113 |
|
114 |
send = gr.Button("Send π")
|
@@ -127,7 +125,4 @@ textarea, input[type='text'] { border: 1px solid #ccc; border-radius: 20px; padd
|
|
127 |
mic.click(start_stop_recording, inputs=recording, outputs=[chat_input, recording])
|
128 |
demo.load(update_chat_list, outputs=[chat_list])
|
129 |
|
130 |
-
with gr.Row():
|
131 |
-
chat_list.render()
|
132 |
-
|
133 |
demo.launch()
|
|
|
39 |
try:
|
40 |
with open(os.path.join(CHAT_DIR, filename), "r", encoding="utf-8") as f:
|
41 |
history = json.load(f)
|
42 |
+
return history, history
|
|
|
43 |
except Exception as e:
|
44 |
print(f"Load error: {e}")
|
45 |
return [], []
|
|
|
92 |
with gr.Column(scale=1):
|
93 |
gr.Markdown("<h2 style='text-align:center;'>Chats</h2>")
|
94 |
new_chat = gr.Button("π New Chat")
|
95 |
+
chat_list = gr.Dropdown(label="Select Chat", choices=[], interactive=True)
|
96 |
|
97 |
with gr.Column(scale=3):
|
98 |
gr.Markdown("<h1 style='text-align:center;'>Neobot</h1>")
|
|
|
107 |
files = list_saved_chats()
|
108 |
return gr.update(choices=[f[:-5] for f in files])
|
109 |
|
|
|
110 |
chat_list.change(lambda name: load_chat_file(f"{name}.json"), inputs=[chat_list], outputs=[chatbot, state])
|
111 |
|
112 |
send = gr.Button("Send π")
|
|
|
125 |
mic.click(start_stop_recording, inputs=recording, outputs=[chat_input, recording])
|
126 |
demo.load(update_chat_list, outputs=[chat_list])
|
127 |
|
|
|
|
|
|
|
128 |
demo.launch()
|