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;
</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"
key: 'pdfAsImage',
label: 'Parse PDF as image',
type: 'checkbox'
+ },
+ {
+ key: 'showModelInfo',
+ label: 'Show model information',
+ type: 'checkbox'
}
]
},
{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}
askForTitleConfirmation: false,
pasteLongTextToFileLen: 2500,
pdfAsImage: false,
+ showModelInfo: false,
// make sure these default values are in sync with `common.h`
samplers: 'top_k;typ_p;top_p;min_p;temperature',
temperature: 0.8,
askForTitleConfirmation:
'Ask for confirmation before automatically changing conversation title when editing the first message.',
pdfAsImage: 'Parse PDF as image instead of text (requires vision-capable model).',
+ showModelInfo: 'Display the model name used to generate each message below the message content.',
pyInterpreterEnabled:
'Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.'
};
await DatabaseStore.updateCurrentNode(this.activeConversation!.id, assistantMessage.id);
this.activeConversation!.currNode = assistantMessage.id;
-
await this.refreshActiveMessages();
if (onComplete) {
private async createAssistantMessage(parentId?: string): Promise<DatabaseMessage | null> {
if (!this.activeConversation) return null;
+ // Capture the current model name when creating the assistant message
+ const currentModelName = serverStore.modelName;
+
return await DatabaseStore.createMessageBranch(
{
convId: this.activeConversation.id,
content: '',
timestamp: Date.now(),
thinking: '',
- children: []
+ children: [],
+ model: currentModelName || undefined
},
parentId || null
);
role: messageToEdit.role,
content: newContent,
thinking: messageToEdit.thinking || '',
- children: []
+ children: [],
+ model: messageToEdit.model // Preserve original model info when branching
},
messageToEdit.parent!
);
content: newContent,
thinking: messageToEdit.thinking || '',
children: [],
- extra: messageToEdit.extra ? JSON.parse(JSON.stringify(messageToEdit.extra)) : undefined
+ extra: messageToEdit.extra ? JSON.parse(JSON.stringify(messageToEdit.extra)) : undefined,
+ model: messageToEdit.model // Preserve original model info when branching
},
parentId
);
this.isLoading = true;
this.currentResponse = '';
+ // Capture the current model name when creating the assistant message
+ const currentModelName = serverStore.modelName;
+
const newAssistantMessage = await DatabaseStore.createMessageBranch(
{
convId: this.activeConversation.id,
role: 'assistant',
content: '',
thinking: '',
- children: []
+ children: [],
+ model: currentModelName || undefined
},
parentMessage.id
);
false
) as DatabaseMessage[];
+ // Capture the current model name when creating the assistant message
+ const currentModelName = serverStore.modelName;
+
// Create new assistant message branch
const assistantMessage = await DatabaseStore.createMessageBranch(
{
role: 'assistant',
content: '',
thinking: '',
- children: []
+ children: [],
+ model: currentModelName || undefined
},
userMessageId
);
children: string[];
extra?: DatabaseMessageExtra[];
timings?: ChatMessageTimings;
+ model?: string;
}