Frank Kaumba commited on
Commit
93ee963
·
unverified ·
1 Parent(s): 59a0dc0

Update ai.js

Browse files
Files changed (1) hide show
  1. plugins/ai.js +22 -17
plugins/ai.js CHANGED
@@ -21,26 +21,31 @@ const config = require('../config');
21
  const { cmd, commands } = require('../command');
22
 
23
  cmd({
24
- pattern: "ai",
25
- desc: "💬 Chat with AI Assistant",
26
- react: "🧠",
27
- category: "ai",
28
- filename: __filename
29
  },
30
  async (conn, mek, m, { from, q, reply }) => {
31
- try {
32
- if (!q) return reply("❗ Please provide a query. Usage: .ai [your message]");
33
 
34
- const response = await axios.get(`https://api.giftedtech.my.id/api/ai/gpt?apikey=gifted&q=${encodeURIComponent(q)}`);
35
-
36
- const aiReply = `🤖 *AI Assistant*:
37
- ${response.data.response}
 
 
 
 
 
38
 
39
  *POWERED BY MR FRANK*`;
40
 
41
- return reply(aiReply);
42
- } catch (e) {
43
- console.log(e);
44
- return reply("⚠️ An error occurred while fetching AI response. Please try again later.");
45
- }
46
- });
 
21
  const { cmd, commands } = require('../command');
22
 
23
  cmd({
24
+ pattern: "ai",
25
+ desc: "💬 Chat with Gemini Pro AI",
26
+ react: "🧠",
27
+ category: "ai",
28
+ filename: __filename
29
  },
30
  async (conn, mek, m, { from, q, reply }) => {
31
+ try {
32
+ if (!q) return reply("❗ Please provide a query. Usage: .ai [your message]");
33
 
34
+ const response = await axios.get(`https://kaiz-apis.gleeze.com/api/gemini-pro`, {
35
+ params: {
36
+ q: q,
37
+ uid: "1" // You might want to make this dynamic based on user ID
38
+ }
39
+ });
40
+
41
+ const aiReply = `🤖 *Gemini Pro AI*:
42
+ ${response.data.message}
43
 
44
  *POWERED BY MR FRANK*`;
45
 
46
+ return reply(aiReply);
47
+ } catch (e) {
48
+ console.log(e);
49
+ return reply("⚠️ An error occurred while fetching AI response. Please try again later.");
50
+ }
51
+ });