3.7 KiB
3.7 KiB
Archy Local Search — Content Surface Guide
How It Works
When Archy (the AI) responds to a query, AIUI's content extraction pipeline scans the response text for structured tags and patterns. Each detected content type is routed to the appropriate content surface (grid component) in the side panel.
The ContextBroker (in contentFiltering.ts) classifies the user query to determine which tabs to show and in what order.
Content Type → Surface Mapping
| Content Type | Extraction Source | Surface (Grid) |
|---|---|---|
| Films | [[film_ext:Title|Year|Director]] tags |
FilmGrid |
| Songs | [[song_ext:Title|Artist]] tags, "Title" by Artist patterns |
SongGrid |
| Podcasts | [[podcast_ext:Title|Host]] tags |
PodcastGrid |
| Books | [[book_ext:Title|Author]] tags, **Title** by Author patterns |
BookGrid |
| TV Series | [[tv_ext:Title|Year|Creator]] tags |
TVSeriesGrid |
| Images | Markdown  or raw image URLs |
ImageGrid |
| Places | [[place_ext:Name|Cuisine|City|Rating|Price|Address]] |
PlaceGrid |
| Magazine | ## Heading + bullet/numbered lists with bold titles |
MagazineGrid |
| News | Web search results, markdown links | NewsGrid |
| Code | Markdown fenced code blocks (3+ triggers code tab) | Code renderer |
| Apps | App-specific keyword patterns | AppsGrid |
| Nostr | Nostr protocol terms (npub, nip, zaps) | NostrGrid |
ContextBroker Filtering
The ContextBroker classifies queries to prioritize relevant tabs:
Query Classifiers
- Music query (
song|music|track|album|artist|listen|spotify): Prioritizes SongGrid - Film query (
movie|film|cinema|watch|director): Prioritizes FilmGrid - TV query (
tv|series|netflix|season|episode|binge): Prioritizes TVSeriesGrid - Book query (
book|read|author|novel|literature): Prioritizes BookGrid - News query (
news|latest|recent|headlines|updates): Prioritizes MagazineGrid → NewsGrid - Place query (
restaurant|food|eat|cafe|bar|dining): Prioritizes PlaceGrid - Code query (code blocks in response +
code|programming|function): Prioritizes Code tab - App query (
app|install|software|tool): Prioritizes AppsGrid - Nostr query (
nostr|npub|relay|zap|lightning): Prioritizes NostrGrid
Tab Visibility
Tabs only appear when content is detected. The classifier determines ordering:
- Primary tab (from query classification)
- Secondary tabs (with detected content)
prompttab (always last)
File Type → Content Surface (Local Files)
When browsing local files via the file browser (/browse), file types map to surfaces:
| File Extension | Content Surface |
|---|---|
.mp3, .flac, .wav, .ogg, .m4a |
SongGrid (music playback) |
.jpg, .png, .gif, .webp, .svg |
ImageGrid (image gallery) |
.mp4, .mkv, .avi, .mov |
Video player |
.pdf |
PDF viewer |
.md, .txt |
Markdown/text renderer |
.ts, .js, .vue, .py, .rs, etc. |
Code viewer with syntax highlighting |
.json, .yaml, .toml |
Code viewer (config files) |
Architecture
User Query
↓
AI Response (with content tags)
↓
contentExtraction.ts — extracts all content types
↓
contentFiltering.ts — classifies query, determines tab order
↓
useContentPanel.ts — manages panel state, active tab
↓
*Grid.vue components — render content in panel
Adding New Content Types
- Define the type in
@aiui/core/types/content.ts - Add extraction logic in
contentExtraction.ts - Add query classifier in
contentFiltering.ts - Create
*Grid.vueand*Detail.vueincomponents/content/ - Register the tab in
useContentPanel.ts