Summarize: LAN primary with local-Ollama rescue + in-app failure guidance

- Engine: when the primary summarizer is out of retries (or misconfigured),
  run_summarize now finishes the job on the configured rescue provider
  (SHONAR_LLM_FALLBACK_*), tags the summary with the provider that wrote it,
  and stores a human note in job.error; success clears stale notes.
- App (auto/lan): passes Ollama as the rescue provider when it is up.
- Detail screen: shows the rescue-swap note in plain words, a red
  'Summary failed' line with Settings -> Summarizer fix instructions and a
  Retry summary button on hard failure.
- Settings copy explains the fallback. 3 new pytest cases (14/14 pass);
  live E2E on 2026-09-18: sarcastic summary v6 via LAN on attempt 2.
This commit is contained in:
avi 2026-09-17 21:44:02 -05:00
commit 3061629dc5
6 changed files with 172 additions and 8 deletions

View file

@ -90,6 +90,14 @@ class Settings(BaseSettings):
llm_base_url: str = ""
llm_api_key: str = Field(default="", repr=False)
# Rescue summarizer tried when the PRIMARY one fails mid-job (desktop:
# LAN GPU server primary, local Ollama fallback). "none" disables the
# fallback; the primary's error then stands as today.
llm_fallback_provider: str = "none" # none | openai_compat | ollama
llm_fallback_model: str = ""
llm_fallback_base_url: str = ""
llm_fallback_api_key: str = Field(default="", repr=False)
# Search needs no setting: services/search.py picks its path by SQL
# dialect (SQLite substring scan / Postgres tsvector). A Meilisearch or
# OpenSearch backend would replace that module, not add a config knob.