Update app.py
Browse files
app.py
CHANGED
|
@@ -167,37 +167,7 @@ def clear_all(history, uploaded_file_paths, chats):
|
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
-
|
| 171 |
-
# Funktionen, um vergangene Chats anzuzeigen und zum Download anzubieten
|
| 172 |
-
def update_chat_options():
|
| 173 |
-
global chats
|
| 174 |
-
# Diese Funktion aktualisiert die verfügbaren Chat-Optionen
|
| 175 |
-
if chats != {}:
|
| 176 |
-
return list(chats.keys())
|
| 177 |
-
else:
|
| 178 |
-
return None
|
| 179 |
-
|
| 180 |
-
def download_chats(selected_chats):
|
| 181 |
-
global chats
|
| 182 |
-
global file_path_download
|
| 183 |
-
if chats != {}:
|
| 184 |
-
# Diese Funktion bereitet die ausgewählten Chats zum Download vor
|
| 185 |
-
data = "\n\n".join(chats[chat] for chat in selected_chats)
|
| 186 |
-
file_path_download = save_and_download(data)
|
| 187 |
-
return gr.File(file_path_download, label="Download-Chat", visible=True)
|
| 188 |
-
|
| 189 |
-
"""
|
| 190 |
-
# Dateipfad festlegen (hier wird die Datei im aktuellen Verzeichnis gespeichert)
|
| 191 |
-
file_path = FILE_PATH #'data/chatverlauf.txt'
|
| 192 |
-
|
| 193 |
-
# Datei im Schreibmodus öffnen (erstellt die Datei, wenn sie nicht existiert)
|
| 194 |
-
with open(file_path, 'w') as file:
|
| 195 |
-
# String in die Datei schreiben
|
| 196 |
-
file.write(data)
|
| 197 |
-
return gr.File(file_path, label="Download-Chat", visible = True, show_label=True)
|
| 198 |
-
"""
|
| 199 |
-
else:
|
| 200 |
-
return gr.File(visible=False)
|
| 201 |
|
| 202 |
##############################################
|
| 203 |
#History - die Frage oder das File eintragen...
|
|
|
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
##############################################
|
| 173 |
#History - die Frage oder das File eintragen...
|