Skip to content

Commit 0ef7558

Browse files
committed
fix: Fix syntax error in embeddings.py - remove duplicate else statement
Fixed syntax error: - Removed duplicate else statement (line 156 had no matching if) - Consolidated cache status logging into main if block - Simplified fallback logic for when ModelManager is not available
1 parent 336d1e1 commit 0ef7558

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

backend/vector_db/embeddings.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,9 @@ def __init__(self, model_name: str = "paraphrase-multilingual-MiniLM-L12-v2"):
135135
logger.error(f"❌ Cannot import fix_embedding_cache: {import_error}", exc_info=True)
136136
except Exception as fix_error:
137137
logger.error(f"❌ ❌ ❌ CRITICAL: Cache fix error: {fix_error}", exc_info=True)
138-
else:
139-
logger.warning("⚠️ _global_model_manager is None - cache fix will NOT run")
140-
141-
# Try to copy model from image cache to persistent volume if needed
142-
if not cache_status.model_files_found:
143-
logger.info("⚠️ Model not found in persistent cache, attempting to copy from image cache...")
144-
self.model_manager.copy_model_from_image_cache()
145-
# Re-verify cache after copy attempt
146-
cache_status = self.model_manager.cache_status
147138

148-
# Log cache status
139+
# Log cache status after fix attempt
140+
cache_status = self.model_manager.verify_cache_exists()
149141
if cache_status.model_files_found:
150142
logger.info(f"✅ Model cache verified: {cache_status.path}")
151143
logger.info(f" Size: {cache_status.size_mb:.2f} MB")
@@ -154,8 +146,8 @@ def __init__(self, model_name: str = "paraphrase-multilingual-MiniLM-L12-v2"):
154146
logger.warning(f"⚠️ Model cache NOT found. Will download on first use.")
155147
logger.warning(f" Expected location: {cache_path}")
156148
else:
157-
# Fallback to old method
158-
logger.warning("⚠️ Using fallback cache method (ModelManager not available)")
149+
# Fallback to old method (ModelManager not available)
150+
logger.warning("⚠️ _global_model_manager is None - using fallback cache method")
159151
cache_path = self._get_cache_path()
160152
self.model_manager = None
161153

0 commit comments

Comments
 (0)