Wintersmith commited on
Commit
d0501f4
·
verified ·
1 Parent(s): d1bc7c9

Update main_class.py

Browse files
Files changed (1) hide show
  1. 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
- #if not self.processed: # processing temporarily switched on for each query (memory issues)
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
 
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