refactor: call chatWidthClasses once and reuse it everywhere
This commit is contained in:
parent
165234e722
commit
4561f25021
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
let allConversationMessages = $state<DatabaseMessage[]>([]);
|
||||
const currentConfig = config();
|
||||
let widthClasses = $derived(chatWidthClasses());
|
||||
|
||||
setChatActionsContext({
|
||||
copy: async (message: DatabaseMessage) => {
|
||||
|
|
@ -144,8 +145,8 @@
|
|||
<div class="flex h-full flex-col space-y-10 pt-24 {className}" style="height: auto; ">
|
||||
{#each displayMessages as { message, isLastAssistantMessage, siblingInfo } (message.id)}
|
||||
<ChatMessage
|
||||
class="mx-auto w-full {chatWidthClasses().class}"
|
||||
style={chatWidthClasses().style}
|
||||
class="mx-auto w-full {widthClasses.class}"
|
||||
style={widthClasses.style}
|
||||
{message}
|
||||
{isLastAssistantMessage}
|
||||
{siblingInfo}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@
|
|||
let activeErrorDialog = $derived(errorDialog());
|
||||
let isServerLoading = $derived(serverLoading());
|
||||
let hasPropsError = $derived(!!serverError());
|
||||
let widthClasses = $derived(chatWidthClasses());
|
||||
|
||||
let isCurrentConversationLoading = $derived(isLoading() || isChatStreaming());
|
||||
|
||||
|
|
@ -377,8 +378,8 @@
|
|||
|
||||
{#if hasPropsError}
|
||||
<div
|
||||
class="pointer-events-auto mx-auto mb-4 {chatWidthClasses().class} px-1"
|
||||
style={chatWidthClasses().style}
|
||||
class="pointer-events-auto mx-auto mb-4 {widthClasses.class} px-1"
|
||||
style={widthClasses.style}
|
||||
in:fly={{ y: 10, duration: 250 }}
|
||||
>
|
||||
<Alert.Root variant="destructive">
|
||||
|
|
@ -428,7 +429,7 @@
|
|||
ondrop={handleDrop}
|
||||
role="main"
|
||||
>
|
||||
<div class="w-full {chatWidthClasses().class} px-4" style={chatWidthClasses().style}>
|
||||
<div class="w-full {widthClasses.class} px-4" style={widthClasses.style}>
|
||||
<div class="mb-10 text-center" in:fade={{ duration: 300 }}>
|
||||
<h1 class="mb-2 text-2xl font-semibold tracking-tight md:text-3xl">llama.cpp</h1>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@
|
|||
import { chatWidthClasses } from '$lib/stores/chat.svelte';
|
||||
|
||||
const processingState = useProcessingState();
|
||||
|
||||
|
||||
let widthClasses = $derived(chatWidthClasses());
|
||||
let isCurrentConversationLoading = $derived(isLoading());
|
||||
let isStreaming = $derived(isChatStreaming());
|
||||
let hasProcessingData = $derived(processingState.processingState !== null);
|
||||
|
|
@ -63,8 +64,8 @@
|
|||
|
||||
<div class="chat-processing-info-container pointer-events-none" class:visible={showProcessingInfo}>
|
||||
<div
|
||||
class="chat-processing-info-content {chatWidthClasses().class}"
|
||||
style={chatWidthClasses().style}
|
||||
class="chat-processing-info-content {widthClasses.class}"
|
||||
style={widthClasses.style}
|
||||
>
|
||||
{#each processingDetails as detail (detail)}
|
||||
<span class="chat-processing-info-detail pointer-events-auto backdrop-blur-sm">{detail}</span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue