WINS REVENUE💸💵💸

Welcome

Welcome to WINS REVENUE💸💵💸. This website provides helpful information, guides, and online resources for users.

Our goal is to maintain transparency, simplicity, and a positive user experience on all devices.

Ai cloud flare

const GROQ_API_KEY = "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"; const TAVILY_API_KEY = "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"; const MODEL = "llama-3.3-70b-versatile"; /* ========================= 🧠 ROUTER ========================= */ function routeQuery(text) { const t = text.toLowerCase(); if (/\b(bukas|ngayon|petsa|araw|oras|what time|what date)\b/.test(t)) return "local"; if (/\b(news|latest|update|search|hanapin|weather|current)\b/.test(t)) return "web"; return "ai"; } /* ========================= 🕒 LOCAL BRAIN ========================= */ function handleLocal(text) { const now = new Date(); if (text.toLowerCase().includes("bukas")) { const d = new Date(now); d.setDate(d.getDate() + 1); return `Bukas ay ${d.toLocaleDateString("fil-PH", { weekday: "long", year: "numeric", month: "long", day: "numeric" })}`; } return `Ngayon ay ${now.toLocaleDateString("fil-PH", { weekday: "long", year: "numeric", month: "long", day: "numeric" })}`; } /* ========================= 🤖 GROQ SAFE ========================= */ async function callGroq(messages) { try { const res = await fetch( "https://api.groq.com/openai/v1/chat/completions", { method: "POST", headers: { "Content-Type": "application/json", Authorization: "Bearer " + GROQ_API_KEY }, body: JSON.stringify({ model: MODEL, messages, temperature: 0.7 }) } ); const data = await res.json(); if (!data.choices?.[0]?.message?.content) { console.log("GROQ ERROR:", data); return "Error sa AI response."; } return data.choices[0].message.content; } catch (e) { return "AI service error."; } } /* ========================= 🌐 TAVILY SAFE ========================= */ async function tavilySearch(query) { try { const res = await fetch("https://api.tavily.com/search", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ api_key: TAVILY_API_KEY, query, max_results: 5 }) }); const data = await res.json(); if (!data?.results) return null; return data.results .map(r => `Title: ${r.title}\nContent: ${r.content}`) .join("\n\n"); } catch (e) { return null; } } /* ========================= 💾 KV MEMORY ========================= */ async function saveMemory(env, id, data) { await env.MEMORY.put(id, JSON.stringify(data)); } async function getMemory(env, id) { const data = await env.MEMORY.get(id); return data ? JSON.parse(data) : null; } /* ========================= 🌟 ORIGINAL UI (RESTORED) ========================= */ const HTML = ` Tech Nethan24 AI

Tech Nethan24 AI

Groq + Tavily AI Search

Online
`; /* ========================= 🚀 WORKER ========================= */ export default { async fetch(request, env) { const url = new URL(request.url); if (url.pathname === "/") { return new Response(HTML, { headers: { "Content-Type": "text/html" } }); } if (url.pathname === "/api/chat") { try { const { userText, messages } = await request.json(); const sessionId = request.headers.get("cf-connecting-ip") || "default"; const route = routeQuery(userText); /* LOCAL */ if (route === "local") { const reply = handleLocal(userText); await saveMemory(env, sessionId, { lastUser: userText, lastAI: reply }); return Response.json({ reply }); } /* WEB */ if (route === "web") { const web = await tavilySearch(userText); let reply; if (web) { reply = await callGroq([ { role: "system", content: "Use ONLY this data:\n" + web }, { role: "user", content: userText } ]); } else { reply = "Hindi kumpleto ang web results, pero eto ang best answer ko."; } await saveMemory(env, sessionId, { lastUser: userText, lastAI: reply }); return Response.json({ reply }); } /* AI */ const memory = await getMemory(env, sessionId); const finalMessages = [ { role: "system", content: "You are Tech Nethan24 AI." }, ...(memory ? [{ role: "system", content: `Memory:\nUser:${memory.lastUser}\nAI:${memory.lastAI}` }] : []), ...messages, { role: "user", content: userText } ]; const reply = await callGroq(finalMessages); await saveMemory(env, sessionId, { lastUser: userText, lastAI: reply }); return Response.json({ reply }); } catch (e) { console.log(e); return Response.json({ reply: "Connection error." }, { status: 500 }); } } return new Response("Not found", { status: 404 }); } };

"Onces you Carry your Own water, you'll know the value of every drops"

Search This Blog

Powered by Blogger.

Blog Archive

About Us

WINS REVENUE💸💵💸 is an independent informational website. We publish content for general knowledge and educational purposes.

Our goal is to maintain honesty, transparency, and usability while keeping the website safe and accessible for all users.

Privacy Policy

We value your privacy. Information collected may include IP address, browser type, referring pages, and basic usage data.

Cookies may be used to improve user experience. Third-party ad networks may display ads on this site.

By using this website, you consent to this Privacy Policy.

Disclaimer

All information on this website is for general informational purposes. Accuracy or completeness is not guaranteed.

Any action taken based on this information is at your own risk. We are not liable for losses or damages.

Contact Us

For inquiries or concerns, contact us via email:

📧 revenuewins@gmail.com

Advertising Disclosure

This website may display advertisements from third-party ad networks. Ads help support our content at no additional cost to users.