Frontend Integration and Types
-
Generated Types Only
web/src/types/generated.tsis the only source for API interfaces. -
Zustand Stores
Stores consume generated types; hooks expose typed accessors.
-
Components
Props derive from hooks; no custom interfaces without Pydantic ancestry.
Generate Early
Run uv run scripts/generate_types.py before starting the frontend. Hot reload relies on correct types.
Traceability
Every UI element (slider, toggle, input) must map to a Pydantic field. Tooltips come from data/glossary.json.
No Hand-Written Interfaces
Interfaces like interface SearchResponse { ... } are forbidden. Import from generated.ts.
Store and Hook Structure
| File | Purpose |
|---|---|
web/src/stores/useConfigStore.ts | Holds TriBridConfig and patch helpers |
web/src/hooks/useConfig.ts | Read/update config |
web/src/hooks/useFusion.ts | Fusion-related derived state |
web/src/hooks/useReranker.ts | Reranker configuration and status |
flowchart TB
G[generated.ts] --> S[stores]
S --> H[hooks]
H --> C[components] Example Usage
- Types generation step is mandatory
- API is the contract; no local mocks of shapes
- Fetch returns the Pydantic-driven shape of config
Tooltip Integration
data/glossary.json drives hover help via TooltipIcon in the UI. Keep term keys stable.
- Use generated types across stores, hooks, and components
- Remove any legacy custom interfaces
- Validate prop chains map back to Pydantic fields
flowchart LR
Glossary[data/glossary.json] --> Tooltip[TooltipIcon]
Tooltip --> UI Component Inventory
DockerStatusCard.tsx,HealthStatusCard.tsxshow system stateRepoSelector.tsxbinds UI tocorpus_idRAGTab.tsx,GrafanaTab.tsx,AdminTab.tsxorchestrate panels using typed hooks