Ask the hub
Issue #1267. Lovely Home+ and Multi Home only.
Visitors tap Ask Lottie in the bottom corner of any hub page (#1340) and type a question in their own words. Lottie is the same helper as on the marketing site (#1334), but on a hub she answers from that home's guide. She shows the best matching guide page, a short piece of it and a button to open it. Questions about the hub itself, such as "can I download this to use offline", are answered from the hub's own help (#1376, see below). If neither covers the question, the hub says so and saves the question for the owner. Owners see the questions in Guide Editor → Questions people asked, with the unanswered ones marked, so they can see what the guide is missing.
Where it shows
src/shell/hubLottie.js adds the button to the hub shell once, after the plan features load. It is hidden on Free hubs, while the screensaver is on, and on the owner's set-up pages (Guide Editor, Hub setup, Settings) where the corner holds the page's own buttons. On phones with the bottom bar it sits just above it. "Open page" opens that page in the House Guide. The House Guide itself only has its normal search box: the first version put a second "Ask the hub" box above it, which visitors could not find and which looked like two searches.
Phase 1: no AI (this release)
- Where the answer comes from.
src/lib/hubAsk.jssearches the guide catalog the hub already loaded for this visitor. The Worker filtered that catalog for the visitor's audience (#1181) and translated it, so Ask the hub can only show what the visitor could already open. It never calls the server or any AI to find an answer. - Shared matching. The word matching and scoring live in
website/lib/askMatch.js, shared with Lottie, the marketing site's helper (#1334, seewebsite/README.md). The marketing site has no build step, so the shared file sits underwebsite/and the hub and Worker import it. - How it matches. Words are lowercased, accents dropped and simple English endings trimmed ("bins" finds "bin"). Small words like "how", "the" and "where" are ignored. A short list of everyday words for the same thing (rubbish and bins, Wi-Fi and internet, boiler and heating) counts as one word. A page's title, summary and search keywords count more than its body. Chinese and Japanese are split into two-character pieces.
- When it says "not found". A one- or two-word question needs every word on one page; a longer one needs about 60% of them. Otherwise the hub doesn't guess.
- Protected blocks (codes, Wi-Fi password) only give their label to the search, never their value.
- Wi-Fi and door codes (#1342). When a question asks for the Wi-Fi (wifi, internet, router, WLAN, or just "password") or a way in (door, lockbox, key safe, keypad, key), Lottie shows the same details the House Guide shows this visitor (
getWifiDetailsForPanel,getEntryCodeRows): the values once their stay has started, otherwise when they will appear. Matching guide pages follow as links. If the hub has no Wi-Fi saved she shows nothing for it. These values never reach the search or the question log. - Questions about the hub itself (#1376). A home's guide says how the heating works, not how the hub works, so "can I download this so I can use it offline" used to get "I couldn't find that". When the guide (and the Wi-Fi and door details) has no answer, Lottie searches the hub help this visitor can open, in the hub's language: the visitor help (Hub help,
src/help/sitterSections.js) for everyone, plus the Owner guide (src/help/ownerSections.js) in owner mode. Help sections are split at their subheadings the same way as on the marketing site (helpSectionDocumentsinwebsite/lib/lottieAnswers.js), so the answer is the paragraph under "Offline House Guide" rather than a whole page. "Open page" opens that help at the section. The guide always comes first. The help search adds two word groups to the home ones: offline/signal/reception and download/install/save. It leaves out the marketing site's "app" and "home" groups, because every help page names an app or the home and they would make her answer questions the help doesn't cover. A question answered from the help is logged as answered, with no guide page. - Offline. The hub really can be used offline, in one way: guests and sitters download the House Guide (topics and photos, plus emergency contacts) on Wi-Fi from the banner at the top of the guide, once their stay's access window opens, and read it without signal until access ends (
src/services/sitterGuideOfflineService.js). Owners try it with View as Guest. The rest of the hub (weather, bins, controls, signing in) needs a connection. - Owners can ask Lottie to test her, but questions asked in owner mode are not saved.
The question log
POST /api/hub/questions (any signed-in hub session) saves { question, answered, topicId, lang }. The audience comes from the session, never from the request. Only the question text, the answer page, the audience and the language are kept: no name, email or device.
- Lovely Home+ only (
askHubplan feature); Free gets403 PLAN_FEATURE_LOCKED. - At most 200 saved questions a day per hub; past that the hub still answers but saves nothing.
- Questions older than 90 days, and anything past the newest 500, are deleted when a new one is saved.
GET(owner) lists the log;DELETE(owner) removes one with?id=or all without.
Hub D1 migration 0017_hub_questions.sql adds the hub_questions table. It is applied to every hub by the deploy on merge (or npm run d1:migrate:all). Until it is applied, saving and reading questions fail on that hub; the answers still work.
The log is not part of the site backup.
Phase 2: short AI answers (planned)
From the plan agreed on #1267: when the search finds pages, a small Workers AI model (@cf/meta/llama-3.1-8b-instruct-fp8, the one AI hub setup uses) writes a two-sentence answer from the top three snippets only. No match means no AI call. Answers are cached per hub, audience, language and question, and cleared when the owner publishes. A daily neuron budget kept under Cloudflare's free 10,000 a day, plus per-hub and per-visitor limits, switch the hub back to search only when used up. Codes and passwords are never sent to the model.