Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -469,7 +469,7 @@ class IntelligentAgent:
|
|
469 |
|
470 |
return "\n\n" + "="*50 + "\n".join(formatted_content) + "\n" + "="*50
|
471 |
|
472 |
-
def _detect_and_process_direct_attachments(self, file_name: str) -> Tuple[List[str], List[str], List[str]]:
|
473 |
"""
|
474 |
Detect and process a single attachment directly attached to a question (not as a URL).
|
475 |
Returns (image_files, audio_files, code_files)
|
@@ -483,7 +483,7 @@ class IntelligentAgent:
|
|
483 |
|
484 |
try:
|
485 |
api_url = DEFAULT_API_URL
|
486 |
-
files_url = f"{
|
487 |
# Construct the file path (assuming file is in the same directory)
|
488 |
file_path = os.path.join(files_url, file_name)
|
489 |
|
@@ -702,10 +702,11 @@ Answer with just "YES" if web search would be helpful, or "NO" if the available
|
|
702 |
print(f"3. Searching for images, audio or code attachments...")
|
703 |
|
704 |
attachment_name = question_data.get('file_name', '')
|
|
|
705 |
if self.debug:
|
706 |
print(f"Attachment name from question_data: '{attachment_name}'")
|
707 |
|
708 |
-
image_files, audio_files, code_files = self._detect_and_process_direct_attachments(attachment_name)
|
709 |
|
710 |
# Process attachments to get context
|
711 |
attachment_context = self._process_attachments(image_files, audio_files, code_files)
|
|
|
469 |
|
470 |
return "\n\n" + "="*50 + "\n".join(formatted_content) + "\n" + "="*50
|
471 |
|
472 |
+
def _detect_and_process_direct_attachments(self, file_name: str, task_id: str) -> Tuple[List[str], List[str], List[str]]:
|
473 |
"""
|
474 |
Detect and process a single attachment directly attached to a question (not as a URL).
|
475 |
Returns (image_files, audio_files, code_files)
|
|
|
483 |
|
484 |
try:
|
485 |
api_url = DEFAULT_API_URL
|
486 |
+
files_url = f"{DEFAULT_API_URL}/files/{task_id}/"
|
487 |
# Construct the file path (assuming file is in the same directory)
|
488 |
file_path = os.path.join(files_url, file_name)
|
489 |
|
|
|
702 |
print(f"3. Searching for images, audio or code attachments...")
|
703 |
|
704 |
attachment_name = question_data.get('file_name', '')
|
705 |
+
attachment_name = question_data.get('task_id', '')
|
706 |
if self.debug:
|
707 |
print(f"Attachment name from question_data: '{attachment_name}'")
|
708 |
|
709 |
+
image_files, audio_files, code_files = self._detect_and_process_direct_attachments(attachment_name, task_id)
|
710 |
|
711 |
# Process attachments to get context
|
712 |
attachment_context = self._process_attachments(image_files, audio_files, code_files)
|