Spaces:
Running
Running
Srinivasulu kethanaboina
commited on
Update index.html
Browse files- index.html +36 -90
index.html
CHANGED
@@ -3,111 +3,57 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>
|
7 |
<style>
|
8 |
body {
|
9 |
font-family: Arial, sans-serif;
|
10 |
-
margin:
|
|
|
11 |
}
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
}
|
17 |
-
input, button {
|
18 |
-
padding: 10px;
|
19 |
-
margin-bottom: 10px;
|
20 |
-
font-size: 16px;
|
21 |
-
}
|
22 |
-
button {
|
23 |
-
cursor: pointer;
|
24 |
-
}
|
25 |
-
#chat-history {
|
26 |
-
border: 1px solid #ddd;
|
27 |
padding: 20px;
|
28 |
-
max-height: 300px;
|
29 |
-
overflow-y: auto;
|
30 |
-
background-color: #f9f9f9;
|
31 |
-
}
|
32 |
-
.chat-entry {
|
33 |
-
margin-bottom: 15px;
|
34 |
-
padding-bottom: 10px;
|
35 |
-
border-bottom: 1px solid #ddd;
|
36 |
}
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
40 |
}
|
41 |
-
.
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
}
|
48 |
</style>
|
49 |
</head>
|
50 |
<body>
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
<!-- Chat history will be displayed here -->
|
61 |
</div>
|
62 |
|
63 |
<script>
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
alert('Please enter a URL');
|
71 |
-
return;
|
72 |
-
}
|
73 |
-
|
74 |
-
try {
|
75 |
-
const response = await fetch(url);
|
76 |
-
if (!response.ok) {
|
77 |
-
throw new Error('Failed to fetch chat history.');
|
78 |
-
}
|
79 |
-
|
80 |
-
const chatHistory = await response.json();
|
81 |
-
|
82 |
-
// Display chat history
|
83 |
-
chatHistory.forEach(entry => {
|
84 |
-
const chatEntryDiv = document.createElement('div');
|
85 |
-
chatEntryDiv.classList.add('chat-entry');
|
86 |
-
|
87 |
-
const timestampDiv = document.createElement('div');
|
88 |
-
timestampDiv.classList.add('timestamp');
|
89 |
-
timestampDiv.textContent = `Timestamp: ${entry.timestamp}`;
|
90 |
-
|
91 |
-
const userQueryDiv = document.createElement('div');
|
92 |
-
userQueryDiv.classList.add('user-query');
|
93 |
-
userQueryDiv.textContent = `User asked: ${entry.query}`;
|
94 |
-
|
95 |
-
const botResponseDiv = document.createElement('div');
|
96 |
-
botResponseDiv.classList.add('bot-response');
|
97 |
-
botResponseDiv.textContent = `Bot answered: ${entry.response}`;
|
98 |
-
|
99 |
-
chatEntryDiv.appendChild(timestampDiv);
|
100 |
-
chatEntryDiv.appendChild(userQueryDiv);
|
101 |
-
chatEntryDiv.appendChild(botResponseDiv);
|
102 |
-
|
103 |
-
chatHistoryDiv.appendChild(chatEntryDiv);
|
104 |
-
});
|
105 |
-
|
106 |
-
} catch (error) {
|
107 |
-
alert('Error fetching chat history: ' + error.message);
|
108 |
-
}
|
109 |
}
|
110 |
-
</script>
|
111 |
|
|
|
|
|
|
|
112 |
</body>
|
113 |
</html>
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Gradio Chatbot</title>
|
7 |
<style>
|
8 |
body {
|
9 |
font-family: Arial, sans-serif;
|
10 |
+
margin: 0;
|
11 |
+
padding: 0;
|
12 |
}
|
13 |
+
.container {
|
14 |
+
display: flex;
|
15 |
+
flex-direction: column;
|
16 |
+
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
padding: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
}
|
19 |
+
iframe {
|
20 |
+
width: 80%;
|
21 |
+
height: 600px;
|
22 |
+
border: none;
|
23 |
+
margin-bottom: 20px;
|
24 |
}
|
25 |
+
.session-data {
|
26 |
+
margin-top: 20px;
|
27 |
+
padding: 10px;
|
28 |
+
border: 1px solid #ddd;
|
29 |
+
border-radius: 5px;
|
30 |
+
width: 80%;
|
31 |
}
|
32 |
</style>
|
33 |
</head>
|
34 |
<body>
|
35 |
+
<div class="container">
|
36 |
+
<!-- Embed the Gradio Chatbot -->
|
37 |
+
<iframe src="https://srinukethanaboina-srunu.hf.space" title="Gradio Chatbot"></iframe>
|
38 |
+
|
39 |
+
<!-- Display Session Data -->
|
40 |
+
<div class="session-data" id="session-data">
|
41 |
+
<h2>Session Data:</h2>
|
42 |
+
<pre id="session-info">Loading session data...</pre>
|
43 |
+
</div>
|
|
|
44 |
</div>
|
45 |
|
46 |
<script>
|
47 |
+
// Example JavaScript to handle session data
|
48 |
+
function getSessionData() {
|
49 |
+
// This is a placeholder; you would replace this with actual session data retrieval logic
|
50 |
+
// If you have cookies or localStorage, you might want to read from them
|
51 |
+
const sessionInfo = localStorage.getItem('chat_session_data') || 'No session data available';
|
52 |
+
document.getElementById('session-info').textContent = sessionInfo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
|
|
54 |
|
55 |
+
// Call the function to display session data
|
56 |
+
getSessionData();
|
57 |
+
</script>
|
58 |
</body>
|
59 |
</html>
|