Upload case.js
Browse files
case.js
CHANGED
@@ -1757,13 +1757,15 @@ case 'update': {
|
|
1757 |
}
|
1758 |
case 'llama3.4': {
|
1759 |
if (!q) return reply("❌ Please enter a question or prompt.\n\nExample: .llama3.4 What is AI?");
|
1760 |
-
|
1761 |
-
|
1762 |
-
let apiUrl = `https://api.siputzx.my.id/api/ai/meta-llama-33-70B-instruct-turbo?query=${encodeURIComponent(q)}`;
|
1763 |
let imageUrl = "https://huggingface.co/spaces/API-XX/TEST/resolve/main/Links/Llama3.4.jpg";
|
|
|
|
|
|
|
|
|
1764 |
|
1765 |
try {
|
1766 |
-
let response = await fetch(apiUrl);
|
1767 |
let json = await response.json();
|
1768 |
|
1769 |
if (!json.status || !json.data) {
|
@@ -1772,10 +1774,12 @@ case 'update': {
|
|
1772 |
|
1773 |
let aiResponse = json.data;
|
1774 |
|
|
|
1775 |
await conn.sendMessage(m.chat, {
|
|
|
1776 |
image: { url: imageUrl },
|
1777 |
caption: fontx(`🤖 *Llama 3.4 AI Response*\n\n💬 *Query:* ${q}\n🧠 *Response:* ${aiResponse}\n> ${caption}`)
|
1778 |
-
}
|
1779 |
|
1780 |
} catch (error) {
|
1781 |
console.error("Error fetching Llama 3.4 response:", error);
|
|
|
1757 |
}
|
1758 |
case 'llama3.4': {
|
1759 |
if (!q) return reply("❌ Please enter a question or prompt.\n\nExample: .llama3.4 What is AI?");
|
1760 |
+
|
|
|
|
|
1761 |
let imageUrl = "https://huggingface.co/spaces/API-XX/TEST/resolve/main/Links/Llama3.4.jpg";
|
1762 |
+
let apiUrl = `https://api.siputzx.my.id/api/ai/meta-llama-33-70B-instruct-turbo?query=${encodeURIComponent(q)}`;
|
1763 |
+
|
1764 |
+
// Send a loading message first
|
1765 |
+
let loadingMsg = await conn.sendMessage(m.chat, { text: fontx("⏳ *Llama 3.4 is thinking...* Please wait.") }, { quoted: m });
|
1766 |
|
1767 |
try {
|
1768 |
+
let response = await fetch(apiUrl, { timeout: 60000 }); // Wait up to 60 seconds
|
1769 |
let json = await response.json();
|
1770 |
|
1771 |
if (!json.status || !json.data) {
|
|
|
1774 |
|
1775 |
let aiResponse = json.data;
|
1776 |
|
1777 |
+
// Edit the loading message with the AI response
|
1778 |
await conn.sendMessage(m.chat, {
|
1779 |
+
edit: loadingMsg.key,
|
1780 |
image: { url: imageUrl },
|
1781 |
caption: fontx(`🤖 *Llama 3.4 AI Response*\n\n💬 *Query:* ${q}\n🧠 *Response:* ${aiResponse}\n> ${caption}`)
|
1782 |
+
});
|
1783 |
|
1784 |
} catch (error) {
|
1785 |
console.error("Error fetching Llama 3.4 response:", error);
|