eaglelandsonce commited on
Commit
14b75eb
·
verified ·
1 Parent(s): f3d266c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +58 -14
index.html CHANGED
@@ -20,7 +20,7 @@
20
  }
21
  /* Sidebar styling */
22
  .sidebar {
23
- width: 40px;
24
  background-color: #333;
25
  color: white;
26
  display: flex;
@@ -29,13 +29,13 @@
29
  padding: 10px 0;
30
  }
31
  .prompt-icon {
32
- margin: 20px 0;
33
  cursor: pointer;
34
  text-align: center;
35
  }
36
  .prompt-icon img {
37
- width: 24px;
38
- height: 24px;
39
  margin-bottom: 5px;
40
  }
41
  .prompt-icon span {
@@ -101,18 +101,51 @@
101
  object-fit: contain;
102
  display: block;
103
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  /* Response box styling */
105
  .response-box {
106
  position: absolute;
107
- top: 10%;
108
  left: 10%;
109
- background-color: rgba(255, 255, 255, 0.8);
110
  color: #333;
111
  padding: 15px;
112
  border: 1px solid #ccc;
113
  border-radius: 5px;
114
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
115
  display: none;
 
116
  }
117
  </style>
118
  </head>
@@ -137,6 +170,10 @@
137
  <div class="main">
138
  <div class="content">
139
  <img id="slide-image" src="images/01_mg.png" alt="Slide Image">
 
 
 
 
140
  <div class="response-box" id="responseBox">
141
  <p id="responseText"></p>
142
  </div>
@@ -193,10 +230,22 @@
193
  const BASE_URL = "https://api.x.ai/v1";
194
 
195
  const promptIcon = document.getElementById('promptIcon');
 
 
 
196
  const responseBox = document.getElementById('responseBox');
197
  const responseText = document.getElementById('responseText');
198
 
199
- async function sendPrompt(prompt) {
 
 
 
 
 
 
 
 
 
200
  responseBox.style.display = "block";
201
  responseText.textContent = "Loading...";
202
 
@@ -211,7 +260,7 @@
211
  model: "grok-beta",
212
  messages: [
213
  { role: "system", content: "You are Grok, a chatbot inspired by the Hitchhiker's Guide to the Galaxy." },
214
- { role: "user", content: prompt }
215
  ]
216
  })
217
  });
@@ -225,11 +274,6 @@
225
  } catch (error) {
226
  responseText.textContent = `Error: ${error.message}`;
227
  }
228
- }
229
-
230
- promptIcon.addEventListener('click', () => {
231
- const slideText = slides[currentIndex]?.text || "Default prompt";
232
- sendPrompt(slideText);
233
  });
234
  </script>
235
  </body>
 
20
  }
21
  /* Sidebar styling */
22
  .sidebar {
23
+ width: 60px;
24
  background-color: #333;
25
  color: white;
26
  display: flex;
 
29
  padding: 10px 0;
30
  }
31
  .prompt-icon {
32
+ margin-top: 100px;
33
  cursor: pointer;
34
  text-align: center;
35
  }
36
  .prompt-icon img {
37
+ width: 32px;
38
+ height: 32px;
39
  margin-bottom: 5px;
40
  }
41
  .prompt-icon span {
 
101
  object-fit: contain;
102
  display: block;
103
  }
104
+ /* Prompt box styling */
105
+ .prompt-box {
106
+ position: absolute;
107
+ top: 10%;
108
+ left: 10%;
109
+ background-color: rgba(255, 255, 255, 0.9);
110
+ color: #333;
111
+ padding: 15px;
112
+ border: 1px solid #ccc;
113
+ border-radius: 5px;
114
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
115
+ display: none;
116
+ z-index: 20;
117
+ }
118
+ .prompt-box textarea {
119
+ width: 100%;
120
+ height: 60px;
121
+ margin-bottom: 10px;
122
+ padding: 10px;
123
+ font-size: 14px;
124
+ border: 1px solid #ccc;
125
+ border-radius: 5px;
126
+ }
127
+ .prompt-box button {
128
+ padding: 5px 10px;
129
+ font-size: 14px;
130
+ background-color: #007bff;
131
+ color: white;
132
+ border: none;
133
+ border-radius: 5px;
134
+ cursor: pointer;
135
+ }
136
  /* Response box styling */
137
  .response-box {
138
  position: absolute;
139
+ top: 30%;
140
  left: 10%;
141
+ background-color: rgba(255, 255, 255, 0.9);
142
  color: #333;
143
  padding: 15px;
144
  border: 1px solid #ccc;
145
  border-radius: 5px;
146
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
147
  display: none;
148
+ z-index: 20;
149
  }
150
  </style>
151
  </head>
 
170
  <div class="main">
171
  <div class="content">
172
  <img id="slide-image" src="images/01_mg.png" alt="Slide Image">
173
+ <div class="prompt-box" id="promptBox">
174
+ <textarea id="promptText"></textarea>
175
+ <button id="queryButton">Query Grok</button>
176
+ </div>
177
  <div class="response-box" id="responseBox">
178
  <p id="responseText"></p>
179
  </div>
 
230
  const BASE_URL = "https://api.x.ai/v1";
231
 
232
  const promptIcon = document.getElementById('promptIcon');
233
+ const promptBox = document.getElementById('promptBox');
234
+ const promptText = document.getElementById('promptText');
235
+ const queryButton = document.getElementById('queryButton');
236
  const responseBox = document.getElementById('responseBox');
237
  const responseText = document.getElementById('responseText');
238
 
239
+ promptIcon.addEventListener('click', () => {
240
+ const slideText = slides[currentIndex]?.text || "Default prompt";
241
+ promptBox.style.display = "block";
242
+ promptText.value = slideText;
243
+ });
244
+
245
+ queryButton.addEventListener('click', async () => {
246
+ const userPrompt = promptText.value.trim();
247
+ if (!userPrompt) return;
248
+
249
  responseBox.style.display = "block";
250
  responseText.textContent = "Loading...";
251
 
 
260
  model: "grok-beta",
261
  messages: [
262
  { role: "system", content: "You are Grok, a chatbot inspired by the Hitchhiker's Guide to the Galaxy." },
263
+ { role: "user", content: userPrompt }
264
  ]
265
  })
266
  });
 
274
  } catch (error) {
275
  responseText.textContent = `Error: ${error.message}`;
276
  }
 
 
 
 
 
277
  });
278
  </script>
279
  </body>