AI Feedback Loop
AI
Trust
Governor
Collect user feedback on AI responses with multiple feedback types including thumbs up/down, star ratings, quick tags, and detailed comments. Enables continuous improvement of AI outputs.
Compact Variant
Minimal inline thumbs up/down
Was this helpful?
Inline - Thumbs
Thumbs feedback with expandable comments
Was this response helpful?
Inline - Star Rating
5-star rating system
Was this response helpful?
Quick Feedback Tags
Pre-defined feedback options
Was this response helpful?
Card with Suggestions
Full featured card with improvement suggestions
Was this response helpful?
Your feedback improves AI responses
Submitted State
Thank you message after submission
Thanks! Your feedback helps improve AI responses.
Props
AIFeedbackLoop component API reference
| Prop | Type | Default | Description |
|---|---|---|---|
type | 'thumbs' | 'rating' | 'detailed' | 'quick' | 'thumbs' | Type of feedback collection |
quickOptions | FeedbackOption[] | — | Quick feedback options for the quick type |
showCategories | boolean | false | Show category selection (accuracy, helpfulness, etc) |
allowComments | boolean | true | Allow text comments |
onFeedbackSubmit | (feedback: FeedbackData) => void | — | Callback when feedback is submitted |
submitted | boolean | false | Whether feedback has been submitted |
thankYouMessage | string | "Thanks for your feedback!" | Message to show after submission |
promptLabel | string | "Was this response helpful?" | Label for the feedback prompt |
variant | 'inline' | 'card' | 'compact' | 'floating' | 'inline' | Display mode variant |
showImprovementSuggestions | boolean | false | Show improvement suggestions after negative feedback |
improvementSuggestions | string[] | — | Suggestions for improvement |
onRetryWithSuggestions | (suggestions: string[]) => void | — | Callback when user requests retry with suggestions |
loading | boolean | false | Loading state |
className | string | — | Additional CSS classes |
FeedbackData Type
| Prop | Type | Default | Description |
|---|---|---|---|
sentiment | 'positive' | 'negative' | 'neutral' | — | Overall feedback sentiment |
rating | number | — | Star rating (1-5) |
categories | FeedbackCategory[] | — | Selected feedback categories |
comment | string | — | User comment text |
quickFeedback | string[] | — | Selected quick feedback option IDs |
timestamp* | Date | — | When feedback was submitted |
Usage
Import and implementation example
import { AIFeedbackLoop } from '@/blocks/ai-transparency/ai-feedback-loop'
export default function ChatMessage() { const handleFeedback = (feedback) => { console.log('User feedback:', feedback) // Send to analytics or backend // Update AI model based on feedback }
const handleRetryWithSuggestions = (suggestions) => { console.log('Retry with:', suggestions) // Regenerate response with suggestions }
return ( <div> {/* Inline thumbs */} <AIFeedbackLoop type="thumbs" variant="inline" allowComments={true} onFeedbackSubmit={handleFeedback} />
{/* Star rating */} <AIFeedbackLoop type="rating" variant="card" showCategories={true} allowComments={true} onFeedbackSubmit={handleFeedback} />
{/* With improvement suggestions */} <AIFeedbackLoop type="thumbs" variant="card" showImprovementSuggestions={true} improvementSuggestions={[ 'More examples', 'Simpler language', 'More details', ]} onFeedbackSubmit={handleFeedback} onRetryWithSuggestions={handleRetryWithSuggestions} /> </div> )}Built With
3 componentsThis block uses the following UI components from the design system:
Features
Built-in functionality
- Multiple feedback types: Thumbs, star rating, quick tags, and detailed feedback
- Expandable comments: Optional text area for detailed feedback
- Category selection: Pre-defined categories (accuracy, helpfulness, clarity, etc)
- Improvement suggestions: Show actionable suggestions after negative feedback
- Retry with feedback: Allow users to regenerate with selected improvements
- Quick feedback options: Customizable quick-select buttons with icons
- Sentiment tracking: Automatic sentiment classification
- Thank you state: Confirmation message after submission
- Compact mode: Minimal version for toolbars and tight spaces
- Dark mode support: Full dark mode with proper contrast
Accessibility
ARIA support and keyboard navigation
ARIA Attributes
All interactive elements use semantic buttonsStar ratings use button elements with aria-labelForm inputs have proper labelsKeyboard Navigation
| Key | Action |
|---|---|
| Tab | Navigate through feedback options |
| Enter / Space | Select feedback option |
| Arrow keys | Navigate star rating |
Notes
- Color is not the only indicator - icons and text labels included
- Loading states disable interactions to prevent double submission
- Error states provide clear feedback
- Consider adding aria-live regions for dynamic feedback