Add AI search query expansion
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user