Skip to content

Commit 702bf1d

Browse files
committed
chore: Code formatting
1 parent c6223b3 commit 702bf1d

File tree

6 files changed

+37
-29
lines changed

6 files changed

+37
-29
lines changed

tools/server/webui/src/lib/components/app/ConversationTitleUpdateDialog.svelte

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,17 @@
2525
<div class="space-y-4 pt-2 pb-6">
2626
<div class="space-y-2">
2727
<p class="text-sm font-medium text-muted-foreground">Current title:</p>
28-
<p class="text-sm bg-muted/50 p-3 rounded-md font-medium">{currentTitle}</p>
28+
<p class="rounded-md bg-muted/50 p-3 text-sm font-medium">{currentTitle}</p>
2929
</div>
3030
<div class="space-y-2">
3131
<p class="text-sm font-medium text-muted-foreground">New title would be:</p>
32-
<p class="text-sm bg-muted/50 p-3 rounded-md font-medium">{newTitle}</p>
32+
<p class="rounded-md bg-muted/50 p-3 text-sm font-medium">{newTitle}</p>
3333
</div>
3434
</div>
3535

3636
<AlertDialog.Footer>
37-
<Button variant="outline" onclick={onCancel}>
38-
Keep Current Title
39-
</Button>
40-
<Button onclick={onConfirm}>
41-
Update Title
42-
</Button>
37+
<Button variant="outline" onclick={onCancel}>Keep Current Title</Button>
38+
<Button onclick={onConfirm}>Update Title</Button>
4339
</AlertDialog.Footer>
4440
</AlertDialog.Content>
4541
</AlertDialog.Root>

tools/server/webui/src/lib/components/app/KeyboardShortcutInfo.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{#if key === 'shift'}
2020
<ArrowBigUp class="h-1 w-1 {variant === 'destructive' ? 'text-destructive' : ''} -mr-1" />
2121
{:else if key === 'cmd'}
22-
<span class="{variant === 'destructive' ? 'text-destructive' : ''}">⌘</span>
22+
<span class={variant === 'destructive' ? 'text-destructive' : ''}>⌘</span>
2323
{:else}
2424
{key.toUpperCase()}
2525
{/if}

tools/server/webui/src/lib/services/slots.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,19 +220,19 @@ export class SlotsService {
220220
// n_decoded represents ALL tokens generated (thinking + regular content)
221221
const totalTokensGenerated = activeSlot.next_token.n_decoded;
222222
const maxOutputTokens = activeSlot.params.max_tokens || activeSlot.params.n_predict;
223-
223+
224224
// For context calculation: only count tokens that will be sent back to API
225225
// We need to estimate how many of the generated tokens are actual message content
226226
// vs thinking content. For now, we'll assume thinking is ~60% of total output
227227
// This is a rough estimate - in reality we'd need to track this separately
228228
const estimatedThinkingRatio = 0.6;
229229
const estimatedMessageTokens = Math.floor(totalTokensGenerated * (1 - estimatedThinkingRatio));
230-
230+
231231
// Context used = estimated prompt + only the message content tokens
232232
const maxGenerationTokens = Math.min(maxOutputTokens, Math.floor(activeSlot.n_ctx * 0.4));
233233
const estimatedPromptTokens = activeSlot.n_ctx - maxGenerationTokens;
234234
const contextUsed = Math.min(activeSlot.n_ctx, estimatedPromptTokens + estimatedMessageTokens);
235-
235+
236236
// Output tokens: total generated tokens (thinking + regular)
237237
const outputTokensUsed = totalTokensGenerated;
238238
const outputTokensMax = maxOutputTokens;

tools/server/webui/src/lib/stores/chat.svelte.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,16 @@ class ChatStore {
625625

626626
const allMessages = await DatabaseStore.getConversationMessages(this.activeConversation.id);
627627
const rootMessage = allMessages.find((m) => m.type === 'root' && m.parent === null);
628-
const isFirstUserMessage = rootMessage && messageToUpdate.parent === rootMessage.id && messageToUpdate.role === 'user';
628+
const isFirstUserMessage =
629+
rootMessage && messageToUpdate.parent === rootMessage.id && messageToUpdate.role === 'user';
629630

630631
this.updateMessageAtIndex(messageIndex, { content: newContent });
631632
await DatabaseStore.updateMessage(messageId, { content: newContent });
632633

633634
// If this is the first user message, update the conversation title with confirmation if needed
634635
if (isFirstUserMessage && newContent.trim()) {
635636
await this.updateConversationTitleWithConfirmation(
636-
this.activeConversation.id,
637+
this.activeConversation.id,
637638
newContent.trim(),
638639
this.titleUpdateConfirmationCallback
639640
);
@@ -739,7 +740,6 @@ class ChatStore {
739740
}
740741
}
741742

742-
743743
/**
744744
* Updates the name of a conversation
745745
* @param convId - The conversation ID to update
@@ -781,7 +781,7 @@ class ChatStore {
781781
* @returns Promise<boolean> - True if title was updated, false if cancelled
782782
*/
783783
async updateConversationTitleWithConfirmation(
784-
convId: string,
784+
convId: string,
785785
newTitle: string,
786786
onConfirmationNeeded?: (currentTitle: string, newTitle: string) => Promise<boolean>
787787
): Promise<boolean> {
@@ -986,18 +986,20 @@ class ChatStore {
986986
const newFirstUserMessage = this.activeMessages.find(
987987
(m) => m.role === 'user' && m.parent === rootMessage.id
988988
);
989-
989+
990990
// Only show dialog if:
991991
// 1. We have a new first user message
992992
// 2. It's different from the previous one (different ID or content)
993993
// 3. The new message has content
994-
if (newFirstUserMessage &&
994+
if (
995+
newFirstUserMessage &&
995996
newFirstUserMessage.content.trim() &&
996-
(!currentFirstUserMessage ||
997-
newFirstUserMessage.id !== currentFirstUserMessage.id ||
998-
newFirstUserMessage.content.trim() !== currentFirstUserMessage.content.trim())) {
997+
(!currentFirstUserMessage ||
998+
newFirstUserMessage.id !== currentFirstUserMessage.id ||
999+
newFirstUserMessage.content.trim() !== currentFirstUserMessage.content.trim())
1000+
) {
9991001
await this.updateConversationTitleWithConfirmation(
1000-
this.activeConversation.id,
1002+
this.activeConversation.id,
10011003
newFirstUserMessage.content.trim(),
10021004
this.titleUpdateConfirmationCallback
10031005
);
@@ -1029,7 +1031,8 @@ class ChatStore {
10291031
// First user message is one that has the root message as its parent
10301032
const allMessages = await DatabaseStore.getConversationMessages(this.activeConversation.id);
10311033
const rootMessage = allMessages.find((m) => m.type === 'root' && m.parent === null);
1032-
const isFirstUserMessage = rootMessage && messageToEdit.parent === rootMessage.id && messageToEdit.role === 'user';
1034+
const isFirstUserMessage =
1035+
rootMessage && messageToEdit.parent === rootMessage.id && messageToEdit.role === 'user';
10331036

10341037
let parentId = messageToEdit.parent;
10351038

@@ -1064,7 +1067,7 @@ class ChatStore {
10641067
// If this is the first user message, update the conversation title with confirmation if needed
10651068
if (isFirstUserMessage && newContent.trim()) {
10661069
await this.updateConversationTitleWithConfirmation(
1067-
this.activeConversation.id,
1070+
this.activeConversation.id,
10681071
newContent.trim(),
10691072
this.titleUpdateConfirmationCallback
10701073
);
@@ -1218,7 +1221,8 @@ export const regenerateMessageWithBranching =
12181221
export const deleteMessage = chatStore.deleteMessage.bind(chatStore);
12191222
export const getDeletionInfo = chatStore.getDeletionInfo.bind(chatStore);
12201223
export const updateConversationName = chatStore.updateConversationName.bind(chatStore);
1221-
export const setTitleUpdateConfirmationCallback = chatStore.setTitleUpdateConfirmationCallback.bind(chatStore);
1224+
export const setTitleUpdateConfirmationCallback =
1225+
chatStore.setTitleUpdateConfirmationCallback.bind(chatStore);
12221226

12231227
export function stopGeneration() {
12241228
chatStore.stopGeneration();

tools/server/webui/src/lib/types/api.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export interface ApiProcessingState {
217217
contextUsed: number;
218218
contextTotal: number;
219219
outputTokensUsed: number; // Total output tokens (thinking + regular content)
220-
outputTokensMax: number; // Max output tokens allowed
220+
outputTokensMax: number; // Max output tokens allowed
221221
temperature: number;
222222
topP: number;
223223
speculative: boolean;

tools/server/webui/src/routes/+layout.svelte

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
<script lang="ts">
22
import '../app.css';
33
import { page } from '$app/state';
4-
import { ChatSidebar, MaximumContextAlertDialog, ConversationTitleUpdateDialog } from '$lib/components/app';
5-
import { activeMessages, isLoading, setTitleUpdateConfirmationCallback } from '$lib/stores/chat.svelte';
4+
import {
5+
ChatSidebar,
6+
MaximumContextAlertDialog,
7+
ConversationTitleUpdateDialog
8+
} from '$lib/components/app';
9+
import {
10+
activeMessages,
11+
isLoading,
12+
setTitleUpdateConfirmationCallback
13+
} from '$lib/stores/chat.svelte';
614
import * as Sidebar from '$lib/components/ui/sidebar/index.js';
715
import { serverStore } from '$lib/stores/server.svelte';
816
import { ModeWatcher } from 'mode-watcher';
@@ -106,7 +114,7 @@
106114

107115
<MaximumContextAlertDialog />
108116

109-
<ConversationTitleUpdateDialog
117+
<ConversationTitleUpdateDialog
110118
bind:open={titleUpdateDialogOpen}
111119
currentTitle={titleUpdateCurrentTitle}
112120
newTitle={titleUpdateNewTitle}

0 commit comments

Comments
 (0)