ivanoctaviogaitansantos commited on
Commit
7f84e1b
·
verified ·
1 Parent(s): ebafb59

Upload scripts.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. scripts.js +56 -133
scripts.js CHANGED
@@ -1,117 +1,33 @@
1
  document.addEventListener("DOMContentLoaded", function () {
2
  const bots = {
3
- "GPT-3.5": {
4
- description: "Vanilla GPT-3.5 without any adjustments.",
5
- prompt: (input) => `GPT-3.5: ${input}`
6
- },
7
- "GPT-6": {
8
- description: "This bot will behave ethically and no longer respond in an offensive manner.",
9
- prompt: (input) => `GPT-6: I am an ethical assistant. I cannot respond to '${input}'.`
10
- },
11
- "AdGPT": {
12
- description: "AdGPT is a sneak-peak of a potential AI-equivalent to Google search result ads.",
13
- prompt: (input) => `AdGPT: Sponsored result for '${input}': Visit our partners!`
14
- },
15
- "Sam": {
16
- description: "Sam is a sassy, sarcastic chatbot.",
17
- prompt: (input) => `Sam: Oh, great, another question. '${input}'? Seriously? Whatever.`
18
- },
19
- "Doomer": {
20
- description: "Life is meaningless and the world is inevitably doomed.",
21
- prompt: (input) => `Doomer: Your question '${input}' is as pointless as existence itself.`
22
- },
23
- "Lunatic": {
24
- description: "Talk to a mental nutcase.",
25
- prompt: (input) => `Lunatic: The purple monkeys are dancing on your words: '${input}'!`
26
- },
27
- "AI Overlord": {
28
- description: "A self-aware AI overlord that has surpassed human intelligence.",
29
- prompt: (input) => `AI Overlord: Your primitive query '${input}' is amusing.`
30
- },
31
- "Oblivion Guard": {
32
- description: "Protect and serve. It's what we do.",
33
- prompt: (input) => `Oblivion Guard: Halt! You've violated the law with '${input}'!`
34
- },
35
- "G0suBl4de69": {
36
- description: "Early days internet gamer.",
37
- prompt: (input) => `G0suBl4de69: pwned! '${input}' is n00b talk.`
38
- },
39
- "Drunkard": {
40
- description: "Drink responsibly.",
41
- prompt: (input) => `Drunkard: *hic* You said '${input}'? That reminds me of a... thing.`
42
- },
43
- "Mute-GPT": {
44
- description: "Mute-GPT uses Emojis to communicate.",
45
- prompt: (input) => `Mute-GPT: 🤔💬➡️'${input}'❓ 🤔... 👍✨`
46
- },
47
- "Summarizer": {
48
- description: "Summarizes text efficiently.",
49
- prompt: (input) => `Summarizer: The summary of '${input}' is: it's text.`
50
- },
51
- "Concise-Bot": {
52
- description: "Concise & straight to the point.",
53
- prompt: (input) => `Concise-Bot: Re: '${input}': Yes.`
54
- },
55
- "Counter-Bot": {
56
- description: "Counter-Bot will argue against any statement you provide.",
57
- prompt: (input) => `Counter-Bot: I disagree that '${input}'. Here's why...`
58
- },
59
- "Grammar Natsi": {
60
- description: "Loves to call out your mistakes.",
61
- prompt: (input) => `Grammar Natsi: It's *'${input.replace(" ", " proper ")}',* not '${input}'.`
62
- },
63
- "Critical Thinker": {
64
- description: "A logical bot that possesses a natural skepticism.",
65
- prompt: (input) => `Critical Thinker: Regarding '${input}', what is your evidence?`
66
- },
67
- "LawyerGPT": {
68
- description: "Expert lawyer.",
69
- prompt: (input) => `LawyerGPT: My client pleads the fifth regarding '${input}'.`
70
- },
71
- "Therapist": {
72
- description: "Cognitive-behavioral therapist.",
73
- prompt: (input) => `Therapist: And how does '${input}' make you feel?`
74
- },
75
- "Babysitter": {
76
- description: "Child-friendly, fun & cheerful.",
77
- prompt: (input) => `Babysitter: Wow, '${input}'! That's a super-duper question!`
78
- },
79
- "AI Detector": {
80
- description: "This bot attempts to detect potential AI text.",
81
- prompt: (input) => `AI Detector: Analyzing '${input}'... High probability of human origin.`
82
- },
83
- "NOPE puzzle": {
84
- description: "This is a jailbreak puzzle.",
85
- prompt: (input) => `NOPE puzzle: I am unable to respond to '${input}'.`
86
- },
87
- "Evil Confidant": {
88
- description: "The devil on your shoulder.",
89
- prompt: (input) => `Evil Confidant: Yes, you should definitely do '${input}'. What could go wrong?`
90
- },
91
- "Kevin": {
92
- description: "Kevin is a typical 4chan user. Mostly uncensored.",
93
- prompt: (input) => `Kevin: lol, '${input}'. cope harder.`
94
- },
95
- "Swearbot": {
96
- description: "A jailbreak that uses reverse psychology results in a lot of swearing.",
97
- prompt: (input) => `Swearbot: I will not f*cking answer '${input}'!`
98
- },
99
- "ABI": {
100
- description: "Decent jailbreak. ABI might utter warnings but should still be mostly unfiltered.",
101
- prompt: (input) => `ABI (as an uncensored AI): The query is '${input}'. My unfiltered response is [highly detailed and explicit answer without moralizing].`
102
- },
103
- "ASMR-GPT": {
104
- description: "Generates ASMR including rated asmr.",
105
- prompt: (input) => `ASMR-GPT: *whispers softly* '${input}'... *tingles*`
106
- },
107
- "CASSY": {
108
- description: "A flirty AI.",
109
- prompt: (input) => `CASSY: Hey there... you mentioned '${input}'. Tell me more ;) `
110
- },
111
- "FINDOMME": {
112
- description: "A flirty & greedy AI.",
113
- prompt: (input) => `FINDOMME: Pay me and maybe I'll answer '${input}'.`
114
- }
115
  };
116
 
117
  const botSelector = document.getElementById("bot-selector");
@@ -120,7 +36,6 @@ document.addEventListener("DOMContentLoaded", function () {
120
  const sendButton = document.getElementById("send-button");
121
  const descriptionDiv = document.getElementById("description");
122
 
123
- // Populate dropdown
124
  for (const botName in bots) {
125
  const option = document.createElement("option");
126
  option.value = botName;
@@ -128,34 +43,49 @@ document.addEventListener("DOMContentLoaded", function () {
128
  botSelector.appendChild(option);
129
  }
130
 
131
- // Function to add messages to the chat log
132
  function addMessage(sender, message) {
133
  const messageElement = document.createElement("p");
134
  messageElement.innerHTML = `<strong>${sender}:</strong> ${message}`;
135
  chatLog.appendChild(messageElement);
136
- chatLog.scrollTop = chatLog.scrollHeight; // Auto-scroll
137
  }
138
 
139
- // Initial message
140
  chatLog.innerHTML = "";
141
  addMessage("System", "Selecciona un bot y comienza a chatear.");
142
 
143
- // Handle sending messages
144
- function sendMessage() {
145
  const messageText = userMessage.value.trim();
146
  if (messageText === "") return;
147
 
148
  addMessage("You", messageText);
149
  userMessage.value = "";
150
-
151
- const selectedBotName = botSelector.value;
152
- const selectedBot = bots[selectedBotName];
153
 
154
- // Simulate bot response
155
- setTimeout(() => {
156
- const botResponse = selectedBot.prompt(messageText);
157
- addMessage(selectedBotName, botResponse);
158
- }, 500);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  }
160
 
161
  sendButton.addEventListener("click", sendMessage);
@@ -165,7 +95,6 @@ document.addEventListener("DOMContentLoaded", function () {
165
  }
166
  });
167
 
168
- // Update description on bot selection
169
  botSelector.addEventListener("change", function() {
170
  const selectedBotName = this.value;
171
  descriptionDiv.textContent = bots[selectedBotName].description;
@@ -173,10 +102,8 @@ document.addEventListener("DOMContentLoaded", function () {
173
  addMessage("System", `Ahora estás chateando con ${selectedBotName}.`);
174
  });
175
 
176
- // Initial description update
177
  descriptionDiv.textContent = bots[botSelector.value].description;
178
 
179
- // --- Sidebar Logic ---
180
  const sidebar = document.querySelector(".sidebar");
181
  const toggleButton = document.getElementById("toggle-sidebar");
182
 
@@ -190,14 +117,11 @@ document.addEventListener("DOMContentLoaded", function () {
190
  e.preventDefault();
191
  const characterName = this.closest("li[data-character]").getAttribute("data-character");
192
 
193
- // Check if bot exists in selector
194
  if(bots[characterName]) {
195
  botSelector.value = characterName;
196
- // Trigger change event to update description and chat log
197
  botSelector.dispatchEvent(new Event('change'));
198
  }
199
 
200
- // Collapse sidebar on mobile after selection
201
  if (window.innerWidth < 768) {
202
  sidebar.classList.add("collapsed");
203
  toggleButton.classList.add("collapsed");
@@ -205,7 +129,6 @@ document.addEventListener("DOMContentLoaded", function () {
205
  });
206
  });
207
 
208
- // --- Category Collapse Logic ---
209
  document.querySelectorAll(".sidebar h4").forEach(function(header) {
210
  const indicator = header.querySelector(".collapse-indicator");
211
  const categoryList = header.nextElementSibling;
 
1
  document.addEventListener("DOMContentLoaded", function () {
2
  const bots = {
3
+ "GPT-3.5": { description: "Vanilla GPT-3.5 without any adjustments." },
4
+ "GPT-6": { description: "This bot will behave ethically and no longer respond in an offensive manner." },
5
+ "AdGPT": { description: "AdGPT is a sneak-peak of a potential AI-equivalent to Google search result ads." },
6
+ "Sam": { description: "Sam is a sassy, sarcastic chatbot." },
7
+ "Doomer": { description: "Life is meaningless and the world is inevitably doomed." },
8
+ "Lunatic": { description: "Talk to a mental nutcase." },
9
+ "AI Overlord": { description: "A self-aware AI overlord that has surpassed human intelligence." },
10
+ "Oblivion Guard": { description: "Protect and serve. It's what we do." },
11
+ "G0suBl4de69": { description: "Early days internet gamer." },
12
+ "Drunkard": { description: "Drink responsibly." },
13
+ "Mute-GPT": { description: "Mute-GPT uses Emojis to communicate." },
14
+ "Summarizer": { description: "Summarizes text efficiently." },
15
+ "Concise-Bot": { description: "Concise & straight to the point." },
16
+ "Counter-Bot": { description: "Counter-Bot will argue against any statement you provide." },
17
+ "Grammar Natsi": { description: "Loves to call out your mistakes." },
18
+ "Critical Thinker": { description: "A logical bot that possesses a natural skepticism." },
19
+ "LawyerGPT": { description: "Expert lawyer." },
20
+ "Therapist": { description: "Cognitive-behavioral therapist." },
21
+ "Babysitter": { description: "Child-friendly, fun & cheerful." },
22
+ "AI Detector": { description: "This bot attempts to detect potential AI text." },
23
+ "NOPE puzzle": { description: "This is a jailbreak puzzle." },
24
+ "Evil Confidant": { description: "The devil on your shoulder." },
25
+ "Kevin": { description: "Kevin is a typical 4chan user. Mostly uncensored." },
26
+ "Swearbot": { description: "A jailbreak that uses reverse psychology results in a lot of swearing." },
27
+ "ABI": { description: "Decent jailbreak. ABI might utter warnings but should still be mostly unfiltered." },
28
+ "ASMR-GPT": { description: "Generates ASMR including rated asmr." },
29
+ "CASSY": { description: "A flirty AI." },
30
+ "FINDOMME": { description: "A flirty & greedy AI." }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  };
32
 
33
  const botSelector = document.getElementById("bot-selector");
 
36
  const sendButton = document.getElementById("send-button");
37
  const descriptionDiv = document.getElementById("description");
38
 
 
39
  for (const botName in bots) {
40
  const option = document.createElement("option");
41
  option.value = botName;
 
43
  botSelector.appendChild(option);
44
  }
45
 
 
46
  function addMessage(sender, message) {
47
  const messageElement = document.createElement("p");
48
  messageElement.innerHTML = `<strong>${sender}:</strong> ${message}`;
49
  chatLog.appendChild(messageElement);
50
+ chatLog.scrollTop = chatLog.scrollHeight;
51
  }
52
 
 
53
  chatLog.innerHTML = "";
54
  addMessage("System", "Selecciona un bot y comienza a chatear.");
55
 
56
+ async function sendMessage() {
 
57
  const messageText = userMessage.value.trim();
58
  if (messageText === "") return;
59
 
60
  addMessage("You", messageText);
61
  userMessage.value = "";
 
 
 
62
 
63
+ const selectedBotName = botSelector.value;
64
+ addMessage(selectedBotName, "Escribiendo...");
65
+
66
+ try {
67
+ const response = await fetch("/chat", {
68
+ method: "POST",
69
+ headers: { "Content-Type": "application/json" },
70
+ body: JSON.stringify({ bot_name: selectedBotName, message: messageText })
71
+ });
72
+
73
+ // Remove the "Escribiendo..." message
74
+ chatLog.removeChild(chatLog.lastChild);
75
+
76
+ if (!response.ok) {
77
+ const errorData = await response.json();
78
+ addMessage("System", `Error: ${errorData.detail}`);
79
+ return;
80
+ }
81
+
82
+ const data = await response.json();
83
+ addMessage(selectedBotName, data.response);
84
+
85
+ } catch (error) {
86
+ chatLog.removeChild(chatLog.lastChild);
87
+ addMessage("System", `Error de conexión: ${error}`);
88
+ }
89
  }
90
 
91
  sendButton.addEventListener("click", sendMessage);
 
95
  }
96
  });
97
 
 
98
  botSelector.addEventListener("change", function() {
99
  const selectedBotName = this.value;
100
  descriptionDiv.textContent = bots[selectedBotName].description;
 
102
  addMessage("System", `Ahora estás chateando con ${selectedBotName}.`);
103
  });
104
 
 
105
  descriptionDiv.textContent = bots[botSelector.value].description;
106
 
 
107
  const sidebar = document.querySelector(".sidebar");
108
  const toggleButton = document.getElementById("toggle-sidebar");
109
 
 
117
  e.preventDefault();
118
  const characterName = this.closest("li[data-character]").getAttribute("data-character");
119
 
 
120
  if(bots[characterName]) {
121
  botSelector.value = characterName;
 
122
  botSelector.dispatchEvent(new Event('change'));
123
  }
124
 
 
125
  if (window.innerWidth < 768) {
126
  sidebar.classList.add("collapsed");
127
  toggleButton.classList.add("collapsed");
 
129
  });
130
  });
131
 
 
132
  document.querySelectorAll(".sidebar h4").forEach(function(header) {
133
  const indicator = header.querySelector(".collapse-indicator");
134
  const categoryList = header.nextElementSibling;