Skip to content

Commit c2a3acb

Browse files
committed
chore: hide token usage if it's zero
1 parent a914af7 commit c2a3acb

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

frontend/src/lib/components/message/ResponseEdit.svelte

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@
44
import { _ } from 'svelte-i18n';
55
66
let { content = '', token = 0, cost = 0.0 } = $props();
7+
let showUsage = $derived(token > 0);
78
</script>
89

910
<div class="flex justify-end space-x-1 duration-150 group-hover:visible md:invisible">
1011
<div class="group/usage relative flex space-x-1">
11-
<CircleDollarSign
12-
class="h-10 w-10 rounded-lg p-2 duration-150 group-hover/usage:bg-primary group-hover/usage:text-text-hover"
13-
/>
12+
{#if showUsage}
13+
<CircleDollarSign
14+
class="h-10 w-10 rounded-lg p-2 duration-150 group-hover/usage:bg-primary group-hover/usage:text-text-hover"
15+
/>
1416

15-
<div
16-
class="absolute top-0 right-13 flex h-10 w-sm items-center justify-end duration-150 group-hover/usage:visible md:invisible"
17-
>
18-
<div class="rounded-md bg-secondary p-2 select-none">
19-
{token} token/${cost.toFixed(4)}
17+
<div
18+
class="absolute top-0 right-13 flex h-10 w-sm items-center justify-end duration-150 group-hover/usage:visible md:invisible"
19+
>
20+
<div class="rounded-md bg-secondary p-2 select-none">
21+
{token} token/${cost.toFixed(4)}
22+
</div>
2023
</div>
21-
</div>
24+
{/if}
2225
</div>
2326
<button onclick={() => copy(content)} aria-label="copy response">
2427
<ClipboardCopy

0 commit comments

Comments
 (0)