Add Ask the Smol lab (search → persona → chat + Gemini adapter + preview fallback) - #152
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Description
/labs/ask-the-smol(with/labs/smol-oracleas a redirect) and a Svelte client componentAskTheSmolLab.sveltethat loads the canonical Smol corpus, supports search/select, shows a selected-smol panel, chat UI, suggested starters, and a collapsible Prompt Inspector.normalizeSmol.tsand typed persona package (types.ts+buildSmolPersonaPrompt.ts) that compose the single universal system prompt and a compactSMOL CONTEXTblock used for every query.src/pages/api/ask-the-smol.tsthat mirrors the existing radio/AI pattern (@google/genai, same-origin guardrails, rate limit) and calls Gemini whenGEMINI_API_KEYis present; it returns structured error JSON when the key is missing or the provider call fails.localPreviewReply.ts) so the UX and prompt inspector remain usable without a working LLM, and add a browser-side API clientaskSmolClient.ts.labs/registry.jsonand add documentationdocs/labs/ASK_THE_SMOL.mdexplaining data sources, prompt composition, fallback behavior, safety rules, and testing steps.Files added or modified (high level):
src/pages/labs/ask-the-smol.astro,src/components/labs/AskTheSmolLab.svelte,src/pages/api/ask-the-smol.ts,src/lib/smolPersona/*(types, normalizer, prompt builder, local preview, client),labs/registry.json, anddocs/labs/ASK_THE_SMOL.md.Testing
pnpm test(unit tests) passed (all existing automated tests intests/*.test.jsran and passed).pnpm buildcompleted successfully; the build emitted existing repo warnings (large chunks and a few module warnings) but finished without errors.pnpm check(TypeScript/Svelte check) surfaced pre-existing unrelated type errors in other components (these are not introduced by this PR) and therefore failed; the new Ask the Smol files are TypeScript-checked and typed to the repo conventions.Notes: the runtime dev server was started successfully for manual verification; Gemini was not present in the environment (
GEMINI_API_KEYmissing), so API calls fall back to the local preview mode; attempting an automated Playwright screenshot in this environment failed due to an external browser download restriction (CDN 403) unrelated to the feature code.Codex Task