fix: carry require_existing collection lifecycle through the legacy renderer config
This commit is contained in:
@@ -663,7 +663,13 @@ def _validate_internal_vector_contract(raw: dict[str, Any], path: Path) -> None:
|
|||||||
engine = vector.get("engine")
|
engine = vector.get("engine")
|
||||||
base_url = vector.get("base_url")
|
base_url = vector.get("base_url")
|
||||||
collection = vector.get("collection")
|
collection = vector.get("collection")
|
||||||
allowed = {"engine", "base_url", "collection"}
|
lifecycle = vector.get("collection_lifecycle")
|
||||||
|
allowed = {"engine", "base_url", "collection", "collection_lifecycle"}
|
||||||
|
if lifecycle is not None and lifecycle not in ("self_heal", "require_existing"):
|
||||||
|
raise ConfigError(
|
||||||
|
f"Configurazione non valida in {path}:\n"
|
||||||
|
"resources.vector.collection_lifecycle deve essere 'self_heal' o 'require_existing'"
|
||||||
|
)
|
||||||
unexpected = sorted(set(vector) - allowed)
|
unexpected = sorted(set(vector) - allowed)
|
||||||
if unexpected:
|
if unexpected:
|
||||||
raise ConfigError(
|
raise ConfigError(
|
||||||
|
|||||||
@@ -36,11 +36,14 @@ def translate_legacy_config(raw: dict[str, Any]) -> tuple[dict[str, Any], bool]:
|
|||||||
if isinstance(resources, dict) and "vector" in resources and "vectors" not in translated:
|
if isinstance(resources, dict) and "vector" in resources and "vectors" not in translated:
|
||||||
vector = _as_mapping(resources.get("vector"))
|
vector = _as_mapping(resources.get("vector"))
|
||||||
if isinstance(vector, dict):
|
if isinstance(vector, dict):
|
||||||
translated["vectors"] = {
|
translated_vectors: dict[str, Any] = {
|
||||||
"type": "qdrant",
|
"type": "qdrant",
|
||||||
"base_url": vector.get("base_url"),
|
"base_url": vector.get("base_url"),
|
||||||
"collection": vector.get("collection"),
|
"collection": vector.get("collection"),
|
||||||
}
|
}
|
||||||
|
if vector.get("collection_lifecycle") in ("self_heal", "require_existing"):
|
||||||
|
translated_vectors["collection_lifecycle"] = vector["collection_lifecycle"]
|
||||||
|
translated["vectors"] = translated_vectors
|
||||||
legacy = any(key in raw for key in _LEGACY_RESOURCE_KEYS)
|
legacy = any(key in raw for key in _LEGACY_RESOURCE_KEYS)
|
||||||
if not legacy:
|
if not legacy:
|
||||||
return translated, False
|
return translated, False
|
||||||
|
|||||||
Reference in New Issue
Block a user