Add AI search query expansion
test / pytest (push) Successful in 1m20s
docker-image / build-and-push (push) Successful in 5m6s

This commit is contained in:
2026-06-01 21:28:29 +02:00
parent d36b940981
commit 70b0cf08ee
10 changed files with 1064 additions and 123 deletions
+5
View File
@@ -25,6 +25,7 @@ class LLMConfig:
model: str = ""
api_key: str = ""
ai_search_enabled: bool = False
ai_search_extra_hints: str = ""
def _get_value(rows: dict[str, str], key: str, default: str) -> str:
@@ -48,6 +49,7 @@ def get_app_settings(db: Session) -> LLMConfig:
model=_get_value(rows, "llm_model", ""),
api_key=_get_value(rows, "llm_api_key", ""),
ai_search_enabled=_get_bool(rows, "ai_search_enabled", False),
ai_search_extra_hints=_get_value(rows, "ai_search_extra_hints", ""),
)
@@ -59,6 +61,7 @@ def save_app_settings(
model: str | None = None,
api_key: str | None = None,
ai_search_enabled: bool | None = None,
ai_search_extra_hints: str | None = None,
) -> None:
"""Write settings to ``app_settings``.
@@ -77,6 +80,8 @@ def save_app_settings(
updates["llm_api_key"] = api_key
if ai_search_enabled is not None:
updates["ai_search_enabled"] = str(ai_search_enabled).lower()
if ai_search_extra_hints is not None:
updates["ai_search_extra_hints"] = ai_search_extra_hints
for key, value in updates.items():
existing = db.get(AppSetting, key)