Show message actions by default (#16289)

This commit is contained in:
Aleksander Grygier
2025-09-27 19:56:40 +02:00
committed by GitHub
parent c0bfc57af4
commit 4807e8f96a
6 changed files with 7 additions and 18 deletions

Binary file not shown.

View File

@@ -4,7 +4,6 @@
import ChatMessageBranchingControls from './ChatMessageBranchingControls.svelte'; import ChatMessageBranchingControls from './ChatMessageBranchingControls.svelte';
interface Props { interface Props {
message: DatabaseMessage;
role: 'user' | 'assistant'; role: 'user' | 'assistant';
justify: 'start' | 'end'; justify: 'start' | 'end';
actionsPosition: 'left' | 'right'; actionsPosition: 'left' | 'right';
@@ -29,7 +28,6 @@
actionsPosition, actionsPosition,
deletionInfo, deletionInfo,
justify, justify,
message,
onCopy, onCopy,
onEdit, onEdit,
onConfirmDelete, onConfirmDelete,
@@ -49,26 +47,17 @@
</script> </script>
<div class="relative {justify === 'start' ? 'mt-2' : ''} flex h-6 items-center justify-{justify}"> <div class="relative {justify === 'start' ? 'mt-2' : ''} flex h-6 items-center justify-{justify}">
<div
class="hidden items-center text-xs text-muted-foreground transition-opacity md:flex md:group-hover:opacity-0"
>
{new Date(message.timestamp).toLocaleTimeString(undefined, {
hour: '2-digit',
minute: '2-digit'
})}
</div>
<div <div
class="absolute top-0 {actionsPosition === 'left' class="absolute top-0 {actionsPosition === 'left'
? 'left-0' ? 'left-0'
: 'right-0'} flex items-center gap-2 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100" : 'right-0'} flex items-center gap-2 opacity-100 transition-opacity"
> >
{#if siblingInfo && siblingInfo.totalSiblings > 1} {#if siblingInfo && siblingInfo.totalSiblings > 1}
<ChatMessageBranchingControls {siblingInfo} {onNavigateToSibling} /> <ChatMessageBranchingControls {siblingInfo} {onNavigateToSibling} />
{/if} {/if}
<div <div
class="pointer-events-auto inset-0 flex items-center gap-1 opacity-100 transition-all duration-150 md:pointer-events-none md:opacity-0 md:group-hover:pointer-events-auto md:group-hover:opacity-100" class="pointer-events-auto inset-0 flex items-center gap-1 opacity-100 transition-all duration-150"
> >
<ActionButton icon={Copy} tooltip="Copy" onclick={onCopy} /> <ActionButton icon={Copy} tooltip="Copy" onclick={onCopy} />

View File

@@ -138,7 +138,6 @@
{#if message.timestamp && !isEditing} {#if message.timestamp && !isEditing}
<ChatMessageActions <ChatMessageActions
{message}
role="assistant" role="assistant"
justify="start" justify="start"
actionsPosition="left" actionsPosition="left"

View File

@@ -135,7 +135,6 @@
actionsPosition="right" actionsPosition="right"
{deletionInfo} {deletionInfo}
justify="end" justify="end"
{message}
{onConfirmDelete} {onConfirmDelete}
{onCopy} {onCopy}
{onDelete} {onDelete}

View File

@@ -456,7 +456,6 @@
{localConfig} {localConfig}
onConfigChange={handleConfigChange} onConfigChange={handleConfigChange}
onThemeChange={handleThemeChange} onThemeChange={handleThemeChange}
isMobile={false}
/> />
</div> </div>
</div> </div>

View File

@@ -5,6 +5,7 @@
import * as Select from '$lib/components/ui/select'; import * as Select from '$lib/components/ui/select';
import { Textarea } from '$lib/components/ui/textarea'; import { Textarea } from '$lib/components/ui/textarea';
import { SETTING_CONFIG_DEFAULT, SETTING_CONFIG_INFO } from '$lib/constants/settings-config'; import { SETTING_CONFIG_DEFAULT, SETTING_CONFIG_INFO } from '$lib/constants/settings-config';
import { IsMobile } from '$lib/hooks/is-mobile.svelte';
import { supportsVision } from '$lib/stores/server.svelte'; import { supportsVision } from '$lib/stores/server.svelte';
import type { Component } from 'svelte'; import type { Component } from 'svelte';
@@ -13,10 +14,11 @@
localConfig: SettingsConfigType; localConfig: SettingsConfigType;
onConfigChange: (key: string, value: string | boolean) => void; onConfigChange: (key: string, value: string | boolean) => void;
onThemeChange?: (theme: string) => void; onThemeChange?: (theme: string) => void;
isMobile?: boolean;
} }
let { fields, localConfig, onConfigChange, onThemeChange, isMobile = false }: Props = $props(); let { fields, localConfig, onConfigChange, onThemeChange }: Props = $props();
let isMobile = $state(new IsMobile());
</script> </script>
{#each fields as field (field.key)} {#each fields as field (field.key)}
@@ -109,6 +111,7 @@
{/if} {/if}
{:else if field.type === 'checkbox'} {:else if field.type === 'checkbox'}
{@const isDisabled = field.key === 'pdfAsImage' && !supportsVision()} {@const isDisabled = field.key === 'pdfAsImage' && !supportsVision()}
<div class="flex items-start space-x-3"> <div class="flex items-start space-x-3">
<Checkbox <Checkbox
id={field.key} id={field.key}