From 0a4853bcdac67e90daa89921de3d2619f90b7765 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Feb 2026 19:12:59 +0100 Subject: [PATCH] Clean up: Remove all old widgets, keep only V2 (disabled by default) --- app/api/ai/voice-chat/route.ts | 98 ---------- app/page.tsx | 6 +- components/MiniMaxVoiceWidget.tsx | 277 ---------------------------- components/SiteMenteVoiceWidget.tsx | 262 -------------------------- components/SynthflowWidget.tsx | 235 ----------------------- voice-widget-guide.md | 134 -------------- 6 files changed, 4 insertions(+), 1008 deletions(-) delete mode 100644 app/api/ai/voice-chat/route.ts delete mode 100644 components/MiniMaxVoiceWidget.tsx delete mode 100644 components/SiteMenteVoiceWidget.tsx delete mode 100644 components/SynthflowWidget.tsx delete mode 100644 voice-widget-guide.md diff --git a/app/api/ai/voice-chat/route.ts b/app/api/ai/voice-chat/route.ts deleted file mode 100644 index cff6050..0000000 --- a/app/api/ai/voice-chat/route.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { NextRequest, NextResponse } from "next/server"; - -// MiniMax API configuration -const MINIMAX_API_KEY = process.env.MINIMAX_API_KEY || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJTaXRlTWVudGUiLCJyb2xlIjoiYW5vbiIsImlhdCI6MTczODcxMjAwMCwiZXhwIjoyMDU0MzcyMDAwfQ.VxYNdTUkG4N0K2T8K3pK4JzY3vN8X9vK2pK3JzY2vN8X9"; -const MINIMAX_BASE_URL = "https://api.minimax.chat/v1"; - -interface Message { - role: "user" | "assistant"; - content: string; -} - -interface RequestBody { - message: string; - language: "es" | "en"; - businessType: string; - businessName: string; - history?: Message[]; -} - -export async function POST(request: NextRequest) { - try { - const body: RequestBody = await request.json(); - const { message, language, businessType, businessName, history = [] } = body; - - // Build conversation context - const systemPrompt = `You are a friendly AI assistant for ${businessName}, a ${businessType} business. - -IMPORTANT RULES: -- Always respond in the SAME language the user uses -- Default to Spanish (respond in Spanish unless user clearly speaks English) -- Keep responses SHORT: 1-3 sentences max -- Be helpful, friendly, and professional -- If asked about pricing, mention: €299-€1,950/month depending on plan -- If asked about booking, say you'll help them book -- Never make up specific prices or details you don't know - -Current language mode: ${language}`; - - // Build messages array - const messages: Message[] = [ - { role: "assistant", content: systemPrompt } - ]; - - // Add history (last 5 messages for context) - if (history.length > 0) { - messages.push(...history.slice(-5)); - } - - // Add current message - messages.push({ role: "user", content: message }); - - // Call MiniMax API - const response = await fetch(`${MINIMAX_BASE_URL}/text/chatcompletion_v2`, { - method: "POST", - headers: { - "Authorization": `Bearer ${MINIMAX_API_KEY}`, - "Content-Type": "application/json" - }, - body: JSON.stringify({ - model: "MiniMax-M2.5", - messages, - temperature: 0.7, - max_tokens: 500 - }) - }); - - if (!response.ok) { - const error = await response.text(); - console.error("MiniMax API error:", error); - - // Fallback response - const fallbackResponse = language === "es" - ? "Lo siento, tuve un problema técnico. ¿Puedes repetir tu pregunta?" - : "Sorry, I had a technical issue. Can you repeat your question?"; - - return NextResponse.json({ response: fallbackResponse }); - } - - const data = await response.json(); - const aiResponse = data.choices?.[0]?.message?.content || - data.reply || - (language === "es" - ? "Gracias por tu mensaje. ¿En qué más puedo ayudarte?" - : "Thanks for your message. How else can I help you?"); - - return NextResponse.json({ response: aiResponse }); - - } catch (error) { - console.error("Voice chat API error:", error); - return NextResponse.json( - { error: "Internal server error" }, - { status: 500 } - ); - } -} - -// Disable body parsing for streaming if needed -export const runtime = "nodejs"; diff --git a/app/page.tsx b/app/page.tsx index 421ed13..a1d84fb 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -8,7 +8,8 @@ import HeroSlider, { import JsonLdSchemas from "../components/site-mente/JsonLdSchemas"; import ServicesAndPricing from "../components/site-mente/ServicesAndPricing"; import SeoMeta from "../components/site-mente/SeoMeta"; -import SiteMenteVoiceWidget from "../components/SiteMenteVoiceWidget"; +// Old widget disabled - using V2 only +// import SiteMenteVoiceWidget from "../components/SiteMenteVoiceWidget"; const fadeUp = { hidden: { opacity: 0, y: 24 }, @@ -781,7 +782,8 @@ export default function HomePage() {
- + {/* Old widget disabled - V2 coming soon */} + {/* */}