import { generateSiteMenteText, type SiteMenteMessage, } from "./minimaxClient"; 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[]): SiteMenteMessage[] => { return [{ role: "system" as const, content: SYSTEM_PROMPT }, ...messages]; }; export const runSiteMenteText = async ( request: SiteMenteTextRequest ): Promise => { const reply = await generateSiteMenteText(withSystemPrompt(request.messages)); return { reply }; }; export const runSiteMenteVoiceTurn = async ( request: SiteMenteVoiceRequest ): Promise => { const messages: SiteMenteMessage[] = [ { role: "user", content: request.transcript }, ]; const reply = await generateSiteMenteText(withSystemPrompt(messages)); // Return text only - Vapi handles voice output on their end return { reply, audio: { data: "", mimeType: "audio/mp3", }, }; };