feat: show "Generating your brief..." badge during brief generation
All checks were successful
Build & Push / build-and-push (push) Successful in 1m57s

Visual feedback while the complete_brief API call runs (~15s).
Badge appears below the orb with a spinner animation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 14:58:56 +01:00
parent 7fb3d85103
commit 3eae92e1c1
2 changed files with 19 additions and 1 deletions

View File

@@ -55,6 +55,7 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) {
transcript,
selections,
isAnalyzingSite,
isGeneratingBrief,
agentAmplitude,
startConversation,
endConversation,
@@ -176,7 +177,7 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) {
)}
</motion.div>
{/* Analyzing site badge */}
{/* Status badges */}
<AnimatePresence>
{isAnalyzingSite && (
<motion.div
@@ -191,6 +192,19 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) {
{t('voice.analyzingSite')}
</motion.div>
)}
{isGeneratingBrief && !completedBrief && (
<motion.div
initial={{ opacity: 0, y: -4 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -4 }}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-full bg-primary/10 text-primary-dark text-xs font-medium"
>
<motion.div animate={{ rotate: 360 }} transition={{ duration: 1, repeat: Infinity, ease: 'linear' }}>
<Loader2 size={11} />
</motion.div>
{locale === 'fr' ? 'Génération de votre brief...' : 'Generating your brief...'}
</motion.div>
)}
</AnimatePresence>
{/* Error message */}

View File

@@ -21,6 +21,7 @@ interface VoiceAgentContextValue {
transcript: TranscriptEntry[];
selections: Partial<WizardFormData>;
isAnalyzingSite: boolean;
isGeneratingBrief: boolean;
userAmplitude: number;
agentAmplitude: number;
startConversation: () => Promise<void>;
@@ -127,6 +128,7 @@ export default function VoiceAgentProvider({ locale, children }: VoiceAgentProvi
const [transcript, setTranscript] = useState<TranscriptEntry[]>([]);
const [selections, setSelections] = useState<Partial<WizardFormData>>({});
const [isAnalyzingSite, setIsAnalyzingSite] = useState(false);
const [isGeneratingBrief, setIsGeneratingBrief] = useState(false);
const [userAmplitude, setUserAmplitude] = useState(0);
const [agentAmplitude, setAgentAmplitude] = useState(0);
const [completedBrief, setCompletedBrief] = useState<string | null>(null);
@@ -195,6 +197,7 @@ export default function VoiceAgentProvider({ locale, children }: VoiceAgentProvi
// Prevent duplicate submissions
if (briefSubmittedRef.current) return JSON.stringify({ success: true, message: 'Brief already submitted' });
briefSubmittedRef.current = true;
setIsGeneratingBrief(true);
console.log('[VoiceAgent] complete_brief called, generating...');
try {
const formData = { ...DEFAULT_FORM_DATA, ...(args as Partial<WizardFormData>), locale };
@@ -475,6 +478,7 @@ export default function VoiceAgentProvider({ locale, children }: VoiceAgentProvi
transcript,
selections,
isAnalyzingSite,
isGeneratingBrief,
userAmplitude,
agentAmplitude,
startConversation,