-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patholdformbackup.html
More file actions
503 lines (444 loc) · 17.3 KB
/
oldformbackup.html
File metadata and controls
503 lines (444 loc) · 17.3 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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Autumn NLP Core Algorithm</title>
<style>
/* Your existing CSS styles here */
body {
//background-color: indigo;
color: white;
font-weight: bold;
display: flex;
flex-direction: column;
justify-content: flex-start; /* Adjusted from center to flex-start */
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
margin-top: 100px; /* Added padding from the top */
margin-bottom: 100px;
}
.uibody {
display: flex;
flex-direction: column;
align-items: center;
}
.chat-container {
display: flex;
flex-direction: column;
align-items: center;
width: 600px;
margin-top: 20px;
border-radius: 5px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
cursor: pointer;
padding: 20px;
}
.chat-box {
width: 90%;
height: 300px;
overflow-y: scroll;
padding: 10px;
margin-bottom: 10px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
cursor: pointer;
}
.chat-message {
padding: 5px 10px;
border-radius: 5px;
margin: 5px 0;
max-width: 80%;
word-wrap: break-word;
}
.user-message {
color: white;
background-color: #555;
}
.bot-message {
color: white;
background-color: #007bff;
}
#chat-input {
width: 80%;
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
}
.decode-chat-container {
margin-top: 20px; /* Adjusted margin-top for separation */
display: flex;
flex-direction: column;
align-items: center;
}
.button-container {
display: flex;
justify-content: space-between;
width: 100%;
}
/* Button styling */
#chat-button-encode,
#chat-button-receive,
#chat-button-receive-full,
#chat-button-respond {
padding: 5px 10px;
border: none;
border-radius: 5px;
background-color: #007bff; /* Blue color */
color: white;
cursor: pointer;
}
/* Additional styling for NLP Generation Core message box */
#chat-output-core {
width: 90%;
height: 300px; /* Adjust the height according to your preference */
overflow-y: auto;
padding: 10px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
margin-bottom: 20px;
}
#chat-input-core {
width: 90%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 10px;
}
/* Additional styling for checkbox stack */
#checkbox-stack {
width: 90%;
display: flex;
flex-direction: column;
align-items: left;
justify-content: space-between;
margin-left: 100px;
}
.checkbox-label {
margin-right: 20px;
font-size: 16px;
}
.checkbox-item {
margin-right: 10px;
}
/* Additional styling for connection variables */
#connections-stack {
width: 90%;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
margin-left: 100px;
}
.connection-label {
margin-right: 20px;
font-size: 16px;
}
.connection-item {
margin-bottom: 5px;
}
/* Additional styling for dropdown menus */
.dropdown-menu {
margin-top: 5px;
}
.dropdown-item {
padding: 5px;
}
/* New style for algorithm optimal state */
#algorithm-optimal-state {
text-align: center;
margin-top: 20px;
font-size: 18px;
}
.logo4 {
width: 800px;
}
/* Existing CSS styles remain unchanged */
/* Button styling for export button */
#export-button {
padding: 5px 10px;
border: none;
border-radius: 5px;
background-color: #007bff; /* Blue color */
color: white;
cursor: pointer;
}
/* Additional styling for NLP Generation Core message box */
#chat-output-core {
width: 90%;
height: 300px; /* Adjust the height according to your preference */
overflow-y: auto;
padding: 10px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="uibody">
<a href="https://github.com/radicaldeepscale/Autumn/blob/main/Autumn.pdf" target="_blank"><img src="https://static.wixstatic.com/media/2451db_77cfc6e704874bd2b0c58a6585966e47~mv2.png"
alt="Logo4" class="logo4"></a>
<!-- New algorithm optimal state section -->
<div id="algorithm-optimal-state">
<span>Algorithm Optimal State: </span>
<label for="optimal-in" class="checkbox-item"><input type="checkbox" id="optimal-in"> In</label>
<label for="optimal-out" class="checkbox-item"><input type="checkbox" id="optimal-out"> Out</label>
</div>
<div id="encode-chat" class="chat-container">
<h1>Encode</h1>
<div class="chat-box" id="chat-output-encode"></div>
<br>
<input type="text" id="chat-input-encode" placeholder="Type your message here...">
<br>
<button id="chat-button-encode">Send</button>
</div>
<br>
<div id="connections-stack">
<div>
<div class="connection-label">Connections:</div>
<label for="e1" class="connection-item">
<input type="checkbox" id="e1"> Encode Send
<!-- Updated dropdown menu for Encode Send logic -->
<select class="dropdown-menu" id="dropdown-e1" multiple>
<option value="receive">Receive</option>
<option value="respond">Respond</option>
</select>
</label>
<br>
<label for="n1" class="connection-item">
<input type="checkbox" id="n1"> Generation DATA
<!-- Updated dropdown menu for Generation DATA logic -->
<select class="dropdown-menu" id="dropdown-n1" multiple>
<option value="receiveFullArray">Receive Full Array</option>
<option value="respond">Respond</option>
</select>
</label>
<br>
<label for="d1" class="connection-item">
<input type="checkbox" id="d1"> Receive
<!-- Updated dropdown menu for Receive logic -->
<select class="dropdown-menu" id="dropdown-d1" multiple>
<option value="encodeSend">Encode Send</option>
</select>
</label>
<br>
<label for="d2" class="connection-item">
<input type="checkbox" id="d2"> Receive Full Array
<!-- Updated dropdown menu for Receive Full Array logic -->
<select class="dropdown-menu" id="dropdown-d2" multiple>
<option value="encodeSend">Encode Send</option>
</select>
</label>
<br>
<label for="d3" class="connection-item">
<input type="checkbox" id="d3"> Respond
<!-- Updated dropdown menu for Respond logic -->
<select class="dropdown-menu" id="dropdown-d3" multiple>
<option value="paragraphInputField">Paragraph Input Field</option>
</select>
</label>
<!-- Repeat the above structure for other connection variables -->
</div>
</div>
<div class="chat-container" style="margin-top: 20px;">
<h1>NLP Generation Core</h1>
<div class="chat-box" id="chat-output-core" contenteditable="true"></div>
<button id="export-button" class="chat-button">Export Model (*.para)</button>
</div>
<br>
<br>
<div id="checkbox-stack">
<div class="checkbox-label">Order of Natural Tools:</div>
<label for="maze" class="checkbox-item"><input type="checkbox" id="maze"> Maze, First</label>
<label for="puzzle" class="checkbox-item"><input type="checkbox" id="puzzle"> Puzzle, Second</label>
<label for="envelope" class="checkbox-item"><input type="checkbox" id="envelope"> Envelope, Third</label>
<label for="hammer" class="checkbox-item"><input type="checkbox" id="hammer"> Hammer, Fourth</label>
<label for="stick" class="checkbox-item"><input type="checkbox" id="stick"> Stick, Fifth</label>
<label for="knife" class="checkbox-item"><input type="checkbox" id="knife"> Knife, Sixth</label>
<label for="scissors" class="checkbox-item"><input type="checkbox" id="scissors"> Scissors, Seventh</label>
</div>
<br>
<div id="decode-chat" class="chat-container decode-chat-container">
<h1>Decode</h1>
<div class="chat-box" id="chat-output-decode"></div>
<br>
<input type="text" id="chat-input-decode" placeholder="Type your message here...">
<br>
<div class="button-container">
<button id="chat-button-receive">Receive</button>
<button id="chat-button-receive-full">Receive Full Array</button>
<button id="chat-button-respond">Respond</button>
</div>
</div>
</div>
<script>
let a = []; // Array to store encoded messages
let b = []; // Array to store decoded messages
const n = 42; // Set n to a constant value, you can change this as needed
function encodeString(input) {
let encoded = "";
for (let i = input.length - 1; i >= 0; i--) {
let encodedChar = input.charCodeAt(i) + Math.sqrt(Math.pow(i, 2)) - n; // Adjusted encode logic
encoded = String.fromCharCode(encodedChar) + encoded;
}
a.unshift(encoded); // Store the encoded message at the beginning of array a
return encoded;
}
function decodeString(input) {
let decoded = "";
for (let i = 0; i < input.length; i++) {
let decodedChar = input.charCodeAt(i) - Math.sqrt(Math.pow(i, 2)) + n; // Adjusted decode logic
decoded += String.fromCharCode(decodedChar);
}
b.push(decoded); // Store the decoded message in array b
return decoded;
}
// Function to append a message to the NLP Generation Core
function appendToCoreMessage(message) {
document.getElementById("chat-output-core").innerHTML += `<div class="user-message chat-message">${message}</div>`;
}
// Rest of your code remains unchanged
function displayUserMessage(userMessage, outputId) {
document.getElementById(outputId).innerHTML += `<div class="user-message chat-message">${userMessage}</div>`;
}
function processUserInput(encode, inputId, outputId, coreUpdate) {
let inputElement = document.getElementById(inputId);
if (inputElement) {
let userMessage = inputElement.value.trim();
inputElement.value = "";
// Display User's message in the chat
displayUserMessage(userMessage, outputId);
// Append the plain message to arrays a or b without encoding/decoding
if (encode) {
a.push(userMessage); // Store the message in array a
} else {
b.push(userMessage); // Store the message in array b
}
// Append to NLP Generation Core if coreUpdate is true
if (coreUpdate) {
appendToCoreMessage(userMessage); // Append plain message to NLP Generation Core
}
}
}
// Existing JavaScript code remains unchanged
let chatButtonEncode = document.getElementById("chat-button-encode");
if (chatButtonEncode) {
chatButtonEncode.addEventListener("click", function() {
let encodeInput = document.getElementById("chat-input-encode");
let message = encodeInput.value.trim();
encodeInput.value = "";
a.push(message); // Push the message into array a
let encodeOutput = document.getElementById("chat-output-encode");
encodeOutput.innerHTML += `<div class="user-message chat-message">${message}</div>`;
let decodeOutput = document.getElementById("chat-output-decode");
decodeOutput.innerHTML += `<div class="user-message chat-message">${message}</div>`;
});
}
let chatButtonRespond = document.getElementById("chat-button-respond");
if (chatButtonRespond) {
chatButtonRespond.addEventListener("click", function () {
let lastAllocation = b.pop(); // Remove and get the last element of array b
if (lastAllocation !== undefined) {
document.getElementById("chat-output-encode").innerHTML += `<div class="bot-message chat-message">${lastAllocation}</div>`;
appendToCoreMessage(lastAllocation); // Append responded message to NLP Generation Core Algorithm
}
});
}
let chatButtonReceive = document.getElementById("chat-button-receive");
if (chatButtonReceive) {
chatButtonReceive.addEventListener("click", function() {
if (a.length > 0) {
let lastMessage = a[a.length - 1]; // Get the last message correctly
let decodeOutput = document.getElementById("chat-output-decode");
decodeOutput.innerHTML += `<div class="bot-message chat-message">${lastMessage}</div>`;
}
});
}
let chatButtonReceiveFull = document.getElementById("chat-button-receive-full");
if (chatButtonReceiveFull) {
chatButtonReceiveFull.addEventListener("click", function() {
let decodeOutput = document.getElementById("chat-output-decode");
// Removed the line that clears the decodeOutput.innerHTML
for (let i = 0; i < a.length; i++) {
decodeOutput.innerHTML += `<div class="bot-message chat-message">${a[i]}</div>`;
}
});
}
// Additional logic for handling connection checkboxes
function handleConnectionCheckboxChange(connectionId) {
let checkbox = document.getElementById(connectionId);
if (checkbox) {
if (checkbox.checked) {
// Logic for when the checkbox is checked
let connectionType = checkbox.id.charAt(0); // Extract the first character to determine the type
switch (connectionType) {
case 'e':
processUserInput(true, "chat-input-encode", "chat-output-encode", true);
break;
case 'd':
processUserInput(false, "chat-input-decode", "chat-output-decode", true);
break;
case 'n':
// NLP can only receive, so handle accordingly
let inputElement = document.getElementById("chat-input-core");
if (inputElement) {
let userMessage = inputElement.value.trim();
processUserInput(false, "chat-input-core", "chat-output-core", true);
// Additional logic specific to NLP receiving
}
break;
default:
// Handle other types or add specific logic
break;
}
} else {
// Logic for when the checkbox is unchecked
}
}
}
// Event listeners for connection checkboxes
let connectionCheckboxes = document.querySelectorAll('.connection-item input[type="checkbox"]');
connectionCheckboxes.forEach(function (checkbox) {
checkbox.addEventListener("change", function () {
handleConnectionCheckboxChange(checkbox.id);
});
});
// Additional logic for handling dropdown menu selections
function handleDropdownChange(connectionId) {
let dropdown = document.getElementById("dropdown-" + connectionId);
if (dropdown) {
let selectedOptions = Array.from(dropdown.selectedOptions).map(option => option.value);
console.log(`Selected options for ${connectionId}: ${selectedOptions}`);
// Add your logic to handle selected options
}
}
function exportParagraphToFile() {
let paragraphInput = document.getElementById("chat-output-core");
if (paragraphInput) {
let content = paragraphInput.innerText;
let encodedContent = encodeURIComponent(content);
let blob = new Blob([encodedContent], { type: "text/plain" });
let a = document.createElement("a");
a.href = URL.createObjectURL(blob);
a.download = "autumnnlp.para";
a.click();
}
}
// Event listener for the export button
let exportButton = document.getElementById("export-button");
if (exportButton) {
exportButton.addEventListener("click", function () {
exportParagraphToFile();
});
}
// Event listeners for dropdown menus
let dropdowns = document.querySelectorAll('.dropdown-menu');
dropdowns.forEach(function (dropdown) {
dropdown.addEventListener("change", function () {
let connectionId = dropdown.id.replace("dropdown-", "");
handleDropdownChange(connectionId);
});
});
</script>
</body>
</html>