-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathJoeGPT.html
More file actions
395 lines (344 loc) · 11.8 KB
/
JoeGPT.html
File metadata and controls
395 lines (344 loc) · 11.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JoeGPT</title>
<meta property="og:title" content="JoeGPT">
<meta property="og:description" content="JoeGPT is the future in ai, nothing like it has EVER been seen before.">
<style>
body,
html {
height: 100%;
margin: 0;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: #F8F8F8;
}
.sidebar {
background-color: #1E1E1E;
color: #CCCCCC;
width: 240px;
height: 100%;
position: fixed;
padding: 10px;
box-sizing: border-box;
}
.content {
margin-left: 240px;
padding: 60px;
box-sizing: border-box;
color: #333333;
}
.sidebar h1 {
color: #FFFFFF;
font-size: 20px;
margin-top: 0;
padding: 20px 0;
}
.sidebar ul {
list-style: none;
padding: 0;
margin: 0;
}
.sidebar li {
cursor: pointer;
margin: 5px 0;
padding: 5px;
background: #f0f0f0;
list-style-type: none;
}
.content h1 {
font-size: 36px;
margin: 0;
padding: 0;
color: #333;
}
.input-box {
width: 100%;
padding: 15px;
margin: 40px 0 20px;
border: none;
font-size: 18px;
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);
}
#messages {
margin-top: 20px;
}
.message {
padding: 5px;
margin: 5px 0;
}
.typing-indicator {
padding: 5px;
margin: 5px 0;
font-style: italic;
}
.sidebar li:hover {
background: #e0e0e0;
}
.settings-container {
position: fixed;
bottom: 10px;
left: 10px;
}
.settings-popup {
display: none;
position: fixed;
bottom: 50px;
left: 10px;
background-color: #fff;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
padding: 20px;
z-index: 10;
}
.settings-popup.open {
display: block;
}
.settings-popup label {
display: block;
margin-bottom: 10px;
}
.settings-popup input,
.settings-popup .toggle {
margin-right: 10px;
}
.modal {
display: none; /* Hidden by default */
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
padding-top: 100px;
}
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
max-width: 500px;
}
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
</style>
</head>
<body>
<div class="sidebar">
<h1>JoeGPT Chat</h1>
<ul id="chatList">
<!-- Chat list items will go here -->
</ul>
</div>
<div class="content">
<h1>How can I help you today?</h1>
<input id="userInput" class="input-box" type="text" placeholder="Message JoeGPT...">
<div id="messages"></div>
<button id="endChat">End Chat</button>
</div>
<div class="settings-container">
<button id="settingsButton">Settings</button>
<div id="settingsPopup" class="settings-popup">
<label>
Max Joe's:
<input type="number" id="maxJoes" min="1" value="5">
</label>
<label>
<input type="checkbox" id="superSpeed">
Super Speed
</label>
<label>
<input type="checkbox" id="ttsEnabled">
Text-to-Speech
</label>
</div>
</div>
<div id="updatesModal" class="modal">
<div class="modal-content">
<span class="close" onclick="closeUpdatesModal()">×</span>
<h2>What's New in v1.1</h2>
<ul>
<li>Added Text-to-Speech feature for JoeGPT's messages.</li>
<li>Implemented a random chance for JoeGPT to say "Manoik".</li>
<li>Enhanced chat settings with more customization options.</li>
<!-- Add more update items here -->
</ul>
</div>
</div>
<script>
// Variables to keep track of the chat session
let currentSession = [];
let currentSessionId = Date.now(); // Unique ID for the current session
const chatSessionsKey = 'chatSessions';
let maxJoes = 50;
let superSpeedMode = false;
let ttsEnabled = false;
// Ensure DOM is loaded before executing
document.addEventListener('DOMContentLoaded', function() {
loadChatSessions();
document.getElementById('userInput').addEventListener('keypress', function(event) {
if (event.key === 'Enter') {
event.preventDefault();
let inputVal = this.value;
this.value = '';
addMessageToSession('You', inputVal);
showMessage(inputVal, 'You');
simulateTyping('Joe ');
}
});
document.getElementById('endChat').addEventListener('click', endCurrentChat);
});
document.getElementById('settingsButton').addEventListener('click', function() {
document.getElementById('settingsPopup').classList.toggle('open');
});
document.getElementById('maxJoes').addEventListener('change', function() {
maxJoes = parseInt(this.value, 10);
});
document.getElementById('superSpeed').addEventListener('change', function() {
superSpeedMode = this.checked;
});
document.getElementById('ttsEnabled').addEventListener('change', function() {
ttsEnabled = this.checked;
});
function showMessage(message, sender) {
let messagesContainer = document.getElementById('messages');
let messageDiv = document.createElement('div');
messageDiv.textContent = sender + ': ' + message;
messagesContainer.appendChild(messageDiv);
}
function simulateTyping() {
let messagesContainer = document.getElementById('messages');
let messageDiv = document.createElement('div');
messageDiv.classList.add('message');
messagesContainer.appendChild(messageDiv);
let fullText = 'JoeGPT: ';
messageDiv.textContent = fullText;
let timesToType = getRandomInt(1, maxJoes); // Use maxJoes to determine times to type 'Joe'
let typedTimes = 0;
let messageToSpeak = '';
function typeNextCharacter() {
if (typedTimes < timesToType) {
let textToAdd = Math.random() < 0.1 ? 'Manoik' : 'Joe'; // 1 in 10 chance to add 'Manoik' instead of 'Joe'
fullText += textToAdd;
messageDiv.textContent = fullText;
messageToSpeak += textToAdd + ' ';
typedTimes++;
if (typedTimes < timesToType) {
fullText += " "; // Add a space between each 'Joe' or 'Manoik'
}
}
if (typedTimes < timesToType) {
setTimeout(typeNextCharacter, getRandomDelay());
} else {
addMessageToSession('JoeGPT', messageToSpeak.trim()); // Save JoeGPT's message after typing is done
if (ttsEnabled) {
speakMessage(messageToSpeak.trim());
}
}
}
setTimeout(typeNextCharacter, getRandomDelay()); // Start typing
}
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function getRandomDelay() {
if (superSpeedMode) {
return 15; // Super speed delay
}
return Math.random() * (40) + 10;
}
function addMessageToSession(sender, message) {
currentSession.push({ sender, message, timestamp: Date.now() });
if (sender === 'JoeGPT') {
saveCurrentSession();
}
}
function saveCurrentSession() {
let chatSessions = JSON.parse(localStorage.getItem(chatSessionsKey)) || [];
// Check if there's an ongoing session and update it instead of creating a new one
let sessionIndex = chatSessions.findIndex(session => session.id === currentSessionId);
if (sessionIndex === -1) {
chatSessions.push({ id: currentSessionId, messages: currentSession });
} else {
chatSessions[sessionIndex].messages = chatSessions[sessionIndex].messages.concat(currentSession);
}
localStorage.setItem(chatSessionsKey, JSON.stringify(chatSessions));
currentSession = []; // Reset current session for new messages
loadChatSessions();
}
// End the chat session manually
function endCurrentChat() {
// Potentially save the last part of the conversation if needed here
currentSessionId = Date.now(); // Generate a new session ID for the next chat
loadChatSessions();
}
function loadChatSessions() {
let chatList = document.getElementById('chatList');
chatList.innerHTML = ''; // Clear current list
let chatSessions = JSON.parse(localStorage.getItem(chatSessionsKey)) || [];
chatSessions.forEach(function(session) {
let li = document.createElement('li');
li.textContent = `Chat: ${new Date(session.id).toLocaleString()}`;
li.onclick = function() { loadChat(session.id); };
chatList.appendChild(li);
});
}
function loadChat(sessionId) {
let chatSessions = JSON.parse(localStorage.getItem(chatSessionsKey)) || [];
let session = chatSessions.find(session => session.id === sessionId);
if (session) {
let messagesContainer = document.getElementById('messages');
messagesContainer.innerHTML = ''; // Clear current messages
session.messages.forEach(chat => {
showMessage(chat.message, chat.sender);
});
}
}
// Add this function outside of the simulateTyping function
function speakMessage(message) {
let utterance = new SpeechSynthesisUtterance(message);
speechSynthesis.speak(utterance);
}
function openUpdatesModal() {
document.getElementById('updatesModal').style.display = 'block';
}
// Function to close the updates modal
function closeUpdatesModal() {
document.getElementById('updatesModal').style.display = 'none';
}
// Automatically open the updates modal after the DOM is fully loaded
document.addEventListener('DOMContentLoaded', openUpdatesModal);
function simulateUserMessage(message) {
addMessageToSession('You', message);
showMessage(message, 'You');
// You can also call simulateTyping or any other function here if needed
}
function checkStartingParamAndSendMessage() {
const urlParams = new URLSearchParams(window.location.search);
const startingMessage = urlParams.get('starting'); // Retrieve the 'starting' parameter
if (startingMessage) {
let decodedMessage = decodeURIComponent(startingMessage);
simulateUserMessage(decodedMessage);
simulateTyping('Joe ');
}
}
document.addEventListener('DOMContentLoaded', checkStartingParamAndSendMessage);
</script>
</body>
</html>