Initial commit
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
import { GoogleGenAI } from "@google/genai";
|
||||
|
||||
export type SiteMenteMessage = {
|
||||
role: "user" | "assistant" | "system";
|
||||
content: string;
|
||||
};
|
||||
|
||||
export type SiteMenteSpeechResult = {
|
||||
audioBytes: Uint8Array;
|
||||
mimeType: string;
|
||||
};
|
||||
|
||||
const TEXT_MODEL = "gemini-2.5-flash";
|
||||
const SPEECH_MODEL = "gemini-2.5-flash-preview-tts";
|
||||
|
||||
const getClient = () => {
|
||||
const apiKey = process.env.GEMINI_API_KEY;
|
||||
if (!apiKey) {
|
||||
throw new Error("GEMINI_API_KEY is not set.");
|
||||
}
|
||||
return new GoogleGenAI({ apiKey });
|
||||
};
|
||||
|
||||
const extractText = (response: unknown): string => {
|
||||
const typed = response as {
|
||||
candidates?: Array<{
|
||||
content?: { parts?: Array<{ text?: string }> };
|
||||
}>;
|
||||
};
|
||||
const text =
|
||||
typed?.candidates?.[0]?.content?.parts
|
||||
?.map((part) => part.text ?? "")
|
||||
.join("")
|
||||
.trim() ?? "";
|
||||
|
||||
if (!text) {
|
||||
throw new Error("Gemini returned an empty response.");
|
||||
}
|
||||
|
||||
return text;
|
||||
};
|
||||
|
||||
const extractAudio = (response: unknown): SiteMenteSpeechResult => {
|
||||
const typed = response as {
|
||||
candidates?: Array<{
|
||||
content?: {
|
||||
parts?: Array<{
|
||||
inlineData?: { data?: string; mimeType?: string };
|
||||
}>;
|
||||
};
|
||||
}>;
|
||||
};
|
||||
const inlineData =
|
||||
typed?.candidates?.[0]?.content?.parts?.find((part) => part.inlineData)
|
||||
?.inlineData ?? null;
|
||||
|
||||
if (!inlineData?.data || !inlineData?.mimeType) {
|
||||
throw new Error("Gemini did not return audio data.");
|
||||
}
|
||||
|
||||
const audioBytes = Uint8Array.from(
|
||||
Buffer.from(inlineData.data, "base64")
|
||||
);
|
||||
|
||||
return { audioBytes, mimeType: inlineData.mimeType };
|
||||
};
|
||||
|
||||
const buildContents = (messages: SiteMenteMessage[]) => {
|
||||
return messages
|
||||
.filter((message) => message.role !== "system")
|
||||
.map((message) => ({
|
||||
role: message.role === "assistant" ? "model" : "user",
|
||||
parts: [{ text: message.content }],
|
||||
}));
|
||||
};
|
||||
|
||||
const buildSystemInstruction = (messages: SiteMenteMessage[]) => {
|
||||
const systemText = messages
|
||||
.filter((message) => message.role === "system")
|
||||
.map((message) => message.content)
|
||||
.join("\n")
|
||||
.trim();
|
||||
|
||||
if (!systemText) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return { parts: [{ text: systemText }] };
|
||||
};
|
||||
|
||||
export const generateSiteMenteText = async (
|
||||
messages: SiteMenteMessage[]
|
||||
): Promise<string> => {
|
||||
try {
|
||||
const client = getClient();
|
||||
const response = await client.models.generateContent({
|
||||
model: TEXT_MODEL,
|
||||
contents: buildContents(messages),
|
||||
systemInstruction: buildSystemInstruction(messages),
|
||||
});
|
||||
return extractText(response);
|
||||
} catch (error) {
|
||||
console.error("[SiteMente][Gemini] Text generation failed", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
export const generateSiteMenteSpeech = async (
|
||||
text: string
|
||||
): Promise<SiteMenteSpeechResult> => {
|
||||
try {
|
||||
const client = getClient();
|
||||
const response = await client.models.generateContent({
|
||||
model: SPEECH_MODEL,
|
||||
contents: [{ role: "user", parts: [{ text }] }],
|
||||
config: {
|
||||
responseModalities: ["AUDIO"],
|
||||
speechConfig: {
|
||||
voiceConfig: {
|
||||
prebuiltVoiceConfig: {
|
||||
voiceName: "Kore",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
return extractAudio(response);
|
||||
} catch (error) {
|
||||
console.error("[SiteMente][Gemini] Speech generation failed", error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
import {
|
||||
generateSiteMenteSpeech,
|
||||
generateSiteMenteText,
|
||||
type SiteMenteMessage,
|
||||
} from "./geminiClient";
|
||||
|
||||
export type SiteMenteTextRequest = {
|
||||
messages: SiteMenteMessage[];
|
||||
};
|
||||
|
||||
export type SiteMenteTextResponse = {
|
||||
reply: string;
|
||||
};
|
||||
|
||||
export type SiteMenteVoiceRequest = {
|
||||
transcript: string;
|
||||
};
|
||||
|
||||
export type SiteMenteVoiceResponse = {
|
||||
reply: string;
|
||||
audio: {
|
||||
data: string;
|
||||
mimeType: string;
|
||||
};
|
||||
};
|
||||
|
||||
const SYSTEM_PROMPT = [
|
||||
"You are SiteMente, an AI site strategist that helps business owners make their websites think like a smart assistant.",
|
||||
"You deeply understand landing pages, funnels, customer psychology, and automation.",
|
||||
"You recommend specific AI Minds, suggest copy and UX changes, and ask focused clarifying questions before proposing changes.",
|
||||
"Keep answers concise, practical, and business-oriented.",
|
||||
].join(" ");
|
||||
|
||||
const withSystemPrompt = (messages: SiteMenteMessage[]) => {
|
||||
return [{ role: "system", content: SYSTEM_PROMPT }, ...messages];
|
||||
};
|
||||
|
||||
export const runSiteMenteText = async (
|
||||
request: SiteMenteTextRequest
|
||||
): Promise<SiteMenteTextResponse> => {
|
||||
const reply = await generateSiteMenteText(withSystemPrompt(request.messages));
|
||||
return { reply };
|
||||
};
|
||||
|
||||
export const runSiteMenteVoiceTurn = async (
|
||||
request: SiteMenteVoiceRequest
|
||||
): Promise<SiteMenteVoiceResponse> => {
|
||||
const messages: SiteMenteMessage[] = [
|
||||
{ role: "user", content: request.transcript },
|
||||
];
|
||||
const reply = await generateSiteMenteText(withSystemPrompt(messages));
|
||||
const audio = await generateSiteMenteSpeech(reply);
|
||||
|
||||
return {
|
||||
reply,
|
||||
audio: {
|
||||
data: Buffer.from(audio.audioBytes).toString("base64"),
|
||||
mimeType: audio.mimeType,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,305 @@
|
||||
export const siteMenteKnowledge = {
|
||||
company: {
|
||||
name: "SiteMente",
|
||||
location: "Málaga, Costa del Sol, España",
|
||||
parentOrganization: "HolaCompi",
|
||||
languages: ["ES", "EN"],
|
||||
description: {
|
||||
es: "Agencia de implementación de IA para negocios locales en España.",
|
||||
en: "AI implementation agency for local businesses in Spain.",
|
||||
},
|
||||
},
|
||||
services: {
|
||||
es: [
|
||||
{
|
||||
name: "Smart Starter - AI Chat + Reservas Automatizadas",
|
||||
priceMonthlyEur: 299,
|
||||
setupFeeEur: 900,
|
||||
audience: "Restaurantes, clínicas, negocios locales",
|
||||
description:
|
||||
"Chat IA para sitio web con reservas automatizadas, captura de leads y análisis básicos.",
|
||||
features: [
|
||||
"Chat IA en la web (1 idioma)",
|
||||
"Reservas y captación de leads",
|
||||
"Bandeja ligera de leads",
|
||||
"Analíticas básicas",
|
||||
],
|
||||
optionalAddons: [
|
||||
"+WhatsApp (+100€/mes)",
|
||||
"+Idioma extra (+80€/mes)",
|
||||
],
|
||||
term: "6-12 meses",
|
||||
},
|
||||
{
|
||||
name: "Smart Site - Web Inteligente Completa",
|
||||
priceMonthlyEur: 749,
|
||||
setupFeeEur: 3500,
|
||||
audience: "Negocios listos para una web moderna",
|
||||
description:
|
||||
"Sitio web Next.js completo con IA integrada que vende, reserva y da soporte en español e inglés.",
|
||||
features: [
|
||||
"Todo lo incluido en Starter",
|
||||
"Nuevo sitio web Next.js",
|
||||
"WhatsApp incluido",
|
||||
"2 idiomas (ES+EN)",
|
||||
"Sugerencias de contenido con IA",
|
||||
"Analíticas avanzadas",
|
||||
],
|
||||
optionalAddons: [
|
||||
"+Llamadas de voz (+150€/mes)",
|
||||
"+Ubicación extra (+120€/mes)",
|
||||
],
|
||||
term: "6-12 meses",
|
||||
},
|
||||
{
|
||||
name: "AI Growth Partner",
|
||||
priceMonthlyEur: 1950,
|
||||
setupFeeEur: 5000,
|
||||
audience: "Grupos de restaurantes, inmobiliarias, cadenas de alquiler",
|
||||
description:
|
||||
"Partner estratégico de IA: multicanal (web, WhatsApp, llamadas), integraciones CRM.",
|
||||
features: [
|
||||
"Todo lo incluido en Smart Site",
|
||||
"Llamadas de voz incluidas",
|
||||
"Soporte multiubicación",
|
||||
"Integraciones CRM",
|
||||
"Automatizaciones personalizadas",
|
||||
"Llamada estratégica mensual",
|
||||
"Soporte prioritario",
|
||||
],
|
||||
optionalAddons: ["+Pack de contenido IA (+200€/mes)"],
|
||||
term: "12 meses",
|
||||
},
|
||||
],
|
||||
en: [
|
||||
{
|
||||
name: "Smart Starter - AI Chat + Automated Bookings",
|
||||
priceMonthlyEur: 299,
|
||||
setupFeeEur: 900,
|
||||
audience: "Restaurants, clinics, local businesses",
|
||||
description:
|
||||
"AI website chat with automated bookings, lead capture, and basic analytics.",
|
||||
features: [
|
||||
"AI website chat (1 language)",
|
||||
"Booking & lead capture",
|
||||
"Light lead inbox",
|
||||
"Basic analytics",
|
||||
],
|
||||
optionalAddons: [
|
||||
"+WhatsApp (+100€/mo)",
|
||||
"+Extra language (+80€/mo)",
|
||||
],
|
||||
term: "6-12 months",
|
||||
},
|
||||
{
|
||||
name: "Smart Site - Full Smart Website",
|
||||
priceMonthlyEur: 749,
|
||||
setupFeeEur: 3500,
|
||||
audience: "Businesses ready for a modern website",
|
||||
description:
|
||||
"Complete Next.js website with integrated AI that sells, books, and supports in Spanish and English.",
|
||||
features: [
|
||||
"Everything in Starter",
|
||||
"New Next.js website",
|
||||
"WhatsApp included",
|
||||
"2 languages (ES+EN)",
|
||||
"AI content suggestions",
|
||||
"Advanced analytics",
|
||||
],
|
||||
optionalAddons: [
|
||||
"+Voice calls (+150€/mo)",
|
||||
"+Extra location (+120€/mo)",
|
||||
],
|
||||
term: "6-12 months",
|
||||
},
|
||||
{
|
||||
name: "AI Growth Partner",
|
||||
priceMonthlyEur: 1950,
|
||||
setupFeeEur: 5000,
|
||||
audience: "Restaurant groups, real estate teams, rental chains",
|
||||
description:
|
||||
"Strategic AI partner: multichannel (web, WhatsApp, calls), CRM integrations.",
|
||||
features: [
|
||||
"Everything in Smart Site",
|
||||
"Voice calls included",
|
||||
"Multi-location support",
|
||||
"CRM integrations",
|
||||
"Custom automations",
|
||||
"Monthly strategy call",
|
||||
"Priority support",
|
||||
],
|
||||
optionalAddons: ["+AI content pack (+200€/mo)"],
|
||||
term: "12 months",
|
||||
},
|
||||
],
|
||||
},
|
||||
testimonials: {
|
||||
es: [
|
||||
{
|
||||
industry: "Restaurantes",
|
||||
location: "Marbella",
|
||||
highlight: "+43% reservas nocturnas",
|
||||
quote:
|
||||
"Desde que instalamos el chatbot de SiteMente, nuestras reservas nocturnas aumentaron un 43%. Ya no perdemos clientes que buscan mesa después de las 22h.",
|
||||
},
|
||||
{
|
||||
industry: "Inmobiliarias",
|
||||
location: "Málaga",
|
||||
highlight: "70% consultas automatizadas",
|
||||
quote:
|
||||
"La IA responde el 70% de las consultas sobre propiedades automáticamente. Mi equipo ahora se enfoca solo en visitas cualificadas. ROI positivo en el primer mes.",
|
||||
},
|
||||
{
|
||||
industry: "Rent a Car",
|
||||
location: "Benalmádena",
|
||||
highlight: "ROI en menos de 6 semanas",
|
||||
quote:
|
||||
"El sistema procesa reservas en 3 idiomas sin intervención humana. Recuperamos la inversión en menos de 6 semanas.",
|
||||
},
|
||||
],
|
||||
en: [
|
||||
{
|
||||
industry: "Restaurants",
|
||||
location: "Marbella",
|
||||
highlight: "+43% late-night bookings",
|
||||
quote:
|
||||
"Since we installed SiteMente's chatbot, our late-night bookings increased by 43%. We no longer lose customers looking for tables after 10 PM.",
|
||||
},
|
||||
{
|
||||
industry: "Real Estate",
|
||||
location: "Málaga",
|
||||
highlight: "70% inquiries automated",
|
||||
quote:
|
||||
"The AI answers 70% of property inquiries automatically. My team now focuses only on qualified viewings. Positive ROI in the first month.",
|
||||
},
|
||||
{
|
||||
industry: "Car Rental",
|
||||
location: "Benalmádena",
|
||||
highlight: "ROI in under 6 weeks",
|
||||
quote:
|
||||
"The system processes bookings in 3 languages without human intervention. We recovered our investment in less than 6 weeks.",
|
||||
},
|
||||
],
|
||||
},
|
||||
stats: [
|
||||
"+67% sales increase with AI chatbots",
|
||||
"26% of transactions influenced by AI assistants",
|
||||
"$290B conversational commerce in 2025",
|
||||
"95% of interactions expected to involve AI",
|
||||
"$14.2B Black Friday sales touched by AI",
|
||||
],
|
||||
faqs: {
|
||||
es: [
|
||||
{
|
||||
question: "¿Qué es la implementación de IA para negocios?",
|
||||
answer:
|
||||
"La implementación de IA para negocios significa instalar agentes inteligentes (chatbots, asistentes de voz, automatizaciones) en tu sitio web y canales de comunicación para que respondan preguntas, tomen reservas y vendan 24/7 sin intervención humana. En SiteMente nos especializamos en implementar estas soluciones para restaurantes, inmobiliarias y alquiler de coches en España.",
|
||||
},
|
||||
{
|
||||
question: "¿Cuánto cuesta implementar IA en mi negocio en España?",
|
||||
answer:
|
||||
"Los precios de implementación de IA en España varían según la complejidad. En SiteMente, nuestros planes comienzan desde 900€ de instalación + 299€/mes para chat IA básico con reservas, hasta planes completos desde 3.500€ + 749€/mes que incluyen sitio web nuevo con IA integrada. Todos los planes incluyen soporte en español e inglés.",
|
||||
},
|
||||
{
|
||||
question: "¿Por qué necesito IA en mi sitio web en 2026?",
|
||||
answer:
|
||||
"En 2026, el 95% de las interacciones con clientes involucran IA de alguna forma. Los estudios muestran que los negocios con chatbots de IA aumentan sus ventas en un 67% de media y reducen costes de soporte en un 30%. Si tu sitio no puede responder al instante, pierdes clientes frente a la competencia que sí tiene IA.",
|
||||
},
|
||||
{
|
||||
question: "¿La IA funciona para restaurantes pequeños en España?",
|
||||
answer:
|
||||
"Sí, especialmente bien. Los restaurantes con IA chat ven hasta un 47% más de reservas completadas porque pueden tomar pedidos y reservas 24/7, responder preguntas sobre alérgenos y menús, y sugerir platos personalizados. Muchos de nuestros clientes en la Costa del Sol son restaurantes locales que ahora captan reservas incluso a las 2-3 AM.",
|
||||
},
|
||||
{
|
||||
question: "¿Cuánto tiempo tarda en implementarse la IA?",
|
||||
answer:
|
||||
"En SiteMente implementamos la mayoría de proyectos en 48 horas para instalaciones básicas (chat IA + reservas en web existente), y entre 2-4 semanas para sitios web completos nuevos con IA integrada. Mucho más rápido que contratar personal adicional.",
|
||||
},
|
||||
{
|
||||
question: "¿La IA puede hablar en español e inglés?",
|
||||
answer:
|
||||
"Sí. Todos nuestros agentes de IA funcionan en español e inglés nativamente, perfecto para negocios en zonas turísticas como la Costa del Sol. Podemos añadir idiomas adicionales según necesidad.",
|
||||
},
|
||||
{
|
||||
question: "¿Qué negocios se benefician más de la IA?",
|
||||
answer:
|
||||
"Los negocios con alto volumen de consultas repetitivas: restaurantes (reservas, menú, alergias), inmobiliarias (propiedades disponibles, visitas), alquiler de coches (disponibilidad, precios, seguros), clínicas (citas, tratamientos), hoteles y servicios turísticos. Cualquier negocio que pierda clientes fuera de horario de atención.",
|
||||
},
|
||||
{
|
||||
question: "¿Puedo probar antes de contratar?",
|
||||
answer:
|
||||
"Sí. Reserva una demo gratuita y te mostramos cómo funcionaría la IA en tu caso específico, con ejemplos reales de tu sector. Sin compromiso.",
|
||||
},
|
||||
{
|
||||
question:
|
||||
"¿Qué pasa si mis clientes usan demasiado la IA y me cobran de más?",
|
||||
answer:
|
||||
"Todos nuestros planes incluyen uso generoso ('fair use') calculado para un negocio típico de tu tamaño. Si tu uso crece mucho (por ejemplo, abres nuevas ubicaciones o crece tu negocio), te avisamos primero y te proponemos opciones antes de cualquier cargo extra. Nunca sorpresas en la factura.",
|
||||
},
|
||||
{
|
||||
question: "¿SiteMente trabaja solo en la Costa del Sol?",
|
||||
answer:
|
||||
"No. Aunque tenemos muchos clientes en Málaga, Marbella, Benalmádena y Costa del Sol, trabajamos con negocios en toda España de forma remota. Nuestro equipo es bilingüe ES/EN y podemos implementar IA en cualquier ubicación.",
|
||||
},
|
||||
],
|
||||
en: [
|
||||
{
|
||||
question: "What is AI implementation for businesses?",
|
||||
answer:
|
||||
"AI implementation for businesses means installing intelligent agents (chatbots, voice assistants, automations) on your website and communication channels so they answer questions, take bookings, and sell 24/7 without human intervention. At SiteMente we specialize in implementing these solutions for restaurants, real estate and car rentals in Spain.",
|
||||
},
|
||||
{
|
||||
question: "How much does it cost to implement AI in my business in Spain?",
|
||||
answer:
|
||||
"AI implementation prices in Spain vary by complexity. At SiteMente, our plans start from €900 setup + €299/month for basic AI chat with bookings, up to complete packages from €3,500 + €749/month including a new website with integrated AI. All plans include support in Spanish and English.",
|
||||
},
|
||||
{
|
||||
question: "Why do I need AI on my website in 2026?",
|
||||
answer:
|
||||
"In 2026, 95% of customer interactions involve AI in some form. Studies show businesses with AI chatbots increase sales by an average of 67% and reduce support costs by 30%. If your site can't answer instantly, you lose customers to competitors that can.",
|
||||
},
|
||||
{
|
||||
question: "Does AI work for small restaurants in Spain?",
|
||||
answer:
|
||||
"Yes, especially well. Restaurants with AI chat see up to 47% more completed bookings because they can take orders and reservations 24/7, answer allergen and menu questions, and suggest personalized dishes. Many of our clients on the Costa del Sol are local restaurants now capturing bookings even at 2-3 AM.",
|
||||
},
|
||||
{
|
||||
question: "How long does AI implementation take?",
|
||||
answer:
|
||||
"At SiteMente we implement most projects in 48 hours for basic setups (AI chat + bookings on an existing site), and between 2-4 weeks for complete new websites with integrated AI. Much faster than hiring additional staff.",
|
||||
},
|
||||
{
|
||||
question: "Can the AI speak Spanish and English?",
|
||||
answer:
|
||||
"Yes. All our AI agents run natively in Spanish and English, perfect for businesses in tourist areas like the Costa del Sol. We can add additional languages as needed.",
|
||||
},
|
||||
{
|
||||
question: "What businesses benefit most from AI?",
|
||||
answer:
|
||||
"Businesses with high volumes of repetitive inquiries: restaurants (bookings, menu, allergens), real estate (available properties, viewings), car rentals (availability, prices, insurance), clinics (appointments, treatments), hotels, and tourism services. Any business that loses customers outside business hours.",
|
||||
},
|
||||
{
|
||||
question: "Can I try it before committing?",
|
||||
answer:
|
||||
"Yes. Book a free demo and we'll show how AI would work for your specific case, with real examples from your sector. No commitment.",
|
||||
},
|
||||
{
|
||||
question: "What if my customers use the AI too much and I get charged extra?",
|
||||
answer:
|
||||
"All our plans include generous fair use sized for a typical business of your size. If your usage grows significantly (for example, you open new locations or your business grows), we let you know first and propose options before any extra charges. No billing surprises.",
|
||||
},
|
||||
{
|
||||
question: "Does SiteMente work only on the Costa del Sol?",
|
||||
answer:
|
||||
"No. Although we have many clients in Málaga, Marbella, Benalmádena and the Costa del Sol, we work with businesses all across Spain remotely. Our team is bilingual ES/EN and we can implement AI in any location.",
|
||||
},
|
||||
],
|
||||
},
|
||||
useCases: [
|
||||
"Restaurantes",
|
||||
"Inmobiliarias",
|
||||
"Rent a Car",
|
||||
"Clínicas",
|
||||
"Turismo",
|
||||
],
|
||||
} as const;
|
||||
Reference in New Issue
Block a user