59bb7fbc12
This is once again a huge commit, but its mostly performance improvements along with some bug fixes and refactoring. It also includes changes to the theming systems. I'm still not 100% happy with the theming system, but its better than before. Model fetching has been dramatically improved! Nearly all the important computation and pre-processing has been moved to the server. This has also somehow fixed the way model details are loaded, which was causing many models to be missing their details despite models.dev having them. The markdown renderer has once again been changed, but I'm mostly certain that this is the last time major changes will be made to it. The renderer is not spamming components, bloating memory usage, and its not using a bug prone custom written chunking system. There's also a lot more that I haven't mentioned and honestly forgot. I need to get better commit hygiene tbh.
57 lines
2.1 KiB
Vue
57 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
import Error from './Error.vue';
|
|
import Reasoning from './Reasoning.vue';
|
|
import Text from './Text.vue';
|
|
import Tool from './Tool/index.vue';
|
|
import type { MessageEntity } from '~/composables/useChat';
|
|
|
|
defineProps<{
|
|
message: MessageEntity
|
|
}>();
|
|
</script>
|
|
|
|
<template>
|
|
<!-- <pre class="max-w-full overflow-x-auto">{{ JSON.stringify(message, null, 2) }}</pre> -->
|
|
<div class="flex flex-col w-full gap-2">
|
|
<div v-for="part in message.parts" :key="part.id">
|
|
<Reasoning v-if="part.type === 'reasoning'" :part="part" />
|
|
<Text v-else-if="part.type === 'text'" :part="part" />
|
|
<Tool v-else-if="part.type === 'tool-call'" :toolCall="part.toolCall!" />
|
|
<div v-else>
|
|
Unhandled part type: {{ part.type }} {{ part }}
|
|
</div>
|
|
</div>
|
|
|
|
<span class="flex items-center gap-1"
|
|
v-if="message.generation?.status === 'pending' && (message.parts || []).length === 0">
|
|
<Icon name="svg-spinners:pulse-2" class="text-4" />
|
|
<span class="text-sm text-[var(--text-secondary)]">
|
|
Preparing generating...
|
|
</span>
|
|
</span>
|
|
|
|
<div v-else-if="message.generation?.status === 'failed'">
|
|
<Error :error="message.generation.error" />
|
|
</div>
|
|
|
|
<div class="flex flex-row justify-between text-[var(--text-tertiary)] text-xs"
|
|
v-if="message.generation && message.generation.status !== 'pending'">
|
|
<span class="flex items-center gap-1">
|
|
<ModelIcon :size="12" :model-id="message.generation.modelId" />
|
|
{{ message.generation.modelId }}
|
|
</span>
|
|
|
|
<div class="flex gap-2">
|
|
<span class="flex gap-1 items-center" v-if="message.generation.tokens?.output">
|
|
<Icon name="tabler:coins" />
|
|
{{ message.generation?.tokens?.output }}
|
|
</span>
|
|
|
|
<span v-if="message.generation.tokens?.tps">
|
|
{{ message.generation.tokens.tps.toFixed(1) }} tps
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|