NeuralNexusLab-Nh commited on
Commit
b8c0bb6
·
verified ·
1 Parent(s): 7ff4553

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +33 -2
index.js CHANGED
@@ -1,5 +1,7 @@
1
  function zeta (q) {
2
  const db = [
 
 
3
  `Artificial intelligence, or AI, is a technology that allows computers to learn, think, and make decisions like humans. Today, AI is used in many parts of our daily lives. It helps us find information online, recommends songs we might like, and even drives cars automatically.AI can understand language, recognize faces, and solve problems faster than people in some cases. However, AI still needs humans to guide it and make sure it is used safely. Many scientists believe that AI will continue to grow and improve, making our future smarter and more efficient. The key is to use it responsibly and for the benefit of everyone.`,
4
  `Developing AI systems requires a mix of math, programming, and creativity. Engineers begin by collecting data, which helps the AI learn patterns and make predictions. They then design a model, usually using machine-learning frameworks like TensorFlow or PyTorch. After training the model, developers test it to make sure it works correctly and safely.AI development is not only about making machines smart—it also involves careful decision-making. Developers must think about privacy, fairness, and how their technology will be used. Building AI responsibly ensures that it can help people while avoiding harmful effects. As the field grows, AI developers continue to create new tools that push technology forward and open the door to future innovations.`,
5
  `Cybersecurity is the practice of protecting computers, networks, and data from unauthorized access or attacks. In today’s digital world, people store a lot of personal information online, from bank accounts to social media. Hackers can try to steal this information or cause damage.To stay safe, organizations and individuals use strong passwords, firewalls, and encryption. Regular software updates and careful behavior online are also important. Cybersecurity is not just about technology—it is about awareness and responsibility. By following good practices, we can reduce risks and keep our digital world safe.`,
@@ -14,6 +16,25 @@ function zeta (q) {
14
  raw = raw.split(" ");
15
  var res = "";
16
  var token = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  if (raw[0] == "do" || raw[0] == "what" || raw[0] == "who" || raw[0] == "which" || raw[0] == "where" || raw[0] == "when" || raw[0] == "was" || raw[0] == "were" || raw[0] == "is" || raw[0] == "are") {
19
  raw.splice(0, 1);
@@ -23,20 +44,30 @@ function zeta (q) {
23
  raw = raw.filter(word => !["is","are","the"].includes(word));
24
 
25
  var keyword = raw[0] || "nothing";
 
 
 
 
 
 
26
  keyword = keyword.replace(/[^a-zA-Z\s]/g, '');
27
  var catc = "";
28
 
29
  for (let i = 0; i < db.length; i++) {
30
- if (db[i].toLowerCase().includes(keyword)) {
31
  catc += db[i];
32
  token += db[i].length;
33
  }
34
  }
 
 
 
 
35
 
36
  res += q + ", about " + keyword + "...\n";
37
  res += catc + "\n";
38
  res += `${keyword}, a good discuss for us.`;
39
  token += 5;
40
 
41
- return {token: token, model: "zeta-x1-lite", return: res};
42
  }
 
1
  function zeta (q) {
2
  const db = [
3
+ `Who am I? I'm a model trained by NeuralNexusLab and developed by NeuralNexusLab. I can use article to answer you or computation math.`,
4
+ `Who are you? I don't know who are you but I know you are my best friend! I can explain what is AI to you, or computation math.`,
5
  `Artificial intelligence, or AI, is a technology that allows computers to learn, think, and make decisions like humans. Today, AI is used in many parts of our daily lives. It helps us find information online, recommends songs we might like, and even drives cars automatically.AI can understand language, recognize faces, and solve problems faster than people in some cases. However, AI still needs humans to guide it and make sure it is used safely. Many scientists believe that AI will continue to grow and improve, making our future smarter and more efficient. The key is to use it responsibly and for the benefit of everyone.`,
6
  `Developing AI systems requires a mix of math, programming, and creativity. Engineers begin by collecting data, which helps the AI learn patterns and make predictions. They then design a model, usually using machine-learning frameworks like TensorFlow or PyTorch. After training the model, developers test it to make sure it works correctly and safely.AI development is not only about making machines smart—it also involves careful decision-making. Developers must think about privacy, fairness, and how their technology will be used. Building AI responsibly ensures that it can help people while avoiding harmful effects. As the field grows, AI developers continue to create new tools that push technology forward and open the door to future innovations.`,
7
  `Cybersecurity is the practice of protecting computers, networks, and data from unauthorized access or attacks. In today’s digital world, people store a lot of personal information online, from bank accounts to social media. Hackers can try to steal this information or cause damage.To stay safe, organizations and individuals use strong passwords, firewalls, and encryption. Regular software updates and careful behavior online are also important. Cybersecurity is not just about technology—it is about awareness and responsibility. By following good practices, we can reduce risks and keep our digital world safe.`,
 
16
  raw = raw.split(" ");
17
  var res = "";
18
  var token = 0;
19
+
20
+ function evalMath(input) {
21
+ const match = input.match(/[\d+\-*/()^\.]+/);
22
+ if (!match) return false;
23
+ let expr = match[0];
24
+ expr = expr.replace(/\^/g, "**");
25
+
26
+ try {
27
+ if (!/^[\d+\-*/().\s*]+$/.test(expr)) return false;
28
+ const result = Function(`"use strict"; return (${expr});`)();
29
+ if (typeof result === "number" && isFinite(result)) {
30
+ return result;
31
+ }
32
+ return false;
33
+ } catch (e) {
34
+ return false;
35
+ }
36
+ }
37
+
38
 
39
  if (raw[0] == "do" || raw[0] == "what" || raw[0] == "who" || raw[0] == "which" || raw[0] == "where" || raw[0] == "when" || raw[0] == "was" || raw[0] == "were" || raw[0] == "is" || raw[0] == "are") {
40
  raw.splice(0, 1);
 
44
  raw = raw.filter(word => !["is","are","the"].includes(word));
45
 
46
  var keyword = raw[0] || "nothing";
47
+
48
+ if (keyword == "you" || keyword == "your") keyword = "i";
49
+ else {
50
+ if (keyword == "i" || keyword == "me") keyword = "you"
51
+ }
52
+
53
  keyword = keyword.replace(/[^a-zA-Z\s]/g, '');
54
  var catc = "";
55
 
56
  for (let i = 0; i < db.length; i++) {
57
+ if (db[i].toLowerCase().includes(keyword.toLowerCase())) {
58
  catc += db[i];
59
  token += db[i].length;
60
  }
61
  }
62
+
63
+ if (evalMath(q) != false) {
64
+ catc += `"${q}", the computation's answer is ${evalMath(q)}.`;
65
+ }
66
 
67
  res += q + ", about " + keyword + "...\n";
68
  res += catc + "\n";
69
  res += `${keyword}, a good discuss for us.`;
70
  token += 5;
71
 
72
+ return {token: token, model: "zeta-xf", return: res};
73
  }