HerzaJ commited on
Commit
79b96bf
·
verified ·
1 Parent(s): b1d256f

Update plugins/aimodel.js

Browse files
Files changed (1) hide show
  1. plugins/aimodel.js +7 -24
plugins/aimodel.js CHANGED
@@ -1,5 +1,4 @@
1
  const axios = require('axios');
2
- const puppeteer = require('puppeteer');
3
  const { v4: uuidv4 } = require('uuid');
4
 
5
  const models = {
@@ -14,27 +13,12 @@ const models = {
14
  };
15
 
16
  async function aichat(question, model) {
17
- const browser = await puppeteer.launch({
18
- headless: true,
19
- args: ['--no-sandbox', '--disable-setuid-sandbox']
20
- });
21
-
22
- const page = await browser.newPage();
23
- await page.setUserAgent('Mozilla/5.0 (Linux; Android 15; SM-F958 Build/AP3A.240905.015) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.86 Mobile Safari/537.36');
24
-
25
- await page.goto('https://chatgptfree.ai/', { waitUntil: 'networkidle2' });
26
 
27
- const html = await page.content();
28
- const cookies = await page.cookies();
29
-
30
- await browser.close();
31
-
32
- let nonce = html.match(/"nonce"\s*:\s*"([^&]+)"/);
33
  if (!nonce) throw new Error('Nonce not found.');
34
 
35
- let cookieString = cookies.map(c => `${c.name}=${c.value}`).join('; ');
36
-
37
- let { data } = await axios.post('https://chatgptfree.ai/wp-admin/admin-ajax.php', new URLSearchParams({
38
  action: 'aipkit_frontend_chat_message',
39
  _ajax_nonce: nonce[1],
40
  bot_id: models[model],
@@ -47,8 +31,7 @@ async function aichat(question, model) {
47
  'Content-Type': 'application/x-www-form-urlencoded',
48
  'Origin': 'https://chatgptfree.ai',
49
  'Referer': 'https://chatgptfree.ai/',
50
- 'User-Agent': 'Mozilla/5.0 (Linux; Android 15; SM-F958 Build/AP3A.240905.015) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.86 Mobile Safari/537.36',
51
- 'Cookie': cookieString
52
  }
53
  });
54
 
@@ -96,12 +79,12 @@ const handler = async (req, res) => {
96
  };
97
 
98
  module.exports = {
99
- name: 'AI Chat',
100
- description: 'Generate responses using multiple AI models',
101
  type: 'GET',
102
  routes: ['api/AI/chat'],
103
  tags: ['ai', 'gpt', 'gemini', 'claude', 'deepseek'],
104
- parameters: ['text', 'model'],
105
  enabled: true,
106
  main: ['AI'],
107
  handler
 
1
  const axios = require('axios');
 
2
  const { v4: uuidv4 } = require('uuid');
3
 
4
  const models = {
 
13
  };
14
 
15
  async function aichat(question, model) {
16
+ let { data: html } = await axios.get(`https://px.nekolabs.my.id/${encodeURIComponent('https://chatgptfree.ai/')}`);
 
 
 
 
 
 
 
 
17
 
18
+ let nonce = html.data.content.match(/"nonce"\s*:\s*"([^&]+)"/);
 
 
 
 
 
19
  if (!nonce) throw new Error('Nonce not found.');
20
 
21
+ let { data } = await axios.post(`https://px.nekolabs.my.id/${encodeURIComponent('https://chatgptfree.ai/wp-admin/admin-ajax.php')}`, new URLSearchParams({
 
 
22
  action: 'aipkit_frontend_chat_message',
23
  _ajax_nonce: nonce[1],
24
  bot_id: models[model],
 
31
  'Content-Type': 'application/x-www-form-urlencoded',
32
  'Origin': 'https://chatgptfree.ai',
33
  'Referer': 'https://chatgptfree.ai/',
34
+ 'User-Agent': 'Mozilla/5.0 (Linux; Android 15; SM-F958 Build/AP3A.240905.015) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.86 Mobile Safari/537.36'
 
35
  }
36
  });
37
 
 
79
  };
80
 
81
  module.exports = {
82
+ name: 'Model AI Chat',
83
+ description: 'Generate responses using multiple AI models, availabe models is Claude, gpt-4o-mini, gpt-5-nano, gemini, deepseek, grok, meta-ai, qwen',
84
  type: 'GET',
85
  routes: ['api/AI/chat'],
86
  tags: ['ai', 'gpt', 'gemini', 'claude', 'deepseek'],
87
+ parameters: ['text', 'model', 'key'],
88
  enabled: true,
89
  main: ['AI'],
90
  handler