feat: persist isolated vector snapshots and exact retrieval
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
from pydantic import Field, model_validator
|
||||
from pydantic import Field, field_validator, model_validator
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
@@ -16,6 +17,11 @@ class Settings(BaseSettings):
|
||||
)
|
||||
auth_cookie_secure: bool = True
|
||||
auth_session_seconds: int = Field(28800, ge=300, le=604800)
|
||||
embedding_enabled: bool = False
|
||||
embedding_model: Literal["small", "base"] = "small"
|
||||
embedding_cache_dir: Path | None = None
|
||||
embedding_batch_size: int = Field(8, ge=1, le=32)
|
||||
embedding_threads: int = Field(2, ge=1, le=4)
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=Path(__file__).resolve().parents[2] / ".env", extra="ignore"
|
||||
)
|
||||
@@ -28,6 +34,11 @@ class Settings(BaseSettings):
|
||||
def auth_origin_list(self) -> list[str]:
|
||||
return [x.strip() for x in self.auth_allowed_origins.split(",") if x.strip()]
|
||||
|
||||
@field_validator("embedding_cache_dir", mode="before")
|
||||
@classmethod
|
||||
def empty_embedding_cache_uses_default(cls, value):
|
||||
return None if isinstance(value, str) and not value.strip() else value
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_auth_settings(self):
|
||||
if not self.auth_cookie_secure and self.app_env not in {"development", "test"}:
|
||||
|
||||
Reference in New Issue
Block a user