Eidetic

AI Prompt Enhancer

AI
Authoring
Block

AI-assisted prompt improvement component that shows the original and enhanced versions of a user's prompt, with individual suggestions for clarity, specificity, context, tone, and structure.

Card Variant

Full card with suggestions and quality score

Enhanced Prompt

3 improvements suggested

35%88%
quality score

What is the best laptop for software development under $1500 in 2024? Compare the top 3 options with pros and cons for each.

Specificity

Added use case and budget constraint for more targeted results

Context

Added time context to get current recommendations

Structure

Added output format for a structured response

Diff Variant

Side-by-side comparison

Prompt Enhancement

2 improvements
Original

Explain machine learning

Enhanced

Explain machine learning to a beginner with 3 practical examples from everyday life, using simple language and no technical jargon.

28%82%quality

Inline Variant

Compact inline suggestion

Fix the TypeError in my React component's useEffect hook — the state update runs after unmount

Loading State

Skeleton while enhancement is being generated

Props

AIPromptEnhancer component API reference

PropTypeDefaultDescription
originalPrompt*stringThe original user prompt
enhancedPrompt*stringThe AI-enhanced version
suggestionsEnhancementSuggestion[]Individual improvement suggestions
qualityBeforenumberQuality score before enhancement (0-100)
qualityAfternumberQuality score after enhancement (0-100)
variant'card' | 'inline' | 'diff''card'Display variant
loadingbooleanfalseShow loading skeleton
onAccept(enhancedPrompt: string) => voidCallback when user accepts enhancement
onReject() => voidCallback when user keeps original
onAcceptSuggestion(suggestionId: string) => voidCallback for individual suggestion accept

Usage

Import and implementation example

import { AIPromptEnhancer } from '@/blocks/ai-conversation/ai-prompt-enhancer'
<AIPromptEnhancer
originalPrompt="What's the best laptop?"
enhancedPrompt="What is the best laptop for development under $1500?"
suggestions={[
{
id: '1',
type: 'specificity',
original: 'best laptop',
enhanced: 'best laptop for development under $1500',
reason: 'Added use case and budget',
},
]}
qualityBefore={35}
qualityAfter={88}
onAccept={(prompt) => setPrompt(prompt)}
onReject={() => setShowEnhancer(false)}
/>

Built With

2 components

This block uses the following UI components from the design system:

Features

Built-in functionality

  • Three variants: Card, inline, and side-by-side diff modes
  • Quality scoring: Before/after quality score visualization
  • Categorized suggestions: Clarity, specificity, context, tone, and structure categories
  • Original toggle: Show/hide the original prompt for comparison
  • Loading state: Skeleton loading while enhancement generates
  • Individual accepts: Accept individual suggestions independently

Accessibility

Accessibility considerations

ARIA Attributes

Enhancement differences conveyed through text and layout

Keyboard Navigation

KeyAction
TabNavigate between actions
Enter / SpaceActivate accept/reject buttons

Notes

  • Quality scores use numeric values for screen readers
  • Loading state uses aria-busy pattern