Spaces:
Sleeping
Sleeping
Commit
·
5846db1
1
Parent(s):
121b8a9
Update src/lib/components/chat/ChatWindow.svelte (#1)
Browse files- Update src/lib/components/chat/ChatWindow.svelte (185f6c185b569c90b2e652466e16f8d09182a423)
Co-authored-by: Florent Daudens <[email protected]>
src/lib/components/chat/ChatWindow.svelte
CHANGED
@@ -353,6 +353,17 @@
|
|
353 |
<div
|
354 |
class="dark:via-gray-80 pointer-events-none absolute inset-x-0 bottom-0 z-0 mx-auto flex w-full max-w-3xl flex-col items-center justify-center bg-gradient-to-t from-white via-white/80 to-white/0 px-3.5 py-4 dark:border-gray-800 dark:from-gray-900 dark:to-gray-900/0 max-md:border-t max-md:bg-white max-md:dark:bg-gray-900 sm:px-5 md:py-8 xl:max-w-4xl [&>*]:pointer-events-auto"
|
355 |
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
{#if sources?.length && !loading}
|
357 |
<div
|
358 |
in:fly|local={sources.length === 1 ? { y: -20, easing: cubicInOut } : undefined}
|
|
|
353 |
<div
|
354 |
class="dark:via-gray-80 pointer-events-none absolute inset-x-0 bottom-0 z-0 mx-auto flex w-full max-w-3xl flex-col items-center justify-center bg-gradient-to-t from-white via-white/80 to-white/0 px-3.5 py-4 dark:border-gray-800 dark:from-gray-900 dark:to-gray-900/0 max-md:border-t max-md:bg-white max-md:dark:bg-gray-900 sm:px-5 md:py-8 xl:max-w-4xl [&>*]:pointer-events-auto"
|
355 |
>
|
356 |
+
{#if messages.length > 0}
|
357 |
+
{@const totalEnergy = messages.reduce((total, msg) => total + (msg.metadata?.energy_wh || 0), 0)}
|
358 |
+
{#if totalEnergy > 0}
|
359 |
+
<div class="mb-4 flex items-center justify-center">
|
360 |
+
<div class="text-xs text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800 px-3 py-1 rounded">
|
361 |
+
Total Energy: {totalEnergy.toFixed(6)} Wh (about {((totalEnergy / 19) * 100).toFixed(2)}% of charging a phone)
|
362 |
+
</div>
|
363 |
+
</div>
|
364 |
+
{/if}
|
365 |
+
{/if}
|
366 |
+
|
367 |
{#if sources?.length && !loading}
|
368 |
<div
|
369 |
in:fly|local={sources.length === 1 ? { y: -20, easing: cubicInOut } : undefined}
|