spiderforce4ai 2.6.4__py3-none-any.whl → 2.6.6__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -285,11 +285,16 @@ class PostExtractionAgent:
285
285
  try:
286
286
  with open(self.config.output_file, 'r', encoding='utf-8') as f:
287
287
  current_results = json.load(f)
288
+ # Convert to list if it's a dict, or initialize new list
289
+ if isinstance(current_results, dict):
290
+ current_results = list(current_results.values())
291
+ elif not isinstance(current_results, list):
292
+ current_results = []
288
293
  except (json.JSONDecodeError, FileNotFoundError):
289
- current_results = {}
294
+ current_results = []
290
295
 
291
- # Update with new result
292
- current_results[url] = result
296
+ # Add new result to list
297
+ current_results.append(result)
293
298
 
294
299
  # Save atomically using temporary file
295
300
  temp_file = self.config.output_file.with_suffix('.tmp')
@@ -341,15 +346,26 @@ class PostExtractionAgent:
341
346
  # Add URL to result before transformation
342
347
  result['url'] = url
343
348
 
344
- logger.info(f"Executing custom transformer function for {url}")
349
+ logger.info(f"Executing transformer function for {url}")
345
350
  transformed_result = self.config.custom_transform_function(result)
346
351
  logger.info(f"Successfully applied custom transformation for {url}")
352
+
353
+ # Save the transformed result to combined output
354
+ if self.config.output_file:
355
+ self._save_result_sync(url, transformed_result)
356
+ logger.info(f"Saved transformed result to combined output for {url}")
357
+
347
358
  logger.info(f"Webhook response sent for {url}")
348
- return transformed_result # Return the transformed result
359
+ return transformed_result
349
360
  except Exception as e:
350
361
  error_msg = f"Warning: Issue in custom transform for {url}: {str(e)}"
351
362
  logger.warning(error_msg)
352
363
  console.print(f"[yellow]{error_msg}[/yellow]")
364
+
365
+ # Save original result if transformation fails
366
+ if self.config.output_file:
367
+ self._save_result_sync(url, result)
368
+ logger.info(f"Saved original result to combined output for {url}")
353
369
 
354
370
  # Save result synchronously
355
371
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: spiderforce4ai
3
- Version: 2.6.4
3
+ Version: 2.6.6
4
4
  Summary: Python wrapper for SpiderForce4AI HTML-to-Markdown conversion service with LLM post-processing
5
5
  Home-page: https://petertam.pro
6
6
  Author: Piotr Tamulewicz
@@ -0,0 +1,7 @@
1
+ spiderforce4ai/__init__.py,sha256=BlrRIrtpDUHjmDedqgXP1KbAAsAH9vwFPncUR5VGGyM,44804
2
+ spiderforce4ai/post_extraction_agent.py,sha256=7N2VYCfsfIh-my-Sc0_lnhmsfb3nyIbDOpnI007M1DM,19075
3
+ spiderforce4ai-2.6.6.dist-info/METADATA,sha256=eoFT4zgeNK3TkBEF5pKnf5IducFbm1quZnndCuXPf-c,9012
4
+ spiderforce4ai-2.6.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
5
+ spiderforce4ai-2.6.6.dist-info/entry_points.txt,sha256=ibARQxOlDiL1ho12zbDZt4Uq5RKSIk_qk159ZlZ46hc,59
6
+ spiderforce4ai-2.6.6.dist-info/top_level.txt,sha256=Kth7A21Js7DCp0j5XBBi-FE45SCLouZkeNZU__Yr9Yk,15
7
+ spiderforce4ai-2.6.6.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- spiderforce4ai/__init__.py,sha256=BlrRIrtpDUHjmDedqgXP1KbAAsAH9vwFPncUR5VGGyM,44804
2
- spiderforce4ai/post_extraction_agent.py,sha256=GJXV-qTi9xAwil8YSUBaB0OUDDPDzWfcYScldxKsenw,18121
3
- spiderforce4ai-2.6.4.dist-info/METADATA,sha256=pzdSGVryHkPAOuf3UcBrimThEi4paBzYKFoWCM-wVvY,9012
4
- spiderforce4ai-2.6.4.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
5
- spiderforce4ai-2.6.4.dist-info/entry_points.txt,sha256=ibARQxOlDiL1ho12zbDZt4Uq5RKSIk_qk159ZlZ46hc,59
6
- spiderforce4ai-2.6.4.dist-info/top_level.txt,sha256=Kth7A21Js7DCp0j5XBBi-FE45SCLouZkeNZU__Yr9Yk,15
7
- spiderforce4ai-2.6.4.dist-info/RECORD,,