Update src/pdfchatbot.py
Browse files- src/pdfchatbot.py +9 -1
src/pdfchatbot.py
CHANGED
|
@@ -170,4 +170,12 @@ class PDFChatBot:
|
|
| 170 |
if not text:
|
| 171 |
raise gr.Error('Enter text')
|
| 172 |
history.append((text, ''))
|
| 173 |
-
return history
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
if not text:
|
| 171 |
raise gr.Error('Enter text')
|
| 172 |
history.append((text, ''))
|
| 173 |
+
return history
|
| 174 |
+
|
| 175 |
+
# Function to download conversation history
|
| 176 |
+
def download_chat_history(history,text):
|
| 177 |
+
with open('chat_history.csv', 'w', newline='') as file:
|
| 178 |
+
writer = csv.writer(file)
|
| 179 |
+
writer.writerow(["User Input", "Bot Response"])
|
| 180 |
+
writer.writerows(chat_history)
|
| 181 |
+
return "chat_history.csv"
|