feat: multi-select AI types in configurator
Some checks failed
Build & Push / build-and-push (push) Failing after 34s

- Changed aiType (string|null) to aiTypes (string[]) across all components
- StepServices: chips now toggle on/off independently, descriptions show for all selected
- StepContact: summary tags show all selected AI types
- API route: handles array of AI types for both AI and fallback brief generation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 18:06:44 +01:00
parent acefb70b68
commit bbe5b6c67e
4 changed files with 40 additions and 29 deletions

View File

@@ -6,7 +6,7 @@ import { sendBriefToClient, sendLeadNotification } from '@/lib/email';
interface ConfigureRequestBody {
services: string[];
aiEnabled: boolean;
aiType: string | null;
aiTypes: string[];
industry: string | null;
scope: string;
timeline: string | null;
@@ -52,7 +52,9 @@ function buildContext(body: ConfigureRequestBody): string {
const industry = body.industry ? INDUSTRY_NAMES[body.industry] ?? body.industry : 'Not specified';
const timeline = body.timeline ? TIMELINE_NAMES[body.timeline] ?? body.timeline : 'Not specified';
const company = body.company.trim() || 'Not specified';
const aiType = body.aiEnabled && body.aiType ? AI_TYPE_NAMES[body.aiType] ?? body.aiType : null;
const aiTypeNames = body.aiEnabled && body.aiTypes.length > 0
? body.aiTypes.map((t) => AI_TYPE_NAMES[t] ?? t).join(', ')
: null;
let context = `Client Name: ${body.name}
Company: ${company}
@@ -61,7 +63,7 @@ Industry: ${industry}
Timeline: ${timeline}`;
if (body.aiEnabled) {
context += `\nAI Integration: Yes — ${aiType ?? 'type to be determined'}`;
context += `\nAI Integration: Yes — ${aiTypeNames ?? 'type to be determined'}`;
}
if (body.scope.trim()) {
@@ -150,7 +152,7 @@ ${context}`;
// ─── Fallback Brief (no API key or API failure) ──────────────────────────────
function generateFallbackBrief(body: ConfigureRequestBody): string {
const { services, aiEnabled, aiType, industry, scope, timeline, name, company } = body;
const { services, aiEnabled, aiTypes, industry, scope, timeline, name, company } = body;
const serviceNames = services.map((s) => SERVICE_NAMES[s] ?? s);
const servicesList = serviceNames.length <= 2
@@ -179,9 +181,11 @@ function generateFallbackBrief(body: ConfigureRequestBody): string {
if (hasInfra) {
sections += `\n**Private Infrastructure**\nWe'll set up a dedicated server environment for ${displayCompany} with email, cloud storage, and business tools that you fully own and control.\n`;
}
if (aiEnabled && aiType) {
const aiLabel = AI_TYPE_NAMES[aiType] ?? 'AI integration';
sections += `\n**AI Integration**\nWe'll layer ${aiLabel.toLowerCase()} into your systems — deeply integrated, not bolted on. The exact approach will be scoped during discovery.\n`;
if (aiEnabled && aiTypes.length > 0) {
const aiLabels = aiTypes.map((t) => AI_TYPE_NAMES[t] ?? t).join(', ');
sections += `\n**AI Integration**\nWe'll layer ${aiLabels.toLowerCase()} into your systems — deeply integrated, not bolted on. The exact approach will be scoped during discovery.\n`;
} else if (aiEnabled) {
sections += `\n**AI Integration**\nWe'll layer AI integration into your systems — deeply integrated, not bolted on. The exact approach will be scoped during discovery.\n`;
}
if (scope?.trim()) {
sections += `\n**Your Goals**\nYou shared: "${scope.trim()}" — we'll frame our discovery sessions around these priorities.\n`;