rahul-02 commited on
Commit
b002cd8
·
verified ·
1 Parent(s): 7f8c8b9

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +187 -121
templates/index.html CHANGED
@@ -3,192 +3,258 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>AI Research Assistant</title>
7
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
8
  <style>
9
  :root {
10
- --bg-color: #0f172a;
11
- --glass-bg: rgba(255, 255, 255, 0.05);
12
- --accent: #38bdf8;
13
- --text: #f1f5f9;
 
 
 
 
14
  }
15
 
 
 
16
  body {
17
- margin: 0;
18
- font-family: 'Inter', sans-serif;
19
- background: radial-gradient(circle at top right, #1e293b, #0f172a);
20
- color: var(--text);
21
  height: 100vh;
22
  display: flex;
23
- justify-content: center;
24
- align-items: center;
25
  }
26
 
27
- .chat-container {
28
- width: 90%;
29
- max-width: 800px;
30
- height: 80vh;
31
- background: var(--glass-bg);
32
- backdrop-filter: blur(12px);
33
- -webkit-backdrop-filter: blur(12px);
34
- border: 1px solid rgba(255, 255, 255, 0.1);
35
- border-radius: 24px;
36
  display: flex;
37
  flex-direction: column;
38
- overflow: hidden;
39
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  header {
43
- padding: 20px 30px;
44
- background: rgba(255, 255, 255, 0.03);
45
- border-bottom: 1px solid rgba(255, 255, 255, 0.05);
46
  display: flex;
47
  justify-content: space-between;
48
  align-items: center;
49
  }
50
 
51
- header h2 { font-weight: 600; margin: 0; font-size: 1.2rem; color: var(--accent); }
 
 
 
 
 
 
 
52
 
 
53
  #chat-window {
54
  flex: 1;
55
  overflow-y: auto;
56
- padding: 30px;
57
  display: flex;
58
  flex-direction: column;
59
- gap: 20px;
 
60
  }
61
 
62
  .message {
63
- max-width: 80%;
64
- padding: 12px 18px;
65
- border-radius: 18px;
66
- line-height: 1.5;
67
  font-size: 0.95rem;
68
- animation: fadeIn 0.3s ease;
69
  }
70
 
71
- @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
72
 
73
  .user-msg {
74
  align-self: flex-end;
75
- background: var(--accent);
76
  color: #000;
77
  border-bottom-right-radius: 4px;
 
78
  }
79
 
80
  .ai-msg {
81
  align-self: flex-start;
82
- background: rgba(255, 255, 255, 0.1);
83
- border: 1px solid rgba(255, 255, 255, 0.1);
84
  border-bottom-left-radius: 4px;
85
  }
86
 
87
- .typing { font-style: italic; color: #94a3b8; font-size: 0.8rem; }
 
 
 
 
 
 
88
 
89
- .input-area {
90
- padding: 20px 30px;
91
- background: rgba(0, 0, 0, 0.2);
 
 
 
 
92
  display: flex;
93
- gap: 15px;
 
94
  }
95
 
96
  input {
97
  flex: 1;
98
- background: rgba(255, 255, 255, 0.05);
99
- border: 1px solid rgba(255, 255, 255, 0.1);
100
- border-radius: 12px;
101
- padding: 12px 20px;
102
  color: white;
 
103
  outline: none;
104
- transition: border 0.3s;
105
  }
106
 
107
- input:focus { border-color: var(--accent); }
108
-
109
  button {
110
- background: var(--accent);
 
111
  border: none;
112
  padding: 10px 24px;
113
- border-radius: 12px;
114
- font-weight: 600;
115
  cursor: pointer;
116
- transition: transform 0.2s, opacity 0.2s;
117
  }
118
 
119
- button:hover { opacity: 0.9; transform: scale(1.02); }
120
- button:disabled { opacity: 0.5; cursor: not-allowed; }
121
  </style>
122
  </head>
123
  <body>
124
 
125
- <div class="chat-container">
126
- <header>
127
- <h2>Llama 3.2 Assistant</h2>
128
- <span style="font-size: 0.7rem; color: #94a3b8;">STABLE V2.6</span>
129
- </header>
130
-
131
- <div id="chat-window">
132
- <div class="message ai-msg">Hello! I'm your AI Research Assistant. Ask me anything about current events or general knowledge.</div>
133
- </div>
134
-
135
- <div class="input-area">
136
- <input type="text" id="user-input" placeholder="Type your question..." autocomplete="off">
137
- <button id="send-btn">Send</button>
138
- </div>
139
- </div>
140
-
141
- <script>
142
- const chatWindow = document.getElementById('chat-window');
143
- const userInput = document.getElementById('user-input');
144
- const sendBtn = document.getElementById('send-btn');
145
-
146
- function appendMessage(text, isUser) {
147
- const msgDiv = document.createElement('div');
148
- msgDiv.className = `message ${isUser ? 'user-msg' : 'ai-msg'}`;
149
- msgDiv.innerText = text;
150
- chatWindow.appendChild(msgDiv);
151
- chatWindow.scrollTop = chatWindow.scrollHeight;
152
- }
153
-
154
- async function handleSend() {
155
- const query = userInput.value.trim();
156
- if (!query) return;
157
-
158
- appendMessage(query, true);
159
- userInput.value = '';
160
 
161
- // Show loading state
162
- sendBtn.disabled = true;
163
- const typingIndicator = document.createElement('div');
164
- typingIndicator.className = 'message ai-msg typing';
165
- typingIndicator.innerText = 'Searching and thinking...';
166
- chatWindow.appendChild(typingIndicator);
167
- chatWindow.scrollTop = chatWindow.scrollHeight;
168
-
169
- try {
170
- const response = await fetch('/ask', {
171
- method: 'POST',
172
- headers: { 'Content-Type': 'application/json' },
173
- body: JSON.stringify({ query: query })
174
- });
175
- const data = await response.json();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
- chatWindow.removeChild(typingIndicator);
178
- appendMessage(data.answer, false);
179
- } catch (error) {
180
- chatWindow.removeChild(typingIndicator);
181
- appendMessage("Error: Could not connect to the server.", false);
182
- } finally {
183
- sendBtn.disabled = false;
184
- }
185
- }
186
-
187
- sendBtn.addEventListener('click', handleSend);
188
- userInput.addEventListener('keypress', (e) => {
189
- if (e.key === 'Enter') handleSend();
190
- });
191
- </script>
 
 
 
 
 
 
 
 
 
 
 
192
 
 
 
 
193
  </body>
194
  </html>
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Nexus AI | Research OS</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;600;700&display=swap" rel="stylesheet">
8
  <style>
9
  :root {
10
+ --bg-dark: #020617;
11
+ --sidebar-bg: #0f172a;
12
+ --accent-primary: #38bdf8;
13
+ --accent-glow: rgba(56, 189, 248, 0.3);
14
+ --glass-white: rgba(255, 255, 255, 0.03);
15
+ --border: rgba(255, 255, 255, 0.08);
16
+ --text-main: #f8fafc;
17
+ --text-dim: #94a3b8;
18
  }
19
 
20
+ * { margin: 0; padding: 0; box-sizing: border-box; }
21
+
22
  body {
23
+ font-family: 'Plus Jakarta Sans', sans-serif;
24
+ background-color: var(--bg-dark);
25
+ color: var(--text-main);
 
26
  height: 100vh;
27
  display: flex;
28
+ overflow: hidden;
 
29
  }
30
 
31
+ /* SaaS Sidebar */
32
+ aside {
33
+ width: 260px;
34
+ background: var(--sidebar-bg);
35
+ border-right: 1px solid var(--border);
 
 
 
 
36
  display: flex;
37
  flex-direction: column;
38
+ padding: 24px;
39
+ }
40
+
41
+ .logo {
42
+ font-size: 1.5rem;
43
+ font-weight: 700;
44
+ color: var(--accent-primary);
45
+ margin-bottom: 40px;
46
+ letter-spacing: -1px;
47
+ }
48
+
49
+ .nav-item {
50
+ padding: 12px 16px;
51
+ border-radius: 12px;
52
+ color: var(--text-dim);
53
+ text-decoration: none;
54
+ margin-bottom: 8px;
55
+ transition: 0.2s;
56
+ font-weight: 500;
57
+ }
58
+
59
+ .nav-item.active, .nav-item:hover {
60
+ background: var(--glass-white);
61
+ color: var(--text-main);
62
+ }
63
+
64
+ /* Main Workspace */
65
+ main {
66
+ flex: 1;
67
+ display: flex;
68
+ flex-direction: column;
69
+ position: relative;
70
  }
71
 
72
  header {
73
+ padding: 20px 40px;
74
+ border-bottom: 1px solid var(--border);
 
75
  display: flex;
76
  justify-content: space-between;
77
  align-items: center;
78
  }
79
 
80
+ .status-pill {
81
+ background: rgba(34, 197, 94, 0.1);
82
+ color: #4ade80;
83
+ padding: 4px 12px;
84
+ border-radius: 100px;
85
+ font-size: 0.75rem;
86
+ border: 1px solid rgba(34, 197, 94, 0.2);
87
+ }
88
 
89
+ /* Chat Area Design */
90
  #chat-window {
91
  flex: 1;
92
  overflow-y: auto;
93
+ padding: 40px;
94
  display: flex;
95
  flex-direction: column;
96
+ gap: 24px;
97
+ mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
98
  }
99
 
100
  .message {
101
+ max-width: 75%;
102
+ padding: 20px;
103
+ border-radius: 20px;
104
+ line-height: 1.6;
105
  font-size: 0.95rem;
106
+ animation: slideUp 0.4s ease-out;
107
  }
108
 
109
+ @keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
110
 
111
  .user-msg {
112
  align-self: flex-end;
113
+ background: var(--accent-primary);
114
  color: #000;
115
  border-bottom-right-radius: 4px;
116
+ box-shadow: 0 10px 20px -10px var(--accent-glow);
117
  }
118
 
119
  .ai-msg {
120
  align-self: flex-start;
121
+ background: var(--glass-white);
122
+ border: 1px solid var(--border);
123
  border-bottom-left-radius: 4px;
124
  }
125
 
126
+ .typing { color: var(--text-dim); font-size: 0.85rem; padding-left: 10px; }
127
+
128
+ /* SaaS Input Bar */
129
+ .input-container {
130
+ padding: 30px 40px;
131
+ background: linear-gradient(to top, var(--bg-dark), transparent);
132
+ }
133
 
134
+ .input-wrapper {
135
+ max-width: 900px;
136
+ margin: 0 auto;
137
+ background: rgba(255, 255, 255, 0.05);
138
+ border: 1px solid var(--border);
139
+ border-radius: 16px;
140
+ padding: 8px;
141
  display: flex;
142
+ align-items: center;
143
+ box-shadow: 0 0 0 1px var(--border), 0 20px 40px -20px rgba(0,0,0,0.5);
144
  }
145
 
146
  input {
147
  flex: 1;
148
+ background: transparent;
149
+ border: none;
 
 
150
  color: white;
151
+ padding: 12px 16px;
152
  outline: none;
153
+ font-size: 1rem;
154
  }
155
 
 
 
156
  button {
157
+ background: var(--accent-primary);
158
+ color: #000;
159
  border: none;
160
  padding: 10px 24px;
161
+ border-radius: 10px;
162
+ font-weight: 700;
163
  cursor: pointer;
164
+ transition: 0.3s;
165
  }
166
 
167
+ button:hover { transform: translateY(-2px); box-shadow: 0 5px 15px var(--accent-glow); }
168
+ button:disabled { background: #334155; color: #94a3b8; transform: none; box-shadow: none; }
169
  </style>
170
  </head>
171
  <body>
172
 
173
+ <aside>
174
+ <div class="logo">Nexus AI</div>
175
+ <a href="#" class="nav-item active">Dashboard</a>
176
+ <a href="#" class="nav-item">Research Vault</a>
177
+ <a href="#" class="nav-item">Integrations</a>
178
+ <a href="#" class="nav-item">Settings</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
+ <div style="margin-top: auto; padding: 20px; background: var(--glass-white); border-radius: 16px;">
181
+ <p style="font-size: 0.75rem; color: var(--text-dim);">Usage Plan</p>
182
+ <p style="font-size: 0.9rem; margin-top: 4px;">Pro - Enterprise</p>
183
+ </div>
184
+ </aside>
185
+
186
+ <main>
187
+ <header>
188
+ <div>
189
+ <h1 style="font-size: 1.1rem;">Research Assistant</h1>
190
+ <p style="font-size: 0.8rem; color: var(--text-dim);">Llama 3.2 Model Active</p>
191
+ </div>
192
+ <div class="status-pill">● System Online</div>
193
+ </header>
194
+
195
+ <div id="chat-window">
196
+ <div class="message ai-msg">
197
+ Welcome back. I have access to real-time search and the Llama 3.2 inference engine. How can I assist your research today?
198
+ </div>
199
+ </div>
200
+
201
+ <div class="input-container">
202
+ <div class="input-wrapper">
203
+ <input type="text" id="user-input" placeholder="Enter research prompt or URL..." autocomplete="off">
204
+ <button id="send-btn">Generate</button>
205
+ </div>
206
+ </div>
207
+ </main>
208
+
209
+ <script>
210
+ const chatWindow = document.getElementById('chat-window');
211
+ const userInput = document.getElementById('user-input');
212
+ const sendBtn = document.getElementById('send-btn');
213
+
214
+ function appendMessage(text, isUser) {
215
+ const msgDiv = document.createElement('div');
216
+ msgDiv.className = `message ${isUser ? 'user-msg' : 'ai-msg'}`;
217
+ msgDiv.innerText = text;
218
+ chatWindow.appendChild(msgDiv);
219
+ chatWindow.scrollTop = chatWindow.scrollHeight;
220
+ }
221
+
222
+ async function handleSend() {
223
+ const query = userInput.value.trim();
224
+ if (!query) return;
225
+
226
+ appendMessage(query, true);
227
+ userInput.value = '';
228
 
229
+ sendBtn.disabled = true;
230
+ const typingIndicator = document.createElement('div');
231
+ typingIndicator.className = 'typing';
232
+ typingIndicator.innerText = 'Nexus AI is searching the web...';
233
+ chatWindow.appendChild(typingIndicator);
234
+ chatWindow.scrollTop = chatWindow.scrollHeight;
235
+
236
+ try {
237
+ const response = await fetch(`${window.location.origin}/ask`, {
238
+ method: 'POST',
239
+ headers: { 'Content-Type': 'application/json' },
240
+ body: JSON.stringify({ query: query })
241
+ });
242
+
243
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
244
+
245
+ const data = await response.json();
246
+ chatWindow.removeChild(typingIndicator);
247
+ appendMessage(data.answer, false);
248
+ } catch (error) {
249
+ if (chatWindow.contains(typingIndicator)) chatWindow.removeChild(typingIndicator);
250
+ appendMessage(`Error: ${error.message}. Please verify the Space is awake and running.`, false);
251
+ } finally {
252
+ sendBtn.disabled = false;
253
+ }
254
+ }
255
 
256
+ sendBtn.addEventListener('click', handleSend);
257
+ userInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') handleSend(); });
258
+ </script>
259
  </body>
260
  </html>