Add optional setting for showing "Model used:" information (#16337)

* feat: Add a setting to include model name used to generate the message

* feat: UI improvements

* feat: Save model info along with the database message entry creation

* chore: Build webui static output
This commit is contained in:
Aleksander Grygier
2025-10-01 12:08:16 +02:00
committed by GitHub
parent 132d673554
commit 4f1575921c
7 changed files with 48 additions and 8 deletions

View File

@@ -3,12 +3,14 @@
import { useProcessingState } from '$lib/hooks/use-processing-state.svelte';
import { isLoading } from '$lib/stores/chat.svelte';
import { fade } from 'svelte/transition';
import { Check, X } from '@lucide/svelte';
import { Check, Copy, Package, X } from '@lucide/svelte';
import { Button } from '$lib/components/ui/button';
import { Checkbox } from '$lib/components/ui/checkbox';
import { INPUT_CLASSES } from '$lib/constants/input-classes';
import ChatMessageActions from './ChatMessageActions.svelte';
import Label from '$lib/components/ui/label/label.svelte';
import { config } from '$lib/stores/settings.svelte';
import { copyToClipboard } from '$lib/utils/copy';
interface Props {
class?: string;
@@ -136,6 +138,23 @@
</div>
{/if}
{#if config().showModelInfo && message.model}
<span class="mt-6 mb-4 inline-flex items-center gap-1 text-xs text-muted-foreground">
<Package class="h-3.5 w-3.5" />
<span>Model used:</span>
<button
class="inline-flex cursor-pointer items-center gap-1 rounded-sm bg-muted-foreground/15 px-1.5 py-0.75"
onclick={() => copyToClipboard(message.model)}
>
{message.model}
<Copy class="ml-1 h-3 w-3 " />
</button>
</span>
{/if}
{#if message.timestamp && !isEditing}
<ChatMessageActions
role="assistant"

View File

@@ -75,6 +75,11 @@
key: 'pdfAsImage',
label: 'Parse PDF as image',
type: 'checkbox'
},
{
key: 'showModelInfo',
label: 'Show model information',
type: 'checkbox'
}
]
},

View File

@@ -34,7 +34,7 @@
{size}
{disabled}
{onclick}
class="h-6 w-6 p-0 {className}"
class="h-6 w-6 p-0 {className} flex"
aria-label={ariaLabel || tooltip}
>
{@const IconComponent = icon}