Skip to content

Add a semantic-search mode to the command palette #2539

Description

@JSONbored

GET /api/v1/search/semantic (Vectorize + Workers AI embedding search) is only documented as a curl snippet in agents.tsx:93 and never called from the UI. Promote it to a live 'semantic mode' toggle in the command palette. This is maintainer-leaning because the endpoint 503s when AI is off (AI_RATE_LIMITER, AI binding), so it needs graceful degradation and the AI-availability decision belongs to the maintainer.

Deliverables

  • Add a semanticSearchQuery(q) factory in queries.ts against /api/v1/search/semantic?q= (short staleTime; handle the 503 ai-off response distinctly)
  • Add a 'semantic' mode toggle to command-palette-body.tsx that switches from the keyword /api/v1/search path to the semantic path, preserving the existing deep-linking behavior for exact ss58/hash/block matches
  • Gracefully degrade: when semantic returns 503/ai-off, fall back to keyword search with an unobtrusive notice (do not error the palette)
  • Respect the AI rate limiter (20/60s) with debounce so the palette does not hammer the endpoint
  • Add unit tests for the query, the ai-off fallback branch, and the mode toggle

References

  • repo/workers/api.mjs:3016 (handleSemanticSearchRequest, 503 when AI off)
  • repo-ui/src/routes/agents.tsx:93 (curl snippet only)
  • repo-ui/src/components/metagraphed/command-palette-body.tsx (keyword /api/v1/search + deep-linking)
  • repo-ui/src/lib/metagraphed/queries.ts:4108 (searchQuery)

📸 Required: before/after screenshots (this is a UI change)

Non-negotiable. PRs that change UI must include a before/after screenshot table. PRs without it are automatically closed — no exceptions.

Rules:

  • Show every page/feature you changed — before and after, one row each.
  • Use the markdown table below. Screenshots go inside the table only — no large full-size images pasted elsewhere in the PR.
  • Each cell is a clickable thumbnail (a small image linking to the full-size image) with a one-line caption underneath.
  • Upload screenshots to the PR by drag-and-drop (GitHub hosts them on its CDN). Do NOT commit image files to the repo.

Copy this and fill it in (replace FULL_IMAGE_URL with the URL GitHub gives you after you drop the image in):

| Page / Feature | Before | After |
|---|---|---|
| `/your-route` | [<img src="FULL_IMAGE_URL" width="260">](FULL_IMAGE_URL)<br><sub>before: short caption</sub> | [<img src="FULL_IMAGE_URL" width="260">](FULL_IMAGE_URL)<br><sub>after: short caption</sub> |


size: M · maintainer-only (owner)

Metadata

Metadata

Assignees

Labels

frontendFrontend / metagraphed-ui workmaintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions