fix: Fix NoneType errors in package recommendations tool
- Fix keywords.split() error by handling None values properly - Fix text_data join error in _categorize_package function - Add null safety to prevent 'NoneType' object has no attribute 'split' errors - Replace .get() with default empty strings with .get() or '' pattern All package recommendation functions now handle missing/null metadata gracefully
This commit is contained in:
parent
52bc6d93fb
commit
48f1027c3e
@ -637,9 +637,9 @@ async def _categorize_package(package_info: Dict[str, Any]) -> List[str]:
|
||||
|
||||
# Extract text for analysis
|
||||
text_data = " ".join([
|
||||
package_info.get("summary", ""),
|
||||
package_info.get("description", ""),
|
||||
package_info.get("keywords", ""),
|
||||
package_info.get("summary") or "",
|
||||
package_info.get("description") or "",
|
||||
package_info.get("keywords") or "",
|
||||
]).lower()
|
||||
|
||||
# Classifier-based categorization
|
||||
@ -916,7 +916,7 @@ async def _find_similar_packages(base_info: Dict[str, Any], limit: int) -> List[
|
||||
similar_packages = []
|
||||
|
||||
# Use keywords and categories for similarity
|
||||
keywords = base_info.get("keywords", "").split()
|
||||
keywords = (base_info.get("keywords") or "").split()
|
||||
summary = base_info.get("summary", "")
|
||||
|
||||
if keywords or summary:
|
||||
|
Loading…
x
Reference in New Issue
Block a user