hmb HF Staff commited on
Commit
09f503f
·
1 Parent(s): 7159397
Files changed (2) hide show
  1. src/app.css +221 -1
  2. src/routes/+page.svelte +18 -148
src/app.css CHANGED
@@ -1,5 +1,5 @@
1
  :root {
2
- font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3
  line-height: 1.5;
4
  font-weight: 400;
5
 
@@ -33,6 +33,7 @@ body {
33
  h1 {
34
  font-size: 3.2em;
35
  line-height: 1.1;
 
36
  }
37
 
38
  .card {
@@ -77,3 +78,222 @@ button:focus-visible {
77
  background-color: #f9f9f9;
78
  }
79
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  :root {
2
+ font-family: Avenir, Helvetica, Arial, sans-serif;
3
  line-height: 1.5;
4
  font-weight: 400;
5
 
 
33
  h1 {
34
  font-size: 3.2em;
35
  line-height: 1.1;
36
+ font-family: Arial, Helvetica, sans-serif;
37
  }
38
 
39
  .card {
 
78
  background-color: #f9f9f9;
79
  }
80
  }
81
+
82
+ /* Moved from src/routes/+page.svelte */
83
+ body {
84
+ background: radial-gradient(1200px 600px at 10% 10%, #eef2ff 0%, transparent 60%),
85
+ radial-gradient(1200px 600px at 90% 20%, #fce7f3 0%, transparent 60%),
86
+ radial-gradient(1200px 600px at 50% 100%, #dcfce7 0%, transparent 60%);
87
+ }
88
+
89
+ .page-header {
90
+ max-width: 1200px;
91
+ margin: 0 auto;
92
+ padding: 24px 24px 0 24px;
93
+ font-family: Arial, Helvetica, sans-serif;
94
+ }
95
+
96
+ .page-header h1 {
97
+ margin: 0;
98
+ font-size: 28px;
99
+ letter-spacing: -0.02em;
100
+ color: #0f172a;
101
+ font-family: Arial, Helvetica, sans-serif;
102
+ }
103
+
104
+ .subtitle {
105
+ margin: 6px 0 0 0;
106
+ color: #475569;
107
+ font-size: 14px;
108
+ }
109
+
110
+ .container {
111
+ display: flex;
112
+ height: calc(100vh - 80px);
113
+ width: 100%;
114
+ max-width: 1200px;
115
+ margin: 0 auto;
116
+ padding: 24px;
117
+ gap: 16px;
118
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
119
+ }
120
+
121
+ .dataframe-section {
122
+ width: 75%;
123
+ padding: 16px;
124
+ overflow: hidden;
125
+ padding-bottom: 100px;
126
+ border-radius: 16px;
127
+ background: rgba(255, 255, 255, 0.6);
128
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
129
+ backdrop-filter: blur(10px);
130
+ border: 1px solid rgba(2, 6, 23, 0.06);
131
+ }
132
+
133
+ .credits {
134
+ text-align: center;
135
+ margin-top: 20px;
136
+ padding: 10px;
137
+ color: #666;
138
+ font-size: 12px;
139
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
140
+ border-top: 1px solid #e0e0e0;
141
+ background-color: #f8f9fa;
142
+ border-radius: 0 0 8px 8px;
143
+ }
144
+
145
+ .chatbot-section {
146
+ width: 25%;
147
+ padding: 16px;
148
+ display: flex;
149
+ flex-direction: column;
150
+ background: rgba(255, 255, 255, 0.6);
151
+ border-radius: 16px;
152
+ box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
153
+ backdrop-filter: blur(10px);
154
+ border: 1px solid rgba(2, 6, 23, 0.06);
155
+ }
156
+
157
+ h2 {
158
+ margin: 0 0 20px 0;
159
+ color: #333;
160
+ font-size: 20px;
161
+ font-weight: 600;
162
+ }
163
+
164
+ .chat-messages {
165
+ flex: 1;
166
+ overflow-y: auto;
167
+ margin-bottom: 20px;
168
+ padding: 8px;
169
+ }
170
+
171
+ .message {
172
+ margin-bottom: 12px;
173
+ }
174
+
175
+ .message.user {
176
+ text-align: right;
177
+ }
178
+
179
+ .message.bot {
180
+ text-align: left;
181
+ }
182
+
183
+ .message-content {
184
+ display: inline-block;
185
+ padding: 10px 14px;
186
+ border-radius: 14px;
187
+ max-width: 85%;
188
+ word-wrap: break-word;
189
+ font-size: 14px;
190
+ line-height: 1.4;
191
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
192
+ border: 1px solid rgba(2, 6, 23, 0.06);
193
+ }
194
+
195
+ .message.user .message-content {
196
+ background: linear-gradient(135deg, #2563eb, #0ea5e9);
197
+ color: white;
198
+ font-weight: 500;
199
+ box-shadow: 0 6px 20px rgba(37, 99, 235, 0.3);
200
+ }
201
+
202
+ .message.bot .message-content {
203
+ background: rgba(248, 250, 252, 0.9);
204
+ color: #0f172a;
205
+ font-weight: 400;
206
+ }
207
+
208
+ .chat-input {
209
+ display: flex;
210
+ gap: 10px;
211
+ }
212
+
213
+ .chat-input input {
214
+ flex: 1;
215
+ padding: 12px 14px;
216
+ border: 1px solid rgba(2, 6, 23, 0.12);
217
+ border-radius: 12px;
218
+ font-size: 14px;
219
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
220
+ transition: border-color 0.2s ease;
221
+ background: rgba(255, 255, 255, 0.9);
222
+ }
223
+
224
+ .chat-input input:focus {
225
+ outline: none;
226
+ border-color: #60a5fa;
227
+ box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
228
+ }
229
+
230
+ .send-button {
231
+ display: inline-flex;
232
+ align-items: center;
233
+ gap: 10px;
234
+ padding: 12px 16px;
235
+ background: linear-gradient(135deg, #2563eb, #0ea5e9);
236
+ color: white;
237
+ border: none;
238
+ border-radius: 12px;
239
+ cursor: pointer;
240
+ font-size: 14px;
241
+ font-weight: 600;
242
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
243
+ transition: transform 0.08s ease, box-shadow 0.2s ease;
244
+ box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
245
+ }
246
+
247
+ .send-button:hover {
248
+ transform: translateY(-1px);
249
+ box-shadow: 0 14px 24px rgba(37, 99, 235, 0.35);
250
+ }
251
+
252
+ .send-button:disabled {
253
+ opacity: 0.7;
254
+ cursor: not-allowed;
255
+ filter: grayscale(30%);
256
+ }
257
+
258
+ .chat-input-container {
259
+ position: fixed;
260
+ bottom: 0;
261
+ left: 0;
262
+ right: 0;
263
+ background: rgba(255, 255, 255, 0.8);
264
+ border-top: 1px solid #e1e5e9;
265
+ padding: 20px;
266
+ box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
267
+ }
268
+
269
+ .chat-input {
270
+ max-width: 1200px;
271
+ margin: 0 auto;
272
+ display: flex;
273
+ gap: 10px;
274
+ }
275
+
276
+ .spinner {
277
+ width: 16px;
278
+ height: 16px;
279
+ border-radius: 9999px;
280
+ border: 2px solid rgba(255, 255, 255, 0.6);
281
+ border-top-color: white;
282
+ animation: spin 0.8s linear infinite;
283
+ }
284
+
285
+ @keyframes spin {
286
+ from { transform: rotate(0deg); }
287
+ to { transform: rotate(360deg); }
288
+ }
289
+
290
+ @media (max-width: 1024px) {
291
+ .container {
292
+ flex-direction: column;
293
+ height: auto;
294
+ padding-bottom: 120px;
295
+ }
296
+ .dataframe-section, .chatbot-section {
297
+ width: 100%;
298
+ }
299
+ }
src/routes/+page.svelte CHANGED
@@ -151,11 +151,16 @@ Keep your responses concise and helpful. Answer questions about the data above.`
151
  }
152
  </script>
153
 
 
 
 
 
 
 
154
  <div class="container">
155
  <div class="dataframe-section">
156
  <Dataframe
157
  bind:value
158
- {datatype}
159
  show_search="none"
160
  show_row_numbers={false}
161
  show_copy_button={false}
@@ -187,154 +192,19 @@ Keep your responses concise and helpful. Answer questions about the data above.`
187
  bind:value={newMessage}
188
  placeholder="What is Alice's salary?"
189
  on:keypress={handleKeyPress}
190
- autofocus
 
 
191
  />
192
- <button on:click={sendMessage}>Send</button>
 
 
 
 
 
 
 
193
  </div>
194
  </div>
195
 
196
- <style>
197
- .container {
198
- display: flex;
199
- height: 100vh;
200
- width: 100vw;
201
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
202
- }
203
-
204
- .dataframe-section {
205
- width: 80%;
206
- padding: 20px;
207
- border-right: 2px solid #e0e0e0;
208
- overflow: hidden;
209
- padding-bottom: 100px;
210
- }
211
-
212
- .credits {
213
- text-align: center;
214
- margin-top: 20px;
215
- padding: 10px;
216
- color: #666;
217
- font-size: 12px;
218
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
219
- border-top: 1px solid #e0e0e0;
220
- background-color: #f8f9fa;
221
- border-radius: 0 0 8px 8px;
222
- }
223
-
224
- .chatbot-section {
225
- width: 20%;
226
- padding: 20px;
227
- display: flex;
228
- flex-direction: column;
229
- background-color: #f8f9fa;
230
- }
231
-
232
- h2 {
233
- margin: 0 0 20px 0;
234
- color: #333;
235
- font-size: 20px;
236
- font-weight: 600;
237
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
238
- }
239
-
240
- .chat-messages {
241
- flex: 1;
242
- overflow-y: auto;
243
- margin-bottom: 20px;
244
- padding: 15px;
245
- background: white;
246
- border-radius: 12px;
247
- border: 1px solid #e1e5e9;
248
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
249
- }
250
-
251
- .message {
252
- margin-bottom: 12px;
253
- }
254
-
255
- .message.user {
256
- text-align: right;
257
- }
258
-
259
- .message.bot {
260
- text-align: left;
261
- }
262
-
263
- .message-content {
264
- display: inline-block;
265
- padding: 10px 16px;
266
- border-radius: 20px;
267
- max-width: 85%;
268
- word-wrap: break-word;
269
- font-size: 14px;
270
- line-height: 1.4;
271
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
272
- }
273
-
274
- .message.user .message-content {
275
- background-color: #007acc;
276
- color: white;
277
- font-weight: 500;
278
- }
279
-
280
- .message.bot .message-content {
281
- background-color: #f1f3f4;
282
- color: #202124;
283
- font-weight: 400;
284
- }
285
-
286
- .chat-input {
287
- display: flex;
288
- gap: 10px;
289
- }
290
-
291
- .chat-input input {
292
- flex: 1;
293
- padding: 12px 16px;
294
- border: 2px solid #e1e5e9;
295
- border-radius: 8px;
296
- font-size: 14px;
297
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
298
- transition: border-color 0.2s ease;
299
- }
300
-
301
- .chat-input input:focus {
302
- outline: none;
303
- border-color: #007acc;
304
- }
305
-
306
- .chat-input button {
307
- padding: 12px 20px;
308
- background-color: #007acc;
309
- color: white;
310
- border: none;
311
- border-radius: 8px;
312
- cursor: pointer;
313
- font-size: 14px;
314
- font-weight: 500;
315
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
316
- transition: background-color 0.2s ease;
317
- }
318
-
319
- .chat-input button:hover {
320
- background-color: #005a9e;
321
- }
322
-
323
- .chat-input-container {
324
- position: fixed;
325
- bottom: 0;
326
- left: 0;
327
- right: 0;
328
- background: white;
329
- border-top: 1px solid #e1e5e9;
330
- padding: 20px;
331
- box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
332
- }
333
-
334
- .chat-input {
335
- max-width: 1200px;
336
- margin: 0 auto;
337
- display: flex;
338
- gap: 10px;
339
- }
340
- </style>
 
151
  }
152
  </script>
153
 
154
+
155
+ <header class="page-header">
156
+ <h1>Data Chat</h1>
157
+ <p>Ask questions about your employee table in real time</p>
158
+ </header>
159
+
160
  <div class="container">
161
  <div class="dataframe-section">
162
  <Dataframe
163
  bind:value
 
164
  show_search="none"
165
  show_row_numbers={false}
166
  show_copy_button={false}
 
192
  bind:value={newMessage}
193
  placeholder="What is Alice's salary?"
194
  on:keypress={handleKeyPress}
195
+ aria-label="Chat input"
196
+ aria-busy={isGenerating}
197
+ disabled={!isModelReady || isGenerating}
198
  />
199
+ <button class="send-button" on:click={sendMessage} disabled={!isModelReady || isGenerating}>
200
+ {#if isGenerating}
201
+ <span class="spinner" aria-hidden="true"></span>
202
+ <span>Thinking...</span>
203
+ {:else}
204
+ <span>Send</span>
205
+ {/if}
206
+ </button>
207
  </div>
208
  </div>
209
 
210
+ <style></style>