UI Decision Layer
The UI Decision Layer is the core of Fidus's AI-Driven UI. It analyzes user context and dynamically decides which UI form to render—then actually renders it.
⚠️ Note: This demo uses a mock decision service with heuristics. In production, the UIDecisionLayer calls an LLM (GPT-4, Claude, etc.) to make context-aware decisions. The architecture and component rendering work exactly as in production.
Why This Matters: Real Examples
1. Expert vs Beginner
Query: "Create a budget"
- • Expert (9/10): → Form (fast, no handholding)
- • Beginner (2/10): → Wizard (guided, explained)
2. Time-Sensitive vs Planning
Query: "My schedule"
- • Morning (7 AM): → Today's widget (urgent)
- • Sunday: → Week calendar (planning)
3. Context from History
Query: "Show budget"
- • Recently overspent: → Alert + advice
- • On track: → Simple widget
- • First time: → Tutorial + setup wizard
4. No Fixed Navigation
Traditional app: Finance tab → Always same screen
- • Urgent: Budget alert card
- • Normal: Spending trends
- • Empty state: Setup prompt
How It Works
Decision → Registry → Render
Interactive Demo
Enter a query and adjust context to see how the UI Decision Layer chooses AND RENDERS the appropriate UI component.
Key Principles
- ✅ Context-Adaptive: Same query → Different UI based on situation
- ✅ Dynamic Rendering: Components rendered at runtime, not hardcoded routes
- ✅ Component Registry: Centralized mapping of component types to React components
- ✅ Props Generation: LLM generates appropriate props (pre-filled forms, data)
- ✅ Explainable: Every decision includes reasoning
- ✅ User-Optimized: Expertise level influences UI complexity
Real-World Examples
Same Intent, Different Context = Different UI
The power of AI-Driven UI is that the same user intent produces different interfaces based on context:
Scenario 1: "I need to budget for groceries"
Scenario 2: "I need to budget for groceries"
Scenario 3: "I need to budget for groceries"
Context-Aware Proactivity
The UI Decision Layer doesn't just react—it adapts proactively:
- Morning commute (7:30 AM): "My schedule" → Shows today's appointments as widget (time-sensitive)
- Planning session (Sunday afternoon): "My schedule" → Shows calendar view (week overview)
- After meeting invite: "My schedule" → Shows conflict checker form (action-oriented)
No Fixed Screens, Only Opportunities
- • Budget overage? → Show alert card
- • Upcoming bill? → Show payment reminder
- • Nothing urgent? → Show spending trends
Implementation in Production
// Backend: UI Decision Layer Service
class UIDecisionLayerService {
async decide(context: UserContext): Promise<UIDecision> {
// Call LLM with context
const llmResponse = await this.llm.chat({
messages: [
{
role: 'system',
content: 'You are a UI decision engine. Analyze context and decide optimal UI form.'
},
{
role: 'user',
content: JSON.stringify(context)
}
]
});
// Parse LLM response
return {
uiForm: llmResponse.uiForm,
componentType: llmResponse.componentType,
props: llmResponse.props,
confidence: llmResponse.confidence,
explanation: llmResponse.reasoning
};
}
}
// Frontend: Dynamic Rendering
function DynamicUI({ decision }: { decision: UIDecision }) {
const Component = ComponentRegistry.get(decision.componentType);
if (!Component) {
console.error(`Component ${decision.componentType} not found`);
return <ErrorFallback />;
}
return <Component {...decision.props} />;
}Related Documentation
- Component Registry - Component mapping and resolution
- API Response Schema - Structure of UI metadata
- AI-Driven UI Paradigm - Core principles and philosophy