cp
This commit is contained in:
parent
9c850fc632
commit
a8c08b4ebd
@ -47,6 +47,12 @@ class Settings(BaseSettings):
|
|||||||
|
|
||||||
# Rate limiting
|
# Rate limiting
|
||||||
RATE_LIMIT_PER_MINUTE: int = int(os.getenv("RATE_LIMIT_PER_MINUTE", "100"))
|
RATE_LIMIT_PER_MINUTE: int = int(os.getenv("RATE_LIMIT_PER_MINUTE", "100"))
|
||||||
|
|
||||||
|
# Qdrant settings
|
||||||
|
QDRANT_HOST: str = os.getenv("QDRANT_HOST", "localhost")
|
||||||
|
QDRANT_PORT: int = int(os.getenv("QDRANT_PORT", "6333"))
|
||||||
|
QDRANT_API_KEY: str = os.getenv("QDRANT_API_KEY", "")
|
||||||
|
QDRANT_COLLECTION: str = os.getenv("QDRANT_COLLECTION", "image_vectors")
|
||||||
|
|
||||||
# Logging
|
# Logging
|
||||||
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
LOG_LEVEL: str = os.getenv("LOG_LEVEL", "INFO")
|
||||||
|
|||||||
@ -266,17 +266,37 @@ class VectorDatabaseService:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
collection_info = self.client.get_collection(self.collection_name)
|
collection_info = self.client.get_collection(self.collection_name)
|
||||||
return {
|
|
||||||
"name": collection_info.config.params.vectors.size,
|
# Handle different response formats safely
|
||||||
"vectors_count": collection_info.points_count,
|
result = {
|
||||||
"vector_size": collection_info.config.params.vectors.size,
|
"name": self.collection_name,
|
||||||
"distance": collection_info.config.params.vectors.distance,
|
"points_count": getattr(collection_info, 'points_count', 0),
|
||||||
"status": collection_info.status
|
"status": getattr(collection_info, 'status', 'unknown')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Safely access vector configuration
|
||||||
|
if hasattr(collection_info, 'config') and collection_info.config:
|
||||||
|
config = collection_info.config
|
||||||
|
if hasattr(config, 'params') and config.params:
|
||||||
|
params = config.params
|
||||||
|
if hasattr(params, 'vectors') and params.vectors:
|
||||||
|
vectors_config = params.vectors
|
||||||
|
if hasattr(vectors_config, 'size'):
|
||||||
|
result["vector_size"] = vectors_config.size
|
||||||
|
if hasattr(vectors_config, 'distance'):
|
||||||
|
result["distance"] = str(vectors_config.distance)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error getting collection info: {e}")
|
logger.error(f"Error getting collection info: {e}")
|
||||||
raise
|
# Return basic info if detailed info fails
|
||||||
|
return {
|
||||||
|
"name": self.collection_name,
|
||||||
|
"points_count": 0,
|
||||||
|
"status": "error",
|
||||||
|
"error": str(e)
|
||||||
|
}
|
||||||
|
|
||||||
def health_check(self) -> bool:
|
def health_check(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user