Spaces:
Sleeping
Sleeping
add responsive css
Browse files- static/multi-agent.html +85 -72
static/multi-agent.html
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
<title>DigiYatra Assistant</title>
|
7 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
|
8 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
@@ -13,19 +13,19 @@
|
|
13 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
|
14 |
<style>
|
15 |
:root {
|
16 |
-
--primary-color: #304b76
|
17 |
--secondary-color: #f0f8ff;
|
18 |
--text-color: #333;
|
19 |
--background-color: #f5f7fa;
|
20 |
}
|
21 |
body {
|
22 |
font-family: 'Poppins', sans-serif;
|
23 |
-
/* font-family: 'Roboto', sans-serif; */
|
24 |
line-height: 1.6;
|
25 |
margin: 0;
|
26 |
padding: 0;
|
27 |
background-color: var(--background-color);
|
28 |
color: var(--text-color);
|
|
|
29 |
}
|
30 |
#app {
|
31 |
max-width: 900px;
|
@@ -48,14 +48,13 @@ body {
|
|
48 |
padding: 20px;
|
49 |
display: flex;
|
50 |
flex-direction: column;
|
51 |
-
|
52 |
}
|
53 |
.message {
|
54 |
max-width: 80%;
|
55 |
margin-bottom: 20px;
|
56 |
padding: 10px 20px;
|
57 |
border-radius: 20px;
|
58 |
-
font-size:
|
59 |
line-height: 1.5;
|
60 |
word-wrap: break-word;
|
61 |
animation: fadeIn 0.5s ease;
|
@@ -87,7 +86,7 @@ th, td {
|
|
87 |
color: var(--text-color);
|
88 |
align-self: flex-start;
|
89 |
border-bottom-left-radius: 5px;
|
90 |
-
position: relative;
|
91 |
}
|
92 |
.copy-button {
|
93 |
position: absolute;
|
@@ -118,7 +117,7 @@ th, td {
|
|
118 |
padding: 12px 15px;
|
119 |
border: 2px solid var(--primary-color);
|
120 |
border-radius: 15px;
|
121 |
-
font-size:
|
122 |
outline: none;
|
123 |
transition: all 0.3s ease;
|
124 |
}
|
@@ -158,7 +157,7 @@ th, td {
|
|
158 |
border: 2px solid var(--primary-color);
|
159 |
border-radius: 20px;
|
160 |
padding: 8px 16px;
|
161 |
-
font-size:
|
162 |
cursor: pointer;
|
163 |
transition: all 0.3s ease;
|
164 |
}
|
@@ -186,56 +185,41 @@ th, td {
|
|
186 |
height: 30px;
|
187 |
fill: var(--primary-color);
|
188 |
}
|
189 |
-
@media (max-width: 600px) {
|
190 |
-
#app {
|
191 |
-
padding: 10px;
|
192 |
-
}
|
193 |
-
.chat-container {
|
194 |
-
height: 95vh;
|
195 |
-
}
|
196 |
-
.message {
|
197 |
-
max-width: 90%;
|
198 |
-
}
|
199 |
-
}
|
200 |
.dot {
|
201 |
-
display: inline-block;
|
202 |
-
width: 8px;
|
203 |
-
height: 8px;
|
204 |
-
border-radius: 50%;
|
205 |
-
background-color: #5853c0;
|
206 |
-
margin: 0 3px;
|
207 |
-
animation: bounce 1.4s infinite ease-in-out;
|
208 |
}
|
209 |
.dot:nth-child(1) { animation-delay: -0.32s; }
|
210 |
.dot:nth-child(2) { animation-delay: -0.16s; }
|
211 |
@keyframes bounce {
|
212 |
-
0%, 80%, 100% {
|
213 |
-
transform: scale(0);
|
214 |
-
} 40% {
|
215 |
-
transform: scale(1.0);
|
216 |
-
}
|
217 |
}
|
218 |
.chat-container {
|
219 |
-
position: relative;
|
220 |
}
|
221 |
-
|
222 |
.input-area {
|
223 |
-
position: absolute;
|
224 |
-
bottom: 0;
|
225 |
-
left: 0;
|
226 |
-
right: 0;
|
227 |
-
z-index: 10;
|
228 |
-
transition: transform 0.3s ease;
|
229 |
-
}
|
230 |
-
|
231 |
.messages {
|
232 |
-
padding-bottom: 80px;
|
233 |
}
|
234 |
-
|
235 |
.input-hidden {
|
236 |
-
transform: translateY(100%);
|
237 |
}
|
238 |
-
|
239 |
.tool-options {
|
240 |
position: absolute;
|
241 |
bottom: 100%;
|
@@ -248,9 +232,8 @@ transform: translateY(100%);
|
|
248 |
flex-direction: column;
|
249 |
width: auto;
|
250 |
min-width: 120px;
|
251 |
-
margin-bottom: 10px;
|
252 |
}
|
253 |
-
|
254 |
.tool-options button {
|
255 |
padding: 10px 15px;
|
256 |
border: none;
|
@@ -259,45 +242,34 @@ transform: translateY(100%);
|
|
259 |
cursor: pointer;
|
260 |
white-space: nowrap;
|
261 |
transition: background-color 0.3s ease;
|
262 |
-
font-size:
|
263 |
font-weight: 500;
|
264 |
-
color: #333;
|
265 |
-
border-radius: 4px;
|
266 |
}
|
267 |
-
|
268 |
.tool-options button:hover {
|
269 |
background-color: #e0e0e0;
|
270 |
color: #000;
|
271 |
}
|
272 |
-
/* ... Reference styles ... */
|
273 |
-
|
274 |
details {
|
275 |
margin-top: 10px;
|
276 |
border-radius: 4px;
|
277 |
padding: 5px;
|
278 |
-
|
279 |
}
|
280 |
-
|
281 |
summary {
|
282 |
cursor: pointer;
|
283 |
font-weight: bold;
|
284 |
}
|
285 |
-
|
286 |
.ref-content {
|
287 |
margin-top: 10px;
|
288 |
justify-content: center;
|
289 |
}
|
290 |
-
|
291 |
.ref-item {
|
292 |
margin-bottom: 0px;
|
293 |
-
|
294 |
-
|
295 |
}
|
296 |
-
|
297 |
.ref-item small {
|
298 |
color: #666;
|
299 |
}
|
300 |
-
|
301 |
hr {
|
302 |
margin: 10px 0;
|
303 |
border: none;
|
@@ -310,16 +282,65 @@ hr {
|
|
310 |
padding: 5px;
|
311 |
border-radius: 4px;
|
312 |
transition: background-color 0.2s;
|
313 |
-
|
314 |
}
|
315 |
-
|
316 |
.ref-link:hover {
|
317 |
background-color: #e3e3ea;
|
318 |
color: inherit;
|
319 |
}
|
320 |
-
|
321 |
.ref-link:visited {
|
322 |
color: inherit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
}
|
324 |
</style>
|
325 |
</head>
|
@@ -368,7 +389,6 @@ hr {
|
|
368 |
</div>
|
369 |
</div>
|
370 |
</div>
|
371 |
-
|
372 |
<script>
|
373 |
marked.setOptions({
|
374 |
highlight: function (code, lang) {
|
@@ -389,7 +409,6 @@ hr {
|
|
389 |
container.appendChild(dot);
|
390 |
}
|
391 |
}
|
392 |
-
|
393 |
const app = new Vue({
|
394 |
el: '#app',
|
395 |
data: {
|
@@ -416,7 +435,6 @@ hr {
|
|
416 |
this.$nextTick(() => {
|
417 |
createTypingAnimation();
|
418 |
});
|
419 |
-
|
420 |
try {
|
421 |
const response = await fetch('https://pvanand-general-chat.hf.space/v2/followup-tools-agent', {
|
422 |
method: 'POST',
|
@@ -487,7 +505,6 @@ hr {
|
|
487 |
this.$set(this.messages[streamingIndex], 'content', marked.parse(rawResponse));
|
488 |
this.$set(this.messages[streamingIndex], 'rawResponse', rawResponse);
|
489 |
}
|
490 |
-
|
491 |
if (jsonData) {
|
492 |
if (jsonData.tools && jsonData.tools.length > 0) {
|
493 |
let toolsMessage = "\n\n**Tools Used:**\n";
|
@@ -497,7 +514,6 @@ hr {
|
|
497 |
|
498 |
this.$set(this.messages[streamingIndex], 'content', this.messages[streamingIndex].content + marked.parse(toolsMessage));
|
499 |
}
|
500 |
-
|
501 |
if (jsonData.clarification && jsonData.clarification.length > 0) {
|
502 |
streamingIndex = this.messages.push({ type: 'bot', content: '' }) - 1;
|
503 |
this.renderClarificationQuestions(jsonData.clarification, streamingIndex);
|
@@ -582,13 +598,11 @@ hr {
|
|
582 |
this.lastScrollTop = 0;
|
583 |
this.tool_call = 'auto';
|
584 |
this.showToolOptions = false;
|
585 |
-
|
586 |
this.$nextTick(() => {
|
587 |
if (this.$refs.messageContainer) {
|
588 |
this.$refs.messageContainer.scrollTop = 0;
|
589 |
}
|
590 |
});
|
591 |
-
|
592 |
const inputArea = document.querySelector('.input-area');
|
593 |
if (inputArea) inputArea.classList.remove('input-hidden');
|
594 |
},
|
@@ -657,7 +671,6 @@ hr {
|
|
657 |
} else {
|
658 |
this.showToolOptions = false;
|
659 |
}
|
660 |
-
|
661 |
// Reset tool_call to 'auto' if input doesn't contain /web or /news
|
662 |
if (!event.target.value.includes('/web') && !event.target.value.includes('/news')) {
|
663 |
this.tool_call = 'auto';
|
|
|
2 |
<html lang="en">
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
6 |
<title>DigiYatra Assistant</title>
|
7 |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
|
8 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
|
|
13 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
|
14 |
<style>
|
15 |
:root {
|
16 |
+
--primary-color: #304b76;
|
17 |
--secondary-color: #f0f8ff;
|
18 |
--text-color: #333;
|
19 |
--background-color: #f5f7fa;
|
20 |
}
|
21 |
body {
|
22 |
font-family: 'Poppins', sans-serif;
|
|
|
23 |
line-height: 1.6;
|
24 |
margin: 0;
|
25 |
padding: 0;
|
26 |
background-color: var(--background-color);
|
27 |
color: var(--text-color);
|
28 |
+
font-size: 16px;
|
29 |
}
|
30 |
#app {
|
31 |
max-width: 900px;
|
|
|
48 |
padding: 20px;
|
49 |
display: flex;
|
50 |
flex-direction: column;
|
|
|
51 |
}
|
52 |
.message {
|
53 |
max-width: 80%;
|
54 |
margin-bottom: 20px;
|
55 |
padding: 10px 20px;
|
56 |
border-radius: 20px;
|
57 |
+
font-size: 1em;
|
58 |
line-height: 1.5;
|
59 |
word-wrap: break-word;
|
60 |
animation: fadeIn 0.5s ease;
|
|
|
86 |
color: var(--text-color);
|
87 |
align-self: flex-start;
|
88 |
border-bottom-left-radius: 5px;
|
89 |
+
position: relative;
|
90 |
}
|
91 |
.copy-button {
|
92 |
position: absolute;
|
|
|
117 |
padding: 12px 15px;
|
118 |
border: 2px solid var(--primary-color);
|
119 |
border-radius: 15px;
|
120 |
+
font-size: 1em;
|
121 |
outline: none;
|
122 |
transition: all 0.3s ease;
|
123 |
}
|
|
|
157 |
border: 2px solid var(--primary-color);
|
158 |
border-radius: 20px;
|
159 |
padding: 8px 16px;
|
160 |
+
font-size: 0.875em;
|
161 |
cursor: pointer;
|
162 |
transition: all 0.3s ease;
|
163 |
}
|
|
|
185 |
height: 30px;
|
186 |
fill: var(--primary-color);
|
187 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
.dot {
|
189 |
+
display: inline-block;
|
190 |
+
width: 8px;
|
191 |
+
height: 8px;
|
192 |
+
border-radius: 50%;
|
193 |
+
background-color: #5853c0;
|
194 |
+
margin: 0 3px;
|
195 |
+
animation: bounce 1.4s infinite ease-in-out;
|
196 |
}
|
197 |
.dot:nth-child(1) { animation-delay: -0.32s; }
|
198 |
.dot:nth-child(2) { animation-delay: -0.16s; }
|
199 |
@keyframes bounce {
|
200 |
+
0%, 80%, 100% {
|
201 |
+
transform: scale(0);
|
202 |
+
} 40% {
|
203 |
+
transform: scale(1.0);
|
204 |
+
}
|
205 |
}
|
206 |
.chat-container {
|
207 |
+
position: relative;
|
208 |
}
|
|
|
209 |
.input-area {
|
210 |
+
position: absolute;
|
211 |
+
bottom: 0;
|
212 |
+
left: 0;
|
213 |
+
right: 0;
|
214 |
+
z-index: 10;
|
215 |
+
transition: transform 0.3s ease;
|
216 |
+
}
|
|
|
217 |
.messages {
|
218 |
+
padding-bottom: 80px;
|
219 |
}
|
|
|
220 |
.input-hidden {
|
221 |
+
transform: translateY(100%);
|
222 |
}
|
|
|
223 |
.tool-options {
|
224 |
position: absolute;
|
225 |
bottom: 100%;
|
|
|
232 |
flex-direction: column;
|
233 |
width: auto;
|
234 |
min-width: 120px;
|
235 |
+
margin-bottom: 10px;
|
236 |
}
|
|
|
237 |
.tool-options button {
|
238 |
padding: 10px 15px;
|
239 |
border: none;
|
|
|
242 |
cursor: pointer;
|
243 |
white-space: nowrap;
|
244 |
transition: background-color 0.3s ease;
|
245 |
+
font-size: 1em;
|
246 |
font-weight: 500;
|
247 |
+
color: #333;
|
248 |
+
border-radius: 4px;
|
249 |
}
|
|
|
250 |
.tool-options button:hover {
|
251 |
background-color: #e0e0e0;
|
252 |
color: #000;
|
253 |
}
|
|
|
|
|
254 |
details {
|
255 |
margin-top: 10px;
|
256 |
border-radius: 4px;
|
257 |
padding: 5px;
|
|
|
258 |
}
|
|
|
259 |
summary {
|
260 |
cursor: pointer;
|
261 |
font-weight: bold;
|
262 |
}
|
|
|
263 |
.ref-content {
|
264 |
margin-top: 10px;
|
265 |
justify-content: center;
|
266 |
}
|
|
|
267 |
.ref-item {
|
268 |
margin-bottom: 0px;
|
|
|
|
|
269 |
}
|
|
|
270 |
.ref-item small {
|
271 |
color: #666;
|
272 |
}
|
|
|
273 |
hr {
|
274 |
margin: 10px 0;
|
275 |
border: none;
|
|
|
282 |
padding: 5px;
|
283 |
border-radius: 4px;
|
284 |
transition: background-color 0.2s;
|
|
|
285 |
}
|
|
|
286 |
.ref-link:hover {
|
287 |
background-color: #e3e3ea;
|
288 |
color: inherit;
|
289 |
}
|
|
|
290 |
.ref-link:visited {
|
291 |
color: inherit;
|
292 |
+
}
|
293 |
+
img, video {
|
294 |
+
max-width: 100%;
|
295 |
+
height: auto;
|
296 |
+
}
|
297 |
+
@media (max-width: 600px) {
|
298 |
+
body {
|
299 |
+
font-size: 14px;
|
300 |
+
}
|
301 |
+
#app {
|
302 |
+
padding: 5px;
|
303 |
+
}
|
304 |
+
.chat-container {
|
305 |
+
height: 100vh;
|
306 |
+
border-radius: 0;
|
307 |
+
}
|
308 |
+
.messages {
|
309 |
+
padding: 10px;
|
310 |
+
}
|
311 |
+
.message {
|
312 |
+
max-width: 90%;
|
313 |
+
}
|
314 |
+
#user-input {
|
315 |
+
font-size: 16px;
|
316 |
+
padding: 12px;
|
317 |
+
}
|
318 |
+
.send-button, .reset-button {
|
319 |
+
width: 44px;
|
320 |
+
height: 44px;
|
321 |
+
}
|
322 |
+
.tool-options {
|
323 |
+
width: 100%;
|
324 |
+
left: 0;
|
325 |
+
right: 0;
|
326 |
+
}
|
327 |
+
.tool-options button {
|
328 |
+
padding: 12px 15px;
|
329 |
+
}
|
330 |
+
}
|
331 |
+
@media (max-width: 900px) and (orientation: landscape) {
|
332 |
+
.chat-container {
|
333 |
+
height: 100vh;
|
334 |
+
}
|
335 |
+
.messages {
|
336 |
+
max-height: calc(100vh - 60px);
|
337 |
+
}
|
338 |
+
}
|
339 |
+
@media (hover: none) {
|
340 |
+
.option-button:active {
|
341 |
+
background-color: var(--primary-color);
|
342 |
+
color: #ffffff;
|
343 |
+
}
|
344 |
}
|
345 |
</style>
|
346 |
</head>
|
|
|
389 |
</div>
|
390 |
</div>
|
391 |
</div>
|
|
|
392 |
<script>
|
393 |
marked.setOptions({
|
394 |
highlight: function (code, lang) {
|
|
|
409 |
container.appendChild(dot);
|
410 |
}
|
411 |
}
|
|
|
412 |
const app = new Vue({
|
413 |
el: '#app',
|
414 |
data: {
|
|
|
435 |
this.$nextTick(() => {
|
436 |
createTypingAnimation();
|
437 |
});
|
|
|
438 |
try {
|
439 |
const response = await fetch('https://pvanand-general-chat.hf.space/v2/followup-tools-agent', {
|
440 |
method: 'POST',
|
|
|
505 |
this.$set(this.messages[streamingIndex], 'content', marked.parse(rawResponse));
|
506 |
this.$set(this.messages[streamingIndex], 'rawResponse', rawResponse);
|
507 |
}
|
|
|
508 |
if (jsonData) {
|
509 |
if (jsonData.tools && jsonData.tools.length > 0) {
|
510 |
let toolsMessage = "\n\n**Tools Used:**\n";
|
|
|
514 |
|
515 |
this.$set(this.messages[streamingIndex], 'content', this.messages[streamingIndex].content + marked.parse(toolsMessage));
|
516 |
}
|
|
|
517 |
if (jsonData.clarification && jsonData.clarification.length > 0) {
|
518 |
streamingIndex = this.messages.push({ type: 'bot', content: '' }) - 1;
|
519 |
this.renderClarificationQuestions(jsonData.clarification, streamingIndex);
|
|
|
598 |
this.lastScrollTop = 0;
|
599 |
this.tool_call = 'auto';
|
600 |
this.showToolOptions = false;
|
|
|
601 |
this.$nextTick(() => {
|
602 |
if (this.$refs.messageContainer) {
|
603 |
this.$refs.messageContainer.scrollTop = 0;
|
604 |
}
|
605 |
});
|
|
|
606 |
const inputArea = document.querySelector('.input-area');
|
607 |
if (inputArea) inputArea.classList.remove('input-hidden');
|
608 |
},
|
|
|
671 |
} else {
|
672 |
this.showToolOptions = false;
|
673 |
}
|
|
|
674 |
// Reset tool_call to 'auto' if input doesn't contain /web or /news
|
675 |
if (!event.target.value.includes('/web') && !event.target.value.includes('/news')) {
|
676 |
this.tool_call = 'auto';
|