Lee Thanh commited on
Commit
a66ab2d
1 Parent(s): 29a0ef7

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +8 -1
index.js CHANGED
@@ -7,12 +7,14 @@ const cloudflareToken = 'NB-sxyNA3JSyhezy2fUnTnXc3Pf7i8X17BJfBwLx';
7
  const bot = new TelegramBot(telegramToken, {polling: true});
8
 
9
  console.log('Load bot success..')
10
- console.log('Can use!')
11
 
12
  bot.on('message', (msg) => {
13
  const chatId = msg.chat.id;
14
  const userMessage = msg.text;
15
 
 
 
16
  axios.post('https://api.cloudflare.com/client/v4/accounts/d888e02cee618e93b19cd9e7717da715/ai/run/@cf/mistral/mistral-7b-instruct-v0.1', {
17
  prompt: userMessage
18
  }, {
@@ -21,9 +23,14 @@ bot.on('message', (msg) => {
21
  }
22
  }).then(response => {
23
  const aiResponse = response.data.result.response;
 
 
 
24
  bot.sendMessage(chatId, aiResponse);
25
  }).catch(error => {
26
  bot.sendMessage(chatId, 'Something wrong please send again message!');
27
  console.error(error);
28
  });
 
 
29
  });
 
7
  const bot = new TelegramBot(telegramToken, {polling: true});
8
 
9
  console.log('Load bot success..')
10
+ console.log('---------------------------------')
11
 
12
  bot.on('message', (msg) => {
13
  const chatId = msg.chat.id;
14
  const userMessage = msg.text;
15
 
16
+ console.log("You: ", userMessage)
17
+
18
  axios.post('https://api.cloudflare.com/client/v4/accounts/d888e02cee618e93b19cd9e7717da715/ai/run/@cf/mistral/mistral-7b-instruct-v0.1', {
19
  prompt: userMessage
20
  }, {
 
23
  }
24
  }).then(response => {
25
  const aiResponse = response.data.result.response;
26
+
27
+ console.log('AI: ', aiResponse)
28
+
29
  bot.sendMessage(chatId, aiResponse);
30
  }).catch(error => {
31
  bot.sendMessage(chatId, 'Something wrong please send again message!');
32
  console.error(error);
33
  });
34
+
35
+ console.log('---------------------------------')
36
  });