Spaces:
Runtime error
Runtime error
Wintersmith
commited on
Update main_class.py
Browse files- main_class.py +3 -3
main_class.py
CHANGED
@@ -81,9 +81,9 @@ class PDFChatBot:
|
|
81 |
|
82 |
# Generate a response and write to memory
|
83 |
def generate_response(self, history, query, path):
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
result = self.final_agent.invoke({'input': query, 'chat_history': self.chat_history})['output']
|
88 |
self.chat_history.extend((query, result))
|
89 |
for char in result: # history argument and the subsequent code is only for the purpose of Gradio
|
|
|
81 |
|
82 |
# Generate a response and write to memory
|
83 |
def generate_response(self, history, query, path):
|
84 |
+
if not self.processed:
|
85 |
+
self.process_file(path)
|
86 |
+
self.processed = True
|
87 |
result = self.final_agent.invoke({'input': query, 'chat_history': self.chat_history})['output']
|
88 |
self.chat_history.extend((query, result))
|
89 |
for char in result: # history argument and the subsequent code is only for the purpose of Gradio
|