Advay-Singh commited on
Commit
5a25ad0
·
verified ·
1 Parent(s): 8e0deac

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +292 -343
templates/index.html CHANGED
@@ -1,344 +1,293 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>TaskBot v1+</title>
8
- <script src="https://kit.fontawesome.com/cda0e70b18.js" crossorigin="anonymous"></script>
9
- <link rel="Icon" href="TaskBot logo.png">
10
- <link rel="manifest" href="/static/manifest.json">
11
- </head>
12
-
13
- <style>
14
- body {
15
- background-color: #2f2f2f;
16
- font-family: Arial, sans-serif;
17
- color: white;
18
- margin: 0;
19
- padding: 20px;
20
- background: url("{{ url_for('static', filename='images/black bg.jpeg') }}");
21
- background-size: cover;
22
- background-repeat: no-repeat;
23
- background-size: cover;
24
- background-attachment: fixed;
25
- background-position: center center;
26
- }
27
- nav {
28
- background-color: #444;
29
- padding: 5px;
30
- border-radius: 5px;
31
- width: 100%;
32
- height: auto;
33
- top: 0;
34
- }
35
- .sticky {
36
- position: absolute;
37
- top: 20px;
38
- right: 20px;
39
- z-index: 1000;
40
- }
41
- .sticky2 {
42
- position: absolute;
43
- top: 20px;
44
- right: 80px;
45
- z-index: 1000;
46
- }
47
- .sticky3 {
48
- position: absolute;
49
- top: 20px;
50
- right: 140px;
51
- z-index: 1000;
52
- }
53
- /* Dropdown Styles */
54
- .dropdown {
55
- position: relative;
56
- display: inline-block;
57
- }
58
- .btn {
59
- background-color: transparent;
60
- color: white;
61
- border: none;
62
- cursor: pointer;
63
- }
64
- .btn:hover {
65
- background-color: #494949;
66
- }
67
- .dropdown-content {
68
- display: none;
69
- position: absolute;
70
- right: 0;
71
- background-color: transparent;
72
- backdrop-filter: blur(5px);
73
- border: 1px solid black;
74
- min-width: 160px;
75
- box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
76
- z-index: 1;
77
- text-align: center;
78
- }
79
- .dropdown-content h3 {
80
- margin: 5px 0;
81
- color: white;
82
- text-align: center;
83
- }
84
- .dropdown-content a {
85
- color: white;
86
- padding: 12px 16px;
87
- text-decoration: none;
88
- display: block;
89
- border-top: 1px solid transparent;
90
- }
91
- .dropdown-content a:hover {
92
- background-color: #bebebe;
93
- }
94
- .dropdown:hover .dropdown-content {
95
- display: block;
96
- }
97
- main {
98
- display: flex;
99
- flex-direction: column;
100
- align-items: center;
101
- justify-content: center;
102
- height: calc(100vh - 100px);
103
- /* adjust if header height changes */
104
- text-align: center;
105
- }
106
- /* Input and Button Styles */
107
- #question {
108
- padding: 10px;
109
- font-size: 16px;
110
- border-radius: 5px;
111
- border: 1px solid #ccc;
112
- margin-right: 10px;
113
- }
114
- .ai,
115
- .user {
116
- background-color: transparent;
117
- backdrop-filter: blur(5px);
118
- padding: 10px;
119
- padding-right: 10px;
120
- border-radius: 5px;
121
- border: solid #ccc;
122
- margin: 10px;
123
- text-align: center;
124
- justify-content: right;
125
- width: 40%;
126
- color: rgb(227, 227, 227)
127
- }
128
- .text1 {
129
- display: flex;
130
- justify-content: right;
131
- align-items: center;
132
- margin: 10px;
133
- }
134
- .text2 {
135
- display: flex;
136
- justify-content: left;
137
- align-items: center;
138
- margin: 10px;
139
- }
140
- .chat-input-container {
141
- display: flex;
142
- align-items: center;
143
- justify-content: center;
144
- margin-top: 20px;
145
- }
146
- #sendButton {
147
- margin-left: 10px;
148
- padding: 10px 20px;
149
- border: none;
150
- border-radius: 5px;
151
- background-color: #fff;
152
- cursor: pointer;
153
- transition: background-color 0.3s;
154
- }
155
- #sendButton:hover {
156
- background-color: #e0e0e0;
157
- }
158
- .inputWrapper {
159
- flex-direction: column;
160
- align-items: center;
161
- justify-content: center;
162
- position: fixed;
163
- bottom: 20px;
164
- left: 50%;
165
- transform: translateX(-50%);
166
- display: flex;
167
- gap: 10px;
168
- z-index: 1000;
169
- }
170
- .inputWrapper input {
171
- width: 100%;
172
- padding: 10px;
173
- }
174
- .tools button {
175
- font-size: 18px;
176
- padding: 10px 20px;
177
- border-radius: 50px;
178
- cursor: pointer;
179
- }
180
- #welcomeMessage {
181
- text-align: center;
182
- margin-top: 20%;
183
- }
184
- .tools-content {
185
- display: none;
186
- }
187
- .tools:hover {
188
- .tools-content {
189
- display: block
190
- }
191
- }
192
- </style>
193
-
194
- <body>
195
-
196
- <H1 id="welcomeMessage">Hello 👋, what can I help with?</H1>
197
- <div id="chatArea">
198
- <div class="text1">
199
- <div class="user" style="display: none;"></div>
200
- </div>
201
- <div class="text2">
202
- <div class="ai" style="display: none;"></div>
203
- </div>
204
- </div>
205
-
206
- <main>
207
- <div class="inputWrapper">
208
- <input type="text" id="userInput" placeholder="Type your message here..."
209
- style="width: 200px;color: white; backdrop-filter: blur(100px);background-color: transparent; border-radius: 50px;border: 1px solid #ccc;margin-right: 10px;margin-left: 10px;">
210
- <div
211
- style="display: flex; flex-direction: row; gap: 10px; margin-top: 10px; width: 100%; justify-content: center;">
212
- <div class="tools">
213
- <div class="tools-content">
214
- <a href="/write"><button
215
- style="color: greenyellow;background-color: black;">Write</button></a><br>
216
- <a href="/summarize"><button
217
- style="color: greenyellow;background-color: black;">Summarize</button></a><br>
218
- <a href="/translate"><button
219
- style="color: greenyellow;background-color: black;">Translate</button></a><br>
220
- <a href="/imagine"><button
221
- style="color: greenyellow;background-color: black;">Imagine</button></a><br>
222
- <a href="/think"><button
223
- style="color: greenyellow;background-color: black;">Think</button></a><br>
224
- </div>
225
- <button style="background-color: black;">
226
- <i class="fa-solid fa-sliders fa-2xl" style="color: #63E6BE;"></i>
227
- </button>
228
- </div>
229
- <button id="sendButton" onclick="answer()"
230
- style="font-weight: bold; background-color: black; color: greenyellow">&#8593</button>
231
- </div>
232
- </div>
233
- </main>
234
-
235
- <script>
236
- async function answer() {
237
- document.getElementById("sendButton").disabled = true
238
- const welcomeMessage = document.getElementById('welcomeMessage');
239
- welcomeMessage.style.display = 'none'; // Hide the welcome message
240
- const userInput = document.getElementById('userInput').value;
241
- if (userInput.trim() === '') return;
242
- // Create wrapper for text1 (User message)
243
- const text1 = document.createElement('div');
244
- text1.className = 'text1';
245
- const userMessage = document.createElement('div');
246
- userMessage.className = 'user';
247
- userMessage.textContent = userInput;
248
- text1.appendChild(userMessage);
249
- // Append user message to the chat area
250
- document.getElementById('chatArea').appendChild(text1);
251
- // Clear input
252
- document.getElementById('userInput').value = '';
253
- const question = userInput; // Use the already retrieved value
254
- // Send a POST request to the /ask route
255
- const response = await fetch("/ask", {
256
- method: "POST",
257
- headers: {
258
- "Content-Type": "application/x-www-form-urlencoded"
259
- },
260
- body: new URLSearchParams({ question: question })
261
- });
262
- const data = await response.json();
263
- // Create wrapper for text2 (AI response)
264
- const text2 = document.createElement('div');
265
- text2.className = 'text2';
266
- const aiResponse = document.createElement('div');
267
- aiResponse.className = 'ai';
268
- if (data.answer) {
269
- aiResponse.textContent = data.answer;
270
- } else if (data.error) {
271
- aiResponse.textContent = "Error: " + data.error;
272
- }
273
- text2.appendChild(aiResponse);
274
- // Append AI response to the chat area
275
- document.getElementById('chatArea').appendChild(text2);
276
- document.getElementById("sendButton").disabled = false
277
- }
278
- if ("serviceWorker" in navigator) {
279
- navigator.serviceWorker
280
- .register("/static/service-worker.js")
281
- .then(() => console.log("Service Worker Registered"))
282
- .catch((err) => console.error("SW registration failed:", err));
283
- }
284
- document.getElementById("theme").addEventListener("click", () => {
285
- if (document.getElementsByTagName("body")[0].style.backgroundColor === "black") {
286
- document.getElementsByTagName("body")[0].style.backgroundColor = "#2f2f2f";
287
- document.getElementById("theme").textContent = "Theme: ☀️ (Light)";
288
- document.getElementById("welcomeMessage").style.color = "black";
289
- document.getElementsByTagName("body")[0].style.backgroundImage = "url({{ url_for('static', filename='images/light bg.jpeg') }})";
290
- document.getElementById("drop-down-h3-menu").style.color = "black"
291
- document.getElementById("drop-down-h3-settings").style.color = "black"
292
- document.getElementById("drop-down-h3-warnings").style.color = "black"
293
- document.getElementById("btn").style.color = "black"
294
- document.querySelectorAll(".user").forEach(element => {
295
- element.style.color = "black"
296
- });
297
- document.querySelectorAll(".ai").forEach(element => {
298
- element.style.color = "black"
299
- })
300
- document.querySelectorAll(".dropdown-content a").forEach(element => {
301
- element.style.color = "black"
302
- })
303
- document.getElementById("i_class").style.color = "black";
304
- document.querySelectorAll(".dropdown-content p").forEach(element => {
305
- element.style.color = "black"
306
- })
307
- document.getElementById("i_class_2").style.color = "black";
308
- document.getElementsByTagName("h2")[0].style.color = "black";
309
- } else {
310
- document.getElementsByTagName("body")[0].style.backgroundColor = "black";
311
- document.getElementById("theme").textContent = "Theme: 🌙 (Dark)";
312
- document.getElementById("welcomeMessage").style.color = "white";
313
- document.getElementsByTagName("body")[0].style.backgroundImage = "url({{ url_for('static', filename='images/black bg.jpeg') }})";
314
- document.getElementById("drop-down-h3-menu").style.color = "white"
315
- document.getElementById("drop-down-h3-settings").style.color = "white"
316
- document.getElementById("drop-down-h3-warnings").style.color = "white"
317
- document.querySelectorAll(".user").forEach(elements => {
318
- elements.style.color = "white"
319
- })
320
- document.querySelectorAll(".ai").forEach(elements => {
321
- elements.style.color = "white"
322
- })
323
- document.getElementById("btn").style.color = "white"
324
- document.querySelectorAll(".dropdown-content a").forEach(element => {
325
- element.style.color = "white"
326
- })
327
- document.getElementById("i_class").style.color = "white";
328
- document.querySelectorAll(".dropdown-content p").forEach(element => {
329
- element.style.color = "white"
330
- })
331
- document.getElementById("i_class_2").style.color = "white";
332
- document.getElementsByTagName("h2")[0].style.color = "white";
333
- }
334
- })
335
- document.getElementById("userInput").addEventListener("keypress", () => {
336
- if (event.key === "Enter") {
337
- sendButton.click()
338
- }
339
- })
340
- </script>
341
-
342
- </body>
343
-
344
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>TaskBot v1+</title>
8
+ <script src="https://kit.fontawesome.com/cda0e70b18.js" crossorigin="anonymous"></script>
9
+ <link rel="Icon" href="TaskBot logo.png">
10
+ <link rel="manifest" href="/static/manifest.json">
11
+ </head>
12
+
13
+ <style>
14
+ body {
15
+ background-color: #2f2f2f;
16
+ font-family: Arial, sans-serif;
17
+ color: white;
18
+ margin: 0;
19
+ padding: 20px;
20
+ background: url("{{ url_for('static', filename='images/black bg.jpeg') }}");
21
+ background-size: cover;
22
+ background-repeat: no-repeat;
23
+ background-size: cover;
24
+ background-attachment: fixed;
25
+ background-position: center center;
26
+ }
27
+ nav {
28
+ background-color: #444;
29
+ padding: 5px;
30
+ border-radius: 5px;
31
+ width: 100%;
32
+ height: auto;
33
+ top: 0;
34
+ }
35
+ .sticky {
36
+ position: absolute;
37
+ top: 20px;
38
+ right: 20px;
39
+ z-index: 1000;
40
+ }
41
+ .sticky2 {
42
+ position: absolute;
43
+ top: 20px;
44
+ right: 80px;
45
+ z-index: 1000;
46
+ }
47
+ .sticky3 {
48
+ position: absolute;
49
+ top: 20px;
50
+ right: 140px;
51
+ z-index: 1000;
52
+ }
53
+ /* Dropdown Styles */
54
+ .dropdown {
55
+ position: relative;
56
+ display: inline-block;
57
+ }
58
+ .btn {
59
+ background-color: transparent;
60
+ color: white;
61
+ border: none;
62
+ cursor: pointer;
63
+ }
64
+ .btn:hover {
65
+ background-color: #494949;
66
+ }
67
+ .dropdown-content {
68
+ display: none;
69
+ position: absolute;
70
+ right: 0;
71
+ background-color: transparent;
72
+ backdrop-filter: blur(5px);
73
+ border: 1px solid black;
74
+ min-width: 160px;
75
+ box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
76
+ z-index: 1;
77
+ text-align: center;
78
+ }
79
+ .dropdown-content h3 {
80
+ margin: 5px 0;
81
+ color: white;
82
+ text-align: center;
83
+ }
84
+ .dropdown-content a {
85
+ color: white;
86
+ padding: 12px 16px;
87
+ text-decoration: none;
88
+ display: block;
89
+ border-top: 1px solid transparent;
90
+ }
91
+ .dropdown-content a:hover {
92
+ background-color: #bebebe;
93
+ }
94
+ .dropdown:hover .dropdown-content {
95
+ display: block;
96
+ }
97
+ main {
98
+ display: flex;
99
+ flex-direction: column;
100
+ align-items: center;
101
+ justify-content: center;
102
+ height: calc(100vh - 100px);
103
+ /* adjust if header height changes */
104
+ text-align: center;
105
+ }
106
+ /* Input and Button Styles */
107
+ #question {
108
+ padding: 10px;
109
+ font-size: 16px;
110
+ border-radius: 5px;
111
+ border: 1px solid #ccc;
112
+ margin-right: 10px;
113
+ }
114
+ .ai,
115
+ .user {
116
+ background-color: transparent;
117
+ backdrop-filter: blur(5px);
118
+ padding: 10px;
119
+ padding-right: 10px;
120
+ border-radius: 5px;
121
+ border: solid #ccc;
122
+ margin: 10px;
123
+ text-align: center;
124
+ justify-content: right;
125
+ width: 40%;
126
+ color: rgb(227, 227, 227)
127
+ }
128
+ .text1 {
129
+ display: flex;
130
+ justify-content: right;
131
+ align-items: center;
132
+ margin: 10px;
133
+ }
134
+ .text2 {
135
+ display: flex;
136
+ justify-content: left;
137
+ align-items: center;
138
+ margin: 10px;
139
+ }
140
+ .chat-input-container {
141
+ display: flex;
142
+ align-items: center;
143
+ justify-content: center;
144
+ margin-top: 20px;
145
+ }
146
+ #sendButton {
147
+ margin-left: 10px;
148
+ padding: 10px 20px;
149
+ border: none;
150
+ border-radius: 5px;
151
+ background-color: #fff;
152
+ cursor: pointer;
153
+ transition: background-color 0.3s;
154
+ }
155
+ #sendButton:hover {
156
+ background-color: #e0e0e0;
157
+ }
158
+ .inputWrapper {
159
+ flex-direction: column;
160
+ align-items: center;
161
+ justify-content: center;
162
+ position: fixed;
163
+ bottom: 20px;
164
+ left: 50%;
165
+ transform: translateX(-50%);
166
+ display: flex;
167
+ gap: 10px;
168
+ z-index: 1000;
169
+ }
170
+ .inputWrapper input {
171
+ width: 100%;
172
+ padding: 10px;
173
+ }
174
+ .tools button {
175
+ font-size: 18px;
176
+ padding: 10px 20px;
177
+ border-radius: 50px;
178
+ cursor: pointer;
179
+ }
180
+ #welcomeMessage {
181
+ text-align: center;
182
+ margin-top: 20%;
183
+ }
184
+ .tools-content {
185
+ display: none;
186
+ }
187
+ .tools:hover {
188
+ .tools-content {
189
+ display: block
190
+ }
191
+ }
192
+ </style>
193
+
194
+ <body>
195
+
196
+ <H1 id="welcomeMessage">Hello 👋, what can I help with?</H1>
197
+ <div id="chatArea">
198
+ <div class="text1">
199
+ <div class="user" style="display: none;"></div>
200
+ </div>
201
+ <div class="text2">
202
+ <div class="ai" style="display: none;"></div>
203
+ </div>
204
+ </div>
205
+
206
+ <main>
207
+ <div class="inputWrapper">
208
+ <input type="text" id="userInput" placeholder="Type your message here..."
209
+ style="width: 200px;color: white; backdrop-filter: blur(100px);background-color: transparent; border-radius: 50px;border: 1px solid #ccc;margin-right: 10px;margin-left: 10px;">
210
+ <div
211
+ style="display: flex; flex-direction: row; gap: 10px; margin-top: 10px; width: 100%; justify-content: center;">
212
+ <div class="tools">
213
+ <div class="tools-content">
214
+ <a href="/write"><button
215
+ style="color: greenyellow;background-color: black;">Write</button></a><br>
216
+ <a href="/summarize"><button
217
+ style="color: greenyellow;background-color: black;">Summarize</button></a><br>
218
+ <a href="/translate"><button
219
+ style="color: greenyellow;background-color: black;">Translate</button></a><br>
220
+ <a href="/imagine"><button
221
+ style="color: greenyellow;background-color: black;">Imagine</button></a><br>
222
+ <a href="/think"><button
223
+ style="color: greenyellow;background-color: black;">Think</button></a><br>
224
+ </div>
225
+ <button style="background-color: black;">
226
+ <i class="fa-solid fa-sliders fa-2xl" style="color: #63E6BE;"></i>
227
+ </button>
228
+ </div>
229
+ <button id="sendButton" onclick="answer()"
230
+ style="font-weight: bold; background-color: black; color: greenyellow">&#8593</button>
231
+ </div>
232
+ </div>
233
+ </main>
234
+
235
+ <script>
236
+ async function answer() {
237
+ document.getElementById("sendButton").disabled = true
238
+ const welcomeMessage = document.getElementById('welcomeMessage');
239
+ welcomeMessage.style.display = 'none'; // Hide the welcome message
240
+ const userInput = document.getElementById('userInput').value;
241
+ if (userInput.trim() === '') return;
242
+ // Create wrapper for text1 (User message)
243
+ const text1 = document.createElement('div');
244
+ text1.className = 'text1';
245
+ const userMessage = document.createElement('div');
246
+ userMessage.className = 'user';
247
+ userMessage.textContent = userInput;
248
+ text1.appendChild(userMessage);
249
+ // Append user message to the chat area
250
+ document.getElementById('chatArea').appendChild(text1);
251
+ // Clear input
252
+ document.getElementById('userInput').value = '';
253
+ const question = userInput; // Use the already retrieved value
254
+ // Send a POST request to the /ask route
255
+ const response = await fetch("/ask", {
256
+ method: "POST",
257
+ headers: {
258
+ "Content-Type": "application/x-www-form-urlencoded"
259
+ },
260
+ body: new URLSearchParams({ question: question })
261
+ });
262
+ const data = await response.json();
263
+ // Create wrapper for text2 (AI response)
264
+ const text2 = document.createElement('div');
265
+ text2.className = 'text2';
266
+ const aiResponse = document.createElement('div');
267
+ aiResponse.className = 'ai';
268
+ if (data.answer) {
269
+ aiResponse.textContent = data.answer;
270
+ } else if (data.error) {
271
+ aiResponse.textContent = "Error: " + data.error;
272
+ }
273
+ text2.appendChild(aiResponse);
274
+ // Append AI response to the chat area
275
+ document.getElementById('chatArea').appendChild(text2);
276
+ document.getElementById("sendButton").disabled = false
277
+ }
278
+ if ("serviceWorker" in navigator) {
279
+ navigator.serviceWorker
280
+ .register("/static/service-worker.js")
281
+ .then(() => console.log("Service Worker Registered"))
282
+ .catch((err) => console.error("SW registration failed:", err));
283
+ }
284
+ document.getElementById("userInput").addEventListener("keypress", () => {
285
+ if (event.key === "Enter") {
286
+ sendButton.click()
287
+ }
288
+ })
289
+ </script>
290
+
291
+ </body>
292
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  </html>