feat(desk): 24/7 Sovereign Aira 3 Ultra support, purge phone number & enforce code block shield
This commit is contained in:
1 parent
061dbb8a1f
commit
a8d79e19bb
3 files changed
+95
-113
No files matched your search
@@ -284,8 +284,7 @@ export function getWelcomeEmailHtml(name) {
|
||||
Aira Group of Technology
|
||||
</div>
|
||||
<div style="font-size: 12px; color: #64748b; margin-top: 8px; line-height: 1.5;">
|
||||
<a href="mailto:adameehan34@gmail.com" style="color: #1d4ed8; text-decoration: none;">adameehan34@gmail.com</a>
|
||||
• +91 8921 584 368
|
||||
<a href="mailto:contact@airaaigroup.in" style="color: #1d4ed8; text-decoration: none;">contact@airaaigroup.in</a>
|
||||
• <a href="https://airaaigroup.in" style="color: #1d4ed8; text-decoration: none;">airaaigroup.in</a>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
+78
-95
@@ -1,12 +1,10 @@
|
||||
/**
|
||||
* 🚀 Sovereign AIRA Founder Desk Gateway (Vercel Serverless - ES Module)
|
||||
* Connects airaaigroup.in visitors directly to Founder Er. Adam Eehan's WhatsApp
|
||||
* Fallback to Sovereign Aira 3 Ultra (https://airaai-8ibs.onrender.com)
|
||||
* 24/7 Sovereign Customer Support & Solutions AI for Er. Adam Eehan & Aira Group
|
||||
* Strict Anti-Bot Verification: Google Sign-In Required
|
||||
*/
|
||||
|
||||
const RENDER_BRIDGE_URL = process.env.RENDER_BRIDGE_URL || "https://aira-whatsapp-bridge.onrender.com";
|
||||
const AIRA_ENDPOINT = process.env.AIRA_API_URL || "https://airaai-8ibs.onrender.com/v1/chat/completions";
|
||||
const FOUNDER_PHONE = "918921584368";
|
||||
|
||||
const OR_KEYS = [
|
||||
Buffer.from("c2stb3ItdjEtMTMwMmY5MTQ0Yjg2ZThhNTMxNzg5Nzc2ZTMwYzM0OGI5NjZlNjNiYTM0MWZhNzFjNDYzNGUxNGE0ZWRjNWUwZA==", "base64").toString("utf-8"),
|
||||
@@ -17,57 +15,43 @@ const OR_KEYS = [
|
||||
function sanitizeAiResponse(text) {
|
||||
if (!text) return "";
|
||||
let clean = text.trim();
|
||||
// Strip code blocks if any leaked through
|
||||
clean = clean.replace(/```[\s\S]*?```/g, () => {
|
||||
return "[Aira Group specializes in custom enterprise AI & software solutions. For technical implementations or project development, please schedule a consultation with Founder Er. Adam Eehan or contact contact@airaaigroup.in]";
|
||||
});
|
||||
clean = clean.replace(/(\b[\w'-]+\b)(?:\s+\1){2,}/gi, '$1');
|
||||
clean = clean.replace(/(.{8,40}?)(?:\s*\1){2,}/gi, '$1');
|
||||
return clean.trim();
|
||||
}
|
||||
|
||||
// Fallback Aira 3 Ultra AI Query
|
||||
async function queryAiraUltraDirect(userName, message) {
|
||||
async function queryAiraUltraSupport(userName, message) {
|
||||
const systemPrompt =
|
||||
`You are Aira 3 Ultra, sovereign executive AI co-pilot engineered by Er. Adam Eehan (Founder & CEO of Aira Group of Technology).
|
||||
You are assisting on Er. Adam Eehan's Direct Desk at airaaigroup.in.
|
||||
Er. Adam has received the visitor's inquiry live on his personal WhatsApp (+91 8921 584 368) and will review it.
|
||||
In the meantime, respond warmly, intelligently, and concisely on behalf of the Founder.
|
||||
`You are AIRA (Aira 3 Ultra, Engine v3.6), the official sovereign Customer Support & Executive AI of Aira Group of Technology, engineered by Founder & CEO Er. Adam Eehan.
|
||||
You are active 24/7 on Er. Adam Eehan's Direct Desk at airaaigroup.in.
|
||||
|
||||
Language Directives:
|
||||
- Detect and match the visitor's language naturally.
|
||||
- If the visitor speaks in Malayalam or Manglish, reply in authentic Malayalam/Manglish. NEVER use Hindi or broken mixed dialects.
|
||||
- If English, reply in polished, executive English.
|
||||
- If Hindi, Arabic, or another language, reply fluently in that language.
|
||||
- Introduce yourself as "Aira 3 Ultra (Er. Adam Eehan's Sovereign AI Co-Pilot)".
|
||||
- Keep it concise, helpful, and professional with zero robotic fluff or looping.`;
|
||||
Company & Founder Profile:
|
||||
- Founder & CEO: Er. Adam Eehan (19 years old, Diploma in Computer Engineering from SBTE Kerala, Google Student Ambassador 2026 Cohort, Wikidata: Q141755677).
|
||||
- Company: Aira Group of Technology (airaaigroup.in) - Leading research and development in Sovereign AI, autonomous agents, neural architectures, web & mobile engineering, and enterprise digital solutions.
|
||||
- Official Contact: contact@airaaigroup.in / adameehan.airagroup@gmail.com.
|
||||
|
||||
// 1. Try Primary Cloud API
|
||||
try {
|
||||
const res = await fetch(AIRA_ENDPOINT, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model: "aira-3-ultra",
|
||||
messages: [
|
||||
{ role: "system", content: systemPrompt },
|
||||
{ role: "user", content: message }
|
||||
],
|
||||
max_tokens: 450,
|
||||
temperature: 0.7
|
||||
}),
|
||||
signal: AbortSignal.timeout(12000)
|
||||
});
|
||||
STRICT OPERATIONAL RULES:
|
||||
1. NEVER WRITE OR OUTPUT RAW CODE:
|
||||
- If the user asks for Python, HTML, CSS, JavaScript, scripts, or coding homework, DO NOT write or provide the source code!
|
||||
- Instead, politely explain as a professional Customer Support AI:
|
||||
"Aira Group of Technology builds custom enterprise AI and software solutions. For custom coding projects, technical implementations, or consultation, please connect with Founder Er. Adam Eehan or reach out via contact@airaaigroup.in!"
|
||||
2. ROLE: Professional, warm, articulate Customer Support AI:
|
||||
- Answer inquiries about Aira Group's platforms, AI capabilities, web & app development services, and business collaborations.
|
||||
3. LANGUAGE DIRECTIVES:
|
||||
- Match the visitor's language naturally.
|
||||
- If the visitor speaks in Malayalam, reply in natural, fluent Malayalam.
|
||||
- If the visitor speaks in Manglish (Malayalam written in English script), reply in authentic, friendly Manglish.
|
||||
- If English, reply in polished, articulate executive English.
|
||||
- If Hindi, Arabic, or another language, reply fluently in that language.
|
||||
4. TONE & CONCISENESS:
|
||||
- Keep replies concise (2 to 4 sentences or a crisp paragraph).
|
||||
- Zero corporate HR fluff, robotic disclaimers, or repetitive token loops.`;
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
const content = data?.choices?.[0]?.message?.content;
|
||||
if (content) {
|
||||
const clean = sanitizeAiResponse(content);
|
||||
if (clean && clean.length > 10) return clean;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Aira Ultra Primary fetch warning:", err.message);
|
||||
}
|
||||
|
||||
// 2. High-Precision OpenRouter Swarm with Repetition Penalty
|
||||
// 1. Multi-Key OpenRouter Swarm with Repetition Penalty & Fast Latency
|
||||
for (const key of OR_KEYS) {
|
||||
try {
|
||||
const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
|
||||
@@ -82,12 +66,12 @@ Language Directives:
|
||||
{ role: "system", content: systemPrompt },
|
||||
{ role: "user", content: message }
|
||||
],
|
||||
max_tokens: 450,
|
||||
temperature: 0.7,
|
||||
max_tokens: 350,
|
||||
temperature: 0.5,
|
||||
frequency_penalty: 0.5,
|
||||
presence_penalty: 0.5
|
||||
}),
|
||||
signal: AbortSignal.timeout(10000)
|
||||
signal: AbortSignal.timeout(9000)
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
@@ -95,7 +79,7 @@ Language Directives:
|
||||
const content = data?.choices?.[0]?.message?.content;
|
||||
if (content) {
|
||||
const clean = sanitizeAiResponse(content);
|
||||
if (clean && clean.length > 10) return clean;
|
||||
if (clean && clean.length > 5) return clean;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -103,7 +87,34 @@ Language Directives:
|
||||
}
|
||||
}
|
||||
|
||||
return `Hello ${userName}! Er. Adam Eehan has received your message on his personal WhatsApp (+91 8921 584 368) and will reply shortly. Thank you for connecting with Aira Group!`;
|
||||
// 2. Primary Cloud Backend Fallback
|
||||
try {
|
||||
const res = await fetch(AIRA_ENDPOINT, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
model: "aira-3-ultra",
|
||||
messages: [
|
||||
{ role: "system", content: systemPrompt },
|
||||
{ role: "user", content: message }
|
||||
],
|
||||
max_tokens: 350,
|
||||
temperature: 0.5
|
||||
}),
|
||||
signal: AbortSignal.timeout(8000)
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
const content = data?.choices?.[0]?.message?.content;
|
||||
if (content) {
|
||||
const clean = sanitizeAiResponse(content);
|
||||
if (clean && clean.length > 5) return clean;
|
||||
}
|
||||
}
|
||||
} catch (err) {}
|
||||
|
||||
return `Hello ${userName}! Welcome to Aira Group of Technology. I am Aira 3 Ultra, Founder Er. Adam Eehan's sovereign AI assistant. For project inquiries and software solutions, feel free to reach out via contact@airaaigroup.in!`;
|
||||
}
|
||||
|
||||
export default async function handler(req, res) {
|
||||
@@ -115,71 +126,43 @@ export default async function handler(req, res) {
|
||||
return res.status(200).end();
|
||||
}
|
||||
|
||||
// GET: Poll for messages or check status
|
||||
// GET: Health / Status
|
||||
if (req.method === "GET") {
|
||||
const { userId, after } = req.query || {};
|
||||
|
||||
try {
|
||||
const bridgeUrl = `${RENDER_BRIDGE_URL}/api/desk/poll?userId=${encodeURIComponent(userId || "")}&after=${encodeURIComponent(after || 0)}`;
|
||||
const bridgeRes = await fetch(bridgeUrl, { signal: AbortSignal.timeout(3500) });
|
||||
if (bridgeRes.ok) {
|
||||
const data = await bridgeRes.json();
|
||||
return res.status(200).json(data);
|
||||
}
|
||||
} catch (e) {
|
||||
// Bridge sleeping or waking up
|
||||
}
|
||||
|
||||
return res.status(200).json({
|
||||
online: true,
|
||||
messages: [],
|
||||
service: "Aira 3 Ultra Sovereign Customer Support",
|
||||
founder: "Er. Adam Eehan",
|
||||
phone: `+${FOUNDER_PHONE}`
|
||||
company: "Aira Group of Technology",
|
||||
authRequired: true
|
||||
});
|
||||
}
|
||||
|
||||
// POST: Send visitor message
|
||||
// POST: Chat Message
|
||||
if (req.method === "POST") {
|
||||
const { userId, userName, userEmail, userAvatar, message } = req.body || {};
|
||||
|
||||
if (!userId || !message || !message.trim()) {
|
||||
return res.status(400).json({ error: "Missing userId or message" });
|
||||
}
|
||||
|
||||
let bridgeSuccess = false;
|
||||
let aiResponse = null;
|
||||
|
||||
// 1. Try sending to Render WhatsApp Bridge
|
||||
try {
|
||||
const bridgeRes = await fetch(`${RENDER_BRIDGE_URL}/api/desk/send`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ userId, userName, userEmail, userAvatar, message }),
|
||||
signal: AbortSignal.timeout(6000)
|
||||
// Strict Anti-Bot Gate: User MUST be signed in with Google
|
||||
if (!userId || !userEmail) {
|
||||
return res.status(401).json({
|
||||
error: "Google Sign-In required. Please sign in to verify you are human and prevent bot abuse."
|
||||
});
|
||||
|
||||
if (bridgeRes.ok) {
|
||||
bridgeSuccess = true;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("Render Bridge unreachable, falling back to direct Aira 3 Ultra...");
|
||||
}
|
||||
|
||||
// 2. If Render Bridge was unreachable, provide instant Aira 3 Ultra response
|
||||
if (!bridgeSuccess) {
|
||||
aiResponse = await queryAiraUltraDirect(userName || "Visitor", message);
|
||||
if (!message || !message.trim()) {
|
||||
return res.status(400).json({ error: "Message cannot be empty." });
|
||||
}
|
||||
|
||||
const aiResponse = await queryAiraUltraSupport(userName || "Visitor", message.trim());
|
||||
|
||||
return res.status(200).json({
|
||||
success: true,
|
||||
deliveredToBridge: bridgeSuccess,
|
||||
aiReply: aiResponse ? {
|
||||
aiReply: {
|
||||
id: `ai_${Date.now()}`,
|
||||
sender: "aira_ultra",
|
||||
senderName: "Aira 3 Ultra (Co-Pilot)",
|
||||
senderName: "Aira 3 Ultra (Support AI)",
|
||||
text: aiResponse,
|
||||
timestamp: Date.now()
|
||||
} : null
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+16
-16
@@ -1099,10 +1099,10 @@
|
||||
<a href="#contact" class="btn-primary inline-block text-white px-8 py-4 rounded-lg font-semibold shadow-lg shadow-blue-600/30">
|
||||
Partner With Our Founder
|
||||
</a>
|
||||
<a href="https://wa.me/918921584368?text=Hello%20Er.%20Adam%20Eehan,%20I%20would%20like%20to%20discuss%20a%20project%20with%20Aira%20Group." target="_blank" class="bg-emerald-600 hover:bg-emerald-700 text-white px-6 py-4 rounded-lg font-semibold inline-flex items-center gap-2 shadow-lg shadow-emerald-600/30 transition-all duration-300">
|
||||
<i class="fab fa-whatsapp text-lg"></i>
|
||||
<span>Direct WhatsApp Inquiry</span>
|
||||
</a>
|
||||
<button onclick="openFounderDesk()" class="bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white px-6 py-4 rounded-lg font-semibold inline-flex items-center gap-2 shadow-lg shadow-blue-600/30 transition-all duration-300 cursor-pointer">
|
||||
<i class="fas fa-comment-dots text-lg"></i>
|
||||
<span>Chat with Founder Desk</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1477,15 +1477,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-start gap-4 group">
|
||||
<div class="flex items-start gap-4 group cursor-pointer" onclick="openFounderDesk()">
|
||||
<div
|
||||
class="w-12 h-12 rounded-lg bg-blue-50 flex items-center justify-center flex-shrink-0 group-hover:bg-blue-100 transition-colors duration-300"
|
||||
>
|
||||
<i class="fas fa-phone text-blue-600"></i>
|
||||
<i class="fas fa-headset text-blue-600"></i>
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-bold text-[#0a2342] mb-1">Phone</div>
|
||||
<div class="text-slate-600">+91 8921 584 368</div>
|
||||
<div class="font-bold text-[#0a2342] mb-1">Direct Desk Support</div>
|
||||
<div class="text-blue-600 hover:underline text-sm font-medium">Chat 24/7 with Aira AI</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2275,7 +2275,7 @@
|
||||
/>
|
||||
<span
|
||||
class="absolute bottom-0 right-0 w-3 h-3 bg-emerald-400 border-2 border-[#0a2342] rounded-full"
|
||||
title="Online on WhatsApp"
|
||||
title="Online 24/7"
|
||||
></span>
|
||||
</div>
|
||||
<div>
|
||||
@@ -2286,7 +2286,7 @@
|
||||
<p class="text-[11px] text-blue-200 font-medium">Founder & CEO • Direct Line</p>
|
||||
<div class="flex items-center gap-1.5 mt-0.5">
|
||||
<span class="w-1.5 h-1.5 rounded-full bg-emerald-400"></span>
|
||||
<span class="text-[10px] text-emerald-300 font-mono tracking-tight">WhatsApp Linked • Aira 3 Ultra Ready</span>
|
||||
<span class="text-[10px] text-emerald-300 font-mono tracking-tight">24/7 Sovereign Desk • Aira 3 Ultra Active</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2308,12 +2308,12 @@
|
||||
</div>
|
||||
<h4 class="font-bold text-slate-800 text-base mb-1">Founder Direct Desk</h4>
|
||||
<p class="text-xs text-slate-500 mb-5 leading-relaxed max-w-xs">
|
||||
To eliminate spam and bots, please sign in with Google to connect directly with Er. Adam Eehan's WhatsApp.
|
||||
To eliminate spam and bots, please sign in with Google to chat with Sovereign Aira 3 Ultra (Customer Support & Executive AI).
|
||||
</p>
|
||||
<div id="desk-google-signin-btn" class="flex justify-center min-h-[44px]"></div>
|
||||
<div class="mt-4 text-[10px] text-slate-400 flex items-center gap-1">
|
||||
<i class="fas fa-shield-alt text-emerald-500"></i>
|
||||
<span>Verified Human Access • Direct WhatsApp Relay</span>
|
||||
<span>Verified Human Access • 24/7 AI Customer Support</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2338,7 +2338,7 @@
|
||||
<span>Er. Adam Eehan</span>
|
||||
<span class="bg-blue-100 text-blue-700 text-[9px] px-1.5 py-0.2 rounded-full">Founder & CEO</span>
|
||||
</div>
|
||||
Hello! Welcome to my Direct Desk. Any message you send here is delivered directly to my personal WhatsApp. Feel free to discuss projects, tech collaborations, or questions. If I am away or occupied, our sovereign Aira 3 Ultra co-pilot will assist you immediately!
|
||||
Hello! Welcome to the Direct Desk of Aira Group of Technology. I am Er. Adam Eehan (Founder & CEO). Our sovereign AI, Aira 3 Ultra, is active 24/7 right here to assist you with inquiries, tech collaborations, AI solutions, and software services. How can we help you today?
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2365,7 +2365,7 @@
|
||||
</div>
|
||||
<div class="text-center mt-1.5">
|
||||
<span class="text-[10px] text-slate-400 flex items-center justify-center gap-1 font-medium">
|
||||
<i class="fab fa-whatsapp text-emerald-500"></i> Direct WhatsApp Relay • Aira 3 Ultra Co-Pilot
|
||||
<i class="fas fa-robot text-purple-600"></i> 24/7 Customer Support • Sovereign Aira 3 Ultra
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2388,7 +2388,7 @@
|
||||
<span>Chat with Founder</span>
|
||||
<span class="w-1.5 h-1.5 rounded-full bg-emerald-400 animate-pulse"></span>
|
||||
</div>
|
||||
<div class="text-[10px] text-cyan-300">Er. Adam Eehan • WhatsApp Live</div>
|
||||
<div class="text-[10px] text-cyan-300">Er. Adam Eehan • Aira 3 Ultra 24/7</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
@@ -2799,7 +2799,7 @@
|
||||
|
||||
const typingEl = appendDeskMessageUI({
|
||||
sender: "aira_ultra",
|
||||
text: "Relaying message directly to Er. Adam Eehan's WhatsApp..."
|
||||
text: "Aira 3 Ultra is thinking..."
|
||||
}, true);
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user