tatianija commited on
Commit
f131c5d
·
verified ·
1 Parent(s): 60c173f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -491,7 +491,7 @@ class IntelligentAgent:
491
  audio_files.append(file_path)
492
  elif file_ext in ['.py', '.txt']:
493
  code_files.append(file_path)
494
-
495
  if self.debug:
496
  print(f"3. Found attachments: {len(image_files)} images, {len(audio_files)} audio, {len(code_files)} code files")
497
 
@@ -607,7 +607,7 @@ Example responses:
607
  time.sleep(5)
608
 
609
  if self.debug:
610
- print(f"Decision regarding the search: {decision}")
611
 
612
  return should_search
613
 
@@ -749,21 +749,28 @@ Answer:"""
749
  """
750
  Process a question that may have attachments and URLs.
751
  """
752
- question_text = question_data.get('question', '')
753
 
754
  if self.debug:
755
- print(f"1. Processing question with potential attachments and URLs: {question_text[:100]}...")
756
 
757
  try:
 
 
 
 
 
 
 
758
  # Detect and download attachments
759
- print(f"2. Searching for images, audio or code attachments...")
760
  image_files, audio_files, code_files = self._detect_and_download_attachments(question_data)
761
 
762
  # Process attachments to get context
763
  attachment_context = self._process_attachments(image_files, audio_files, code_files)
764
 
765
  if self.debug and attachment_context:
766
- print(f"4. Attachment context: {attachment_context[:800]}...")
767
 
768
  # Decide whether to search
769
  if self._should_search(question_text, attachment_context):
 
491
  audio_files.append(file_path)
492
  elif file_ext in ['.py', '.txt']:
493
  code_files.append(file_path)
494
+ print(pr)
495
  if self.debug:
496
  print(f"3. Found attachments: {len(image_files)} images, {len(audio_files)} audio, {len(code_files)} code files")
497
 
 
607
  time.sleep(5)
608
 
609
  if self.debug:
610
+ print(f"4. Decision regarding the search: {decision}")
611
 
612
  return should_search
613
 
 
749
  """
750
  Process a question that may have attachments and URLs.
751
  """
752
+ question_text = question_data.get('question', '')
753
 
754
  if self.debug:
755
+ print(f"\n 1. Processing question with potential attachments and URLs: {question_text[:100]}...")
756
 
757
  try:
758
+ # Detect and process URLs
759
+ print(f"2. Detecting and processing...")
760
+ url_context = self._extract_and_process_urls(question_data)
761
+
762
+ if self.debug and url_context:
763
+ print(f"URL context: {url_context[:200]}...")
764
+
765
  # Detect and download attachments
766
+ print(f"3. Searching for images, audio or code attachments...")
767
  image_files, audio_files, code_files = self._detect_and_download_attachments(question_data)
768
 
769
  # Process attachments to get context
770
  attachment_context = self._process_attachments(image_files, audio_files, code_files)
771
 
772
  if self.debug and attachment_context:
773
+ print(f"Attachment context: {attachment_context[:200]}...")
774
 
775
  # Decide whether to search
776
  if self._should_search(question_text, attachment_context):