feat: add dropdown for token details

This commit is contained in:
Zoe
2026-03-02 10:45:14 -06:00
parent d40e5a7404
commit 579f4730c8
6 changed files with 180 additions and 5 deletions
+17 -3
View File
@@ -5,9 +5,22 @@ import Text from './Text.vue';
import Tool from './Tool/index.vue';
import type { MessageEntity } from '~/composables/useChat';
defineProps<{
const props = defineProps<{
message: MessageEntity
}>();
const triggerRef = ref<HTMLElement | null>(null);
const { open, close, isOpen } = useTokenDropdown();
const toggleTokenDropdown = () => {
if (isOpen.value) {
close();
return;
}
open(props.message.generation!, triggerRef.value!);
};
</script>
<template>
@@ -40,7 +53,8 @@ defineProps<{
{{ message.generation.modelId }}
</div>
<div class="flex gap-2">
<button ref="triggerRef" @click="toggleTokenDropdown"
class="flex gap-2 hover:bg-[var(--color-hover)] px-1 rounded transition-colors duration-150 ease-[cubic-bezier(0.5,_1,_0.89,_1)]">
<span class="flex gap-1 items-center" v-if="message.generation.tokens?.output">
<span class="i-tabler-coins"></span>
{{ message.generation?.tokens?.output }}
@@ -49,7 +63,7 @@ defineProps<{
<span v-if="message.generation.tokens?.tps">
{{ message.generation.tokens.tps.toFixed(1) }} tps
</span>
</div>
</button>
</div>
</div>
</template>