fix: use predefined values for tool calls, improve completion flow
Some checks failed
Build & Push / build-and-push (push) Has been cancelled

- System prompt now specifies exact predefined values for services/industries/timelines
- Agent instructed to call complete_brief IMMEDIATELY when name+email confirmed
- Chip labels fall back to raw value for unknown keys instead of showing i18n path
- Added completion transition logging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 14:49:56 +01:00
parent 66949c07d8
commit 1e41c1c07c
2 changed files with 28 additions and 9 deletions

View File

@@ -75,7 +75,9 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) {
// Handle completion
useEffect(() => {
if (completedBrief && completedFormData) {
console.log('[VoiceAgent] Brief complete, transitioning in 1.5s...');
const timer = setTimeout(() => {
console.log('[VoiceAgent] Calling onComplete');
onComplete(completedBrief, completedFormData);
}, 1500);
return () => clearTimeout(timer);
@@ -94,23 +96,30 @@ export default function VoiceAgent({ locale, onComplete }: VoiceAgentProps) {
['0px 0px 0px rgba(0,100,148,0)', '0px 0px 30px rgba(0,100,148,0.3)'],
);
// Build selection chips
// Build selection chips — use i18n for known keys, raw value otherwise
const KNOWN_SERVICES = ['web', 'systems', 'infrastructure'];
const KNOWN_AI_TYPES = ['teammate', 'customer-facing', 'data-intelligence', 'notsure'];
const KNOWN_INDUSTRIES = ['maritime', 'hospitality', 'technology', 'realestate', 'finance', 'ngo', 'other'];
const KNOWN_TIMELINES = ['asap', '1-3months', '3-6months', 'exploring'];
const chipLabels: string[] = [];
if (selections.services) {
for (const svc of selections.services) {
try { chipLabels.push(t(`services.${svc}.title`)); } catch { chipLabels.push(svc); }
chipLabels.push(KNOWN_SERVICES.includes(svc) ? t(`services.${svc}.title`) : svc);
}
}
if (selections.aiEnabled && selections.aiTypes) {
for (const ai of selections.aiTypes) {
try { chipLabels.push(t(`aiTypes.${ai}.title`)); } catch { chipLabels.push(ai); }
chipLabels.push(KNOWN_AI_TYPES.includes(ai) ? t(`aiTypes.${ai}.title`) : ai);
}
}
if (selections.industry) {
try { chipLabels.push(t(`industries.${selections.industry}`)); } catch { chipLabels.push(selections.industry); }
const ind = selections.industry;
chipLabels.push(KNOWN_INDUSTRIES.includes(ind) ? t(`industries.${ind}`) : ind);
}
if (selections.timeline) {
try { chipLabels.push(t(`timelines.${selections.timeline}`)); } catch { chipLabels.push(selections.timeline); }
const tl = selections.timeline;
chipLabels.push(KNOWN_TIMELINES.includes(tl) ? t(`timelines.${tl}`) : tl);
}
return (