Skip to content

Commit 71d3b02

Browse files
docs: add logo, theme_color, links, and FieldTrip community (#10)
* docs: add logo, theme_color, links, FieldTrip * fix: links field is null not omitted
1 parent d039db8 commit 71d3b02

6 files changed

Lines changed: 109 additions & 7 deletions

File tree

docs/osa/api-reference.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,35 @@ Response:
7575
"suggested_questions": [
7676
"What is HED and how is it used?",
7777
"How do I annotate an event with HED tags?"
78-
]
78+
],
79+
"logo_url": "/hed/logo",
80+
"theme_color": "#1a365d"
81+
},
82+
"links": {
83+
"homepage": "https://www.hedtags.org",
84+
"documentation": "https://www.hed-resources.org",
85+
"repository": "https://github.com/hed-standard"
7986
}
8087
}
8188
]
8289
```
8390

91+
The `logo_url` field is auto-populated when a `logo.*` file exists in the community folder, or can be set explicitly in the YAML config. The `theme_color` field is only present when configured. The `links` field is `null` when no links are configured.
92+
93+
This endpoint is public (no authentication required).
94+
95+
### Community Logo
96+
97+
Serve the community's logo image file.
98+
99+
```
100+
GET /{community}/logo
101+
```
102+
103+
Returns the logo file with appropriate `Content-Type` header. Supported formats: SVG, PNG, JPG, JPEG, WEBP. SVG files include a `Content-Security-Policy` header (`default-src 'none'; style-src 'unsafe-inline'`) to prevent XSS. Responses are cached for 24 hours (`Cache-Control: public, max-age=86400`).
104+
105+
Returns `404` if no logo file exists for the community.
106+
84107
This endpoint is public (no authentication required).
85108

86109
### Ask

docs/osa/deployment/widget.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The widget appears as a chat bubble in the bottom-right corner of the page.
2121

2222
Widget configuration uses a two-layer approach:
2323

24-
1. **YAML defaults** (community-level): Title, greeting, placeholder, and suggested questions are defined in each community's `config.yaml` under the `widget` section. These are served by the `GET /communities` API endpoint.
24+
1. **YAML defaults** (community-level): Title, greeting, placeholder, suggested questions, theme color, and logo are defined in each community's `config.yaml` under the `widget` section. These are served by the `GET /communities` API endpoint.
2525
2. **JavaScript overrides** (page-level): Embedders can override any field via `setConfig()`. Any value set in JavaScript takes precedence over the YAML defaults.
2626

2727
This means most embedders only need to set `communityId`; the widget fetches its display configuration from the API automatically.
@@ -39,6 +39,8 @@ These fields are typically configured in the community's `config.yaml` and loade
3939
| `initialMessage` | string | From YAML | First message shown to user |
4040
| `placeholder` | string | From YAML or `'Ask a question...'` | Input placeholder text |
4141
| `suggestedQuestions` | string[] | From YAML | Clickable suggestion buttons |
42+
| `logo` | string | Auto-detected or from YAML | Logo URL for widget header avatar |
43+
| `themeColor` | string | From YAML or `'#2563eb'` | Primary theme color (hex `#RRGGBB`) |
4244

4345
### Behavior Options
4446

@@ -94,6 +96,8 @@ This is useful when the same community assistant is embedded across multiple pag
9496
OSAChatWidget.setConfig({
9597
communityId: 'hed',
9698
title: 'HED Assistant',
99+
logo: 'https://example.com/hed-logo.png',
100+
themeColor: '#1a365d',
97101
initialMessage: 'Hi! I can help with HED annotations. What would you like to know?',
98102
placeholder: 'Ask about HED...',
99103
suggestedQuestions: [
@@ -184,9 +188,10 @@ The widget communicates with the following backend endpoints:
184188
|----------|--------|-------------|
185189
| `/communities` | GET | Fetch available communities and widget config |
186190
| `/{communityId}/ask` | POST | Send a question, get a response |
191+
| `/{communityId}/logo` | GET | Serve community logo image (if available) |
187192
| `/health` | GET | Check backend status |
188193

189-
On load, the widget fetches `/communities` to get display configuration (title, greeting, placeholder, suggested questions) for all available communities. This eliminates the need to hardcode these values in JavaScript.
194+
On load, the widget fetches `/communities` to get display configuration (title, greeting, placeholder, suggested questions, logo, theme color) for all available communities. This eliminates the need to hardcode these values in JavaScript.
190195

191196
### Request Format
192197

@@ -236,7 +241,7 @@ To host the widget yourself:
236241
The demo page at [osa-demo.pages.dev](https://osa-demo.pages.dev) dynamically loads all available communities from the `/communities` API and showcases them with URL-based routing:
237242

238243
- `/` - Landing page with community cards (populated from API)
239-
- `/{communityId}` - Community-specific assistant demo (e.g., `/hed`, `/bids`, `/eeglab`)
244+
- `/{communityId}` - Community-specific assistant demo (e.g., `/hed`, `/bids`, `/eeglab`, `/fieldtrip`)
240245

241246
Each community page auto-configures the widget using the YAML-defined defaults. New communities added to the registry appear on the demo page automatically without frontend changes.
242247

docs/osa/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ An extensible AI assistant platform for researchers working with open science to
44

55
## Overview
66

7-
OSA provides domain-specific AI assistants for open science tools (HED, BIDS, EEGLAB) with:
7+
OSA provides domain-specific AI assistants for open science tools (HED, BIDS, EEGLAB, FieldTrip) with:
88

99
- **Modular tool system** for document retrieval, validation, and code execution
1010
- **Multi-source knowledge bases** from GitHub, OpenALEX, Discourse forums, mailing lists
@@ -20,7 +20,7 @@ OSA provides domain-specific AI assistants for open science tools (HED, BIDS, EE
2020

2121
## Target Users
2222

23-
- Researchers learning HED annotations, BIDS formatting, or EEGLAB analysis
23+
- Researchers learning HED annotations, BIDS formatting, EEGLAB analysis, or FieldTrip pipelines
2424
- Lab members needing quick, accurate answers from documentation
2525
- Developers integrating these tools who need API/usage guidance
2626

@@ -68,6 +68,7 @@ uv run pytest tests/ -v
6868
| **HED Assistant** | Hierarchical Event Descriptors | hed-standard repos, hedtags.org |
6969
| **BIDS Assistant** | Brain Imaging Data Structure | bids-standard repos, Neurostars |
7070
| **EEGLAB Assistant** | EEG analysis toolbox | SCCN wiki, mailing lists |
71+
| **FieldTrip Assistant** | MEG/EEG/iEEG analysis toolbox | FieldTrip website, GitHub |
7172

7273
## Documentation
7374

docs/osa/registry/quick-start.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ github:
7070
# Widget display configuration (optional)
7171
widget:
7272
title: My Tool Assistant
73+
theme_color: "#2b6cb0"
7374
initial_message: "Hi! I can help with My Tool. What would you like to know?"
7475
placeholder: Ask about My Tool...
7576
suggested_questions:

docs/osa/registry/schema-reference.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,47 @@ Widget display configuration for the embedded chat widget. These values provide
451451
| `initial_message` | string | No | `null` | Greeting message shown when chat opens (max 1000 chars) |
452452
| `placeholder` | string | No | `"Ask a question..."` | Input field placeholder text (max 200 chars) |
453453
| `suggested_questions` | list[string] | No | `[]` | Clickable suggestion buttons (max 10) |
454+
| `theme_color` | string | No | `null` | Primary theme color as hex `#RRGGBB` (e.g., `#008a79`) |
455+
| `logo_url` | string | No | `null` | URL for custom logo/icon image |
456+
457+
### `theme_color`
458+
459+
Primary color applied to the widget button, header background, and accent elements. Must be a 6-digit hex color code.
460+
461+
```yaml
462+
widget:
463+
theme_color: "#008a79" # Teal
464+
```
465+
466+
When not set, the widget uses the platform default blue (`#2563eb`). The widget JS also accepts `themeColor` via `setConfig()` for per-page overrides.
467+
468+
### `logo_url`
469+
470+
URL to a custom logo or icon image displayed in the widget header avatar (replacing the default brain icon).
471+
472+
- Must use `http://`, `https://`, or start with `/` (relative path)
473+
- Max 500 characters
474+
475+
```yaml
476+
widget:
477+
logo_url: https://example.com/my-logo.png
478+
```
479+
480+
**Convention-based detection**: If `logo_url` is not set in the YAML, the API automatically checks for a `logo.*` file in the community's folder (`src/assistants/{id}/`). Supported formats: SVG, PNG, JPG, JPEG, WEBP. SVG is preferred over other formats when multiple exist. The file is served via the `GET /{community_id}/logo` endpoint.
481+
482+
**Precedence** (highest to lowest):
483+
484+
1. Widget JS `setConfig({ logo: 'url' })` -- embedder override
485+
2. YAML `widget.logo_url` -- community maintainer sets explicit URL
486+
3. Convention file -- `logo.png` or `logo.svg` in `src/assistants/{id}/`
487+
4. Default brain icon (built into the widget)
488+
489+
### Example
454490

455491
```yaml
456492
widget:
457493
title: HED Assistant
494+
theme_color: "#1a365d"
458495
initial_message: "Hi! I'm the HED Assistant. I can help with HED annotation, validation, and related tools."
459496
placeholder: Ask about HED...
460497
suggested_questions:
@@ -466,14 +503,35 @@ widget:
466503

467504
When the widget is embedded on a page, it fetches community defaults from `GET /communities` and applies them automatically. Embedders can still override any field via `setConfig()` in JavaScript; see the [Widget Deployment Guide](../deployment/widget.md).
468505

469-
If `widget` is omitted, the widget falls back to generic defaults (title = community name, placeholder = "Ask a question...").
506+
If `widget` is omitted, the widget falls back to generic defaults (title = community name, placeholder = "Ask a question...", platform blue theme, brain icon).
470507

471508
## `enable_page_context`
472509

473510
When `true` (default), the assistant includes a `fetch_current_page` tool that retrieves content from the web page where the widget is embedded. This allows the assistant to provide contextually relevant answers based on what the user is currently reading.
474511

475512
Set to `false` if the assistant will only be used via CLI or API (not embedded in a web page).
476513

514+
## `links`
515+
516+
External links for the community, exposed via the `/communities` API endpoint. Only populated links are included in the response.
517+
518+
| Field | Type | Required | Default | Description |
519+
|-------|------|----------|---------|-------------|
520+
| `homepage` | URL | No | `null` | Primary community website |
521+
| `documentation` | URL | No | `null` | Documentation or tutorials URL |
522+
| `repository` | URL | No | `null` | Source code repository (GitHub org or repo) |
523+
| `demo` | URL | No | `null` | Live demo page URL |
524+
525+
```yaml
526+
links:
527+
homepage: https://www.fieldtriptoolbox.org
528+
documentation: https://www.fieldtriptoolbox.org/tutorial/
529+
repository: https://github.com/fieldtrip/fieldtrip
530+
demo: https://demo.osc.earth/fieldtrip
531+
```
532+
533+
All fields are optional. If no links are provided, the `links` field is `null` in the API response.
534+
477535
## Complete Example
478536

479537
```yaml
@@ -519,12 +577,18 @@ citations:
519577
520578
widget:
521579
title: HED Assistant
580+
theme_color: "#1a365d"
522581
initial_message: "Hi! I'm the HED Assistant. I can help with HED annotations."
523582
placeholder: Ask about HED...
524583
suggested_questions:
525584
- What is HED and how is it used?
526585
- How do I annotate an event with HED tags?
527586
587+
links:
588+
homepage: https://www.hedtags.org
589+
documentation: https://www.hed-resources.org
590+
repository: https://github.com/hed-standard
591+
528592
discourse:
529593
- url: https://neurostars.org
530594
tags:

docs/osa/tools/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Tools for working with the EEGLAB analysis toolbox.
2828

2929
**Status:** Available
3030

31+
### FieldTrip Tools
32+
33+
Tools for working with the FieldTrip MEG/EEG/iEEG analysis toolbox.
34+
35+
Uses the standard knowledge discovery tools (document retrieval, GitHub search, paper search, docstring search). No community-specific custom tools.
36+
37+
**Status:** Available
38+
3139
### NEMAR Tools
3240

3341
Tools for discovering and exploring BIDS-formatted datasets from the NeuroElectroMagnetic Archive (NEMAR).

0 commit comments

Comments
 (0)