From c810b514ed8c3702aa54a4aaf87840e0fed1c1f7 Mon Sep 17 00:00:00 2001 From: archipelago Date: Fri, 7 Aug 2026 05:07:10 -0400 Subject: [PATCH] fix(search): AIUI web search was 403ing on every query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SearXNG defaults to `formats: [html]`. Its JSON API answers 403 — and JSON is the only thing AIUI's web search speaks, since `/aiui/api/web-search` proxies straight through to `/search`. Both places that seed settings.yml (the first-boot script and the installer) omitted `search.formats`, so web search has never worked on a node whose SearXNG was installed, running and healthy. It reads as the assistant being unable to search rather than as one missing config key. Verified on archi-dev-box: `format=json` went 403 -> 200, returning 28 results for "bitcoin halving" from Brave and DuckDuckGo. Google and Startpage self-suspend on a self-hosted instance (access denied / CAPTCHA), which is expected and costs little given Brave's independent index. Existing nodes need the same two lines added to /var/lib/archipelago/searxng/settings.yml and a restart; this commit only fixes what new installs get. Also fixes a build break: `fetchLibraryContent` built a bundle literal that predates the images bucket. Co-Authored-By: Claude Opus 5 (1M context) --- core/archipelago/src/api/rpc/package/install.rs | 9 ++++++++- neode-ui/src/services/contextBroker.ts | 2 +- scripts/first-boot-containers.sh | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/core/archipelago/src/api/rpc/package/install.rs b/core/archipelago/src/api/rpc/package/install.rs index a2e0d83e..9607f1b0 100644 --- a/core/archipelago/src/api/rpc/package/install.rs +++ b/core/archipelago/src/api/rpc/package/install.rs @@ -720,7 +720,14 @@ impl RpcHandler { )?; let secret_hex = hex::encode(secret); let settings = format!( - "use_default_settings: true\ngeneral:\n instance_name: Archipelago Search\nserver:\n secret_key: \"{}\"\n bind_address: \"0.0.0.0\"\n port: 8080\n limiter: false\nui:\n default_theme: simple\n", + // `search.formats` MUST include json. SearXNG's default is + // html-only, so the JSON API answers 403 — and AIUI's web + // search is a JSON client (`/aiui/api/web-search` proxies + // straight to `/search`). Without this line every AIUI web + // search fails on a node whose SearXNG is running + // perfectly, which reads as the AI being unable to search + // rather than as one missing config key. + "use_default_settings: true\ngeneral:\n instance_name: Archipelago Search\nserver:\n secret_key: \"{}\"\n bind_address: \"0.0.0.0\"\n port: 8080\n limiter: false\nsearch:\n formats:\n - html\n - json\nui:\n default_theme: simple\n", secret_hex ); tokio::fs::create_dir_all(searx_dir) diff --git a/neode-ui/src/services/contextBroker.ts b/neode-ui/src/services/contextBroker.ts index accbf2fa..41c340e2 100644 --- a/neode-ui/src/services/contextBroker.ts +++ b/neode-ui/src/services/contextBroker.ts @@ -538,7 +538,7 @@ export class ContextBroker { method: 'music.list-tracks', params: { limit: 500 }, }) - return { films: [], songs: adaptLibraryTracks(res.tracks ?? []), podcasts: [] } + return { ...emptyBundle(), songs: adaptLibraryTracks(res.tracks ?? []) } } catch { return emptyBundle() } diff --git a/scripts/first-boot-containers.sh b/scripts/first-boot-containers.sh index 6751f51b..561998e1 100755 --- a/scripts/first-boot-containers.sh +++ b/scripts/first-boot-containers.sh @@ -1225,6 +1225,12 @@ server: bind_address: "0.0.0.0" port: 8080 limiter: false +# json is required: SearXNG defaults to html-only and answers 403 on the +# JSON API, which is the only thing AIUI's web search speaks. +search: + formats: + - html + - json ui: default_theme: simple SEARXCFG