Thomas G. Lopes commited on
Commit
539f4bc
Β·
1 Parent(s): cdc312f

fix responsiveness

Browse files
src/lib/components/inference-playground/message.svelte CHANGED
@@ -99,6 +99,7 @@
99
  >
100
  {message?.role}
101
  </div>
 
102
  <div class="flex w-full gap-4">
103
  {#if conversation.data.parseMarkdown && message?.role === "assistant"}
104
  <div
@@ -179,105 +180,106 @@
179
  {/if}
180
 
181
  <!-- Sticky wrapper for action buttons -->
182
- <div class={["top-8 z-10 self-start", shouldStick && "sticky"]}>
183
- <div
184
- class="flex flex-none flex-col items-start @2xl:flex-row @max-2xl:[&>button]:-my-px @2xl:[&>button]:-mx-px @max-2xl:[&>button:first-of-type]:rounded-t-md @2xl:[&>button:first-of-type]:rounded-l-md @max-2xl:[&>button:last-of-type]:rounded-b-md @2xl:[&>button:last-of-type]:rounded-r-md"
185
- >
186
- {#if canUploadImgs}
187
- <Tooltip openDelay={250}>
188
- {#snippet trigger(tooltip)}
189
- <button
190
- tabindex="0"
191
- type="button"
192
- class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900
 
 
193
  hover:bg-gray-100
194
  hover:text-blue-700 focus:z-10 focus:ring-4
195
  focus:ring-gray-100 focus:outline-hidden dark:border-gray-600
196
  dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
197
- {...tooltip.trigger}
198
- {...fileUpload.trigger}
199
- >
200
- <IconImage />
201
- </button>
202
- <input {...fileUpload.input} />
203
- {/snippet}
204
- Add image
205
- </Tooltip>
206
- {/if}
207
 
208
- <Tooltip>
209
- {#snippet trigger(tooltip)}
210
- <LocalToasts>
211
- {#snippet children({ trigger, addToast })}
212
- <button
213
- tabindex="0"
214
- onclick={() => {
215
- copyToClipboard(message.content ?? "");
216
- addToast({ data: { content: "βœ“", variant: "info" } });
217
- }}
218
- type="button"
219
- class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100
220
  hover:text-blue-700
221
  focus:z-10 focus:ring-4 focus:ring-gray-100
222
  focus:outline-hidden dark:border-gray-600 dark:bg-gray-800
223
  dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
224
- {...tooltip.trigger}
225
- {...trigger}
226
- >
227
- <IconCopy />
228
- </button>
229
- {/snippet}
230
- </LocalToasts>
231
- {/snippet}
232
- Copy
233
- </Tooltip>
234
 
235
- <Tooltip>
236
- {#snippet trigger(tooltip)}
237
- <button
238
- tabindex="0"
239
- onclick={onRegen}
240
- type="button"
241
- class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100
242
  hover:text-blue-700
243
  focus:z-10 focus:ring-4 focus:ring-gray-100
244
  focus:outline-hidden dark:border-gray-600 dark:bg-gray-800
245
  dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
246
- {...tooltip.trigger}
247
- >
248
- <IconCustom icon={message.role === "user" ? "regen" : "refresh"} />
249
- </button>
250
- {/snippet}
251
- <div class="flex items-center gap-2">
252
- {regenLabel}
253
 
254
- <span
255
- class="inline-flex items-center gap-0.5 rounded-sm border border-white/20 bg-white/10 px-0.5 text-xs text-white/70"
256
- >
257
- {cmdOrCtrl}<span class="">G</span>
258
- </span>
259
- </div>
260
- </Tooltip>
261
 
262
- <Tooltip>
263
- {#snippet trigger(tooltip)}
264
- <button
265
- tabindex="0"
266
- onclick={onDelete}
267
- type="button"
268
- class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100
269
  hover:text-blue-700
270
  focus:z-10 focus:ring-4 focus:ring-gray-100
271
  focus:outline-hidden dark:border-gray-600 dark:bg-gray-800
272
  dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
273
- {...tooltip.trigger}
274
- >
275
- βœ•
276
- </button>
277
- {/snippet}
278
- Delete
279
- </Tooltip>
280
- </div>
281
  </div>
282
  </div>
283
  </div>
 
99
  >
100
  {message?.role}
101
  </div>
102
+
103
  <div class="flex w-full gap-4">
104
  {#if conversation.data.parseMarkdown && message?.role === "assistant"}
105
  <div
 
180
  {/if}
181
 
182
  <!-- Sticky wrapper for action buttons -->
183
+ <div
184
+ class={[
185
+ "top-8 z-10 flex flex-none flex-col items-start self-start @2xl:flex-row @max-2xl:[&>button]:-my-px @2xl:[&>button]:-mx-px @max-2xl:[&>button:first-of-type]:rounded-t-md @2xl:[&>button:first-of-type]:rounded-l-md @max-2xl:[&>button:last-of-type]:rounded-b-md @2xl:[&>button:last-of-type]:rounded-r-md",
186
+ shouldStick && "sticky",
187
+ ]}
188
+ >
189
+ {#if canUploadImgs}
190
+ <Tooltip openDelay={250}>
191
+ {#snippet trigger(tooltip)}
192
+ <button
193
+ tabindex="0"
194
+ type="button"
195
+ class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900
196
  hover:bg-gray-100
197
  hover:text-blue-700 focus:z-10 focus:ring-4
198
  focus:ring-gray-100 focus:outline-hidden dark:border-gray-600
199
  dark:bg-gray-800 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
200
+ {...tooltip.trigger}
201
+ {...fileUpload.trigger}
202
+ >
203
+ <IconImage />
204
+ </button>
205
+ <input {...fileUpload.input} />
206
+ {/snippet}
207
+ Add image
208
+ </Tooltip>
209
+ {/if}
210
 
211
+ <Tooltip>
212
+ {#snippet trigger(tooltip)}
213
+ <LocalToasts>
214
+ {#snippet children({ trigger, addToast })}
215
+ <button
216
+ tabindex="0"
217
+ onclick={() => {
218
+ copyToClipboard(message.content ?? "");
219
+ addToast({ data: { content: "βœ“", variant: "info" } });
220
+ }}
221
+ type="button"
222
+ class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100
223
  hover:text-blue-700
224
  focus:z-10 focus:ring-4 focus:ring-gray-100
225
  focus:outline-hidden dark:border-gray-600 dark:bg-gray-800
226
  dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
227
+ {...tooltip.trigger}
228
+ {...trigger}
229
+ >
230
+ <IconCopy />
231
+ </button>
232
+ {/snippet}
233
+ </LocalToasts>
234
+ {/snippet}
235
+ Copy
236
+ </Tooltip>
237
 
238
+ <Tooltip>
239
+ {#snippet trigger(tooltip)}
240
+ <button
241
+ tabindex="0"
242
+ onclick={onRegen}
243
+ type="button"
244
+ class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100
245
  hover:text-blue-700
246
  focus:z-10 focus:ring-4 focus:ring-gray-100
247
  focus:outline-hidden dark:border-gray-600 dark:bg-gray-800
248
  dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
249
+ {...tooltip.trigger}
250
+ >
251
+ <IconCustom icon={message.role === "user" ? "regen" : "refresh"} />
252
+ </button>
253
+ {/snippet}
254
+ <div class="flex items-center gap-2">
255
+ {regenLabel}
256
 
257
+ <span
258
+ class="inline-flex items-center gap-0.5 rounded-sm border border-white/20 bg-white/10 px-0.5 text-xs text-white/70"
259
+ >
260
+ {cmdOrCtrl}<span class="">G</span>
261
+ </span>
262
+ </div>
263
+ </Tooltip>
264
 
265
+ <Tooltip>
266
+ {#snippet trigger(tooltip)}
267
+ <button
268
+ tabindex="0"
269
+ onclick={onDelete}
270
+ type="button"
271
+ class="grid size-7 place-items-center border border-gray-200 bg-white text-xs font-medium text-gray-900 hover:bg-gray-100
272
  hover:text-blue-700
273
  focus:z-10 focus:ring-4 focus:ring-gray-100
274
  focus:outline-hidden dark:border-gray-600 dark:bg-gray-800
275
  dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white dark:focus:ring-gray-700"
276
+ {...tooltip.trigger}
277
+ >
278
+ βœ•
279
+ </button>
280
+ {/snippet}
281
+ Delete
282
+ </Tooltip>
 
283
  </div>
284
  </div>
285
  </div>
src/lib/components/tooltip.svelte CHANGED
@@ -45,7 +45,6 @@
45
  [data-melt-tooltip-content] {
46
  border: 0;
47
 
48
- position: absolute;
49
  pointer-events: none;
50
  opacity: 0;
51
 
 
45
  [data-melt-tooltip-content] {
46
  border: 0;
47
 
 
48
  pointer-events: none;
49
  opacity: 0;
50