Skip to content

Commit 5ff1575

Browse files
committed
chore: Lint
1 parent 2fc3a8e commit 5ff1575

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed

tools/server/webui/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
import { processFilesToChatUploaded } from '$lib/utils/process-uploaded-files';
44
import { serverStore } from '$lib/stores/server.svelte';
55
import { isFileTypeSupported } from '$lib/constants/supported-file-types';
6-
import { filterFilesByModalities, generateModalityErrorMessage } from '$lib/utils/modality-file-validation';
6+
import {
7+
filterFilesByModalities,
8+
generateModalityErrorMessage
9+
} from '$lib/utils/modality-file-validation';
710
import { supportsVision, supportsAudio } from '$lib/stores/server.svelte';
811
import { ChatForm, ChatScreenHeader, ChatMessages, ServerInfo } from '$lib/components/app';
912
import {
@@ -28,7 +31,7 @@
2831
let uploadedFiles = $state<ChatUploadedFile[]>([]);
2932
let isDragOver = $state(false);
3033
let dragCounter = $state(0);
31-
34+
3235
// Alert Dialog state for file upload errors
3336
let showFileErrorDialog = $state(false);
3437
let fileErrorData = $state<{
@@ -106,14 +109,13 @@
106109
107110
// Check context limit using real-time slots data
108111
const contextCheck = await contextService.checkContextLimit();
109-
112+
110113
if (contextCheck && contextCheck.wouldExceed) {
111114
const errorMessage = contextService.getContextErrorMessage(contextCheck);
112115
113116
setMaxContextError({
114117
message: errorMessage,
115118
estimatedTokens: contextCheck.currentUsage,
116-
maxAllowed: contextCheck.availableTokens,
117119
maxContext: contextCheck.maxContext
118120
});
119121
@@ -122,7 +124,7 @@
122124
123125
await sendMessage(message, extras);
124126
scrollChatToBottom();
125-
127+
126128
return true;
127129
}
128130
@@ -140,7 +142,8 @@
140142
}
141143
142144
// Then filter by model modalities
143-
const { supportedFiles, unsupportedFiles, modalityReasons } = filterFilesByModalities(generallySupported);
145+
const { supportedFiles, unsupportedFiles, modalityReasons } =
146+
filterFilesByModalities(generallySupported);
144147
145148
// Combine all unsupported files
146149
const allUnsupportedFiles = [...generallyUnsupported, ...unsupportedFiles];
@@ -150,7 +153,7 @@
150153
const supportedTypes: string[] = ['text files', 'PDFs'];
151154
if (supportsVision()) supportedTypes.push('images');
152155
if (supportsAudio()) supportedTypes.push('audio files');
153-
156+
154157
// Structure error data for better presentation
155158
fileErrorData = {
156159
generallyUnsupported,
@@ -184,7 +187,7 @@
184187
if (navigating) {
185188
scrollChatToBottom('instant');
186189
}
187-
})
190+
});
188191
189192
$effect(() => {
190193
if (isLoading() && autoScrollEnabled) {
@@ -273,55 +276,64 @@
273276
<AlertDialog.Content class="max-w-md">
274277
<AlertDialog.Header>
275278
<AlertDialog.Title>File Upload Error</AlertDialog.Title>
276-
<AlertDialog.Description class="text-sm text-muted-foreground">
279+
<AlertDialog.Description class="text-muted-foreground text-sm">
277280
Some files cannot be uploaded with the current model.
278281
</AlertDialog.Description>
279282
</AlertDialog.Header>
280-
283+
281284
<div class="space-y-4">
282285
<!-- Generally unsupported files -->
283286
{#if fileErrorData.generallyUnsupported.length > 0}
284287
<div class="space-y-2">
285-
<h4 class="text-sm font-medium text-destructive">Unsupported File Types</h4>
288+
<h4 class="text-destructive text-sm font-medium">Unsupported File Types</h4>
286289
<div class="space-y-1">
287290
{#each fileErrorData.generallyUnsupported as file}
288-
<div class="rounded-md bg-destructive/10 px-3 py-2">
289-
<p class="text-sm font-mono text-destructive break-all">{file.name}</p>
290-
<p class="text-xs text-muted-foreground mt-1">File type not supported</p>
291+
<div class="bg-destructive/10 rounded-md px-3 py-2">
292+
<p class="text-destructive break-all font-mono text-sm">
293+
{file.name}
294+
</p>
295+
<p class="text-muted-foreground mt-1 text-xs">
296+
File type not supported
297+
</p>
291298
</div>
292299
{/each}
293300
</div>
294301
</div>
295302
{/if}
296-
303+
297304
<!-- Modality-restricted files -->
298305
{#if fileErrorData.modalityUnsupported.length > 0}
299306
<div class="space-y-2">
300-
<h4 class="text-sm font-medium text-destructive">Model Compatibility Issues</h4>
307+
<h4 class="text-destructive text-sm font-medium">
308+
Model Compatibility Issues
309+
</h4>
301310
<div class="space-y-1">
302311
{#each fileErrorData.modalityUnsupported as file}
303-
<div class="rounded-md bg-destructive/10 px-3 py-2">
304-
<p class="text-sm font-mono text-destructive break-all">{file.name}</p>
305-
<p class="text-xs text-muted-foreground mt-1">
306-
{fileErrorData.modalityReasons[file.name] || 'Not supported by current model'}
312+
<div class="bg-destructive/10 rounded-md px-3 py-2">
313+
<p class="text-destructive break-all font-mono text-sm">
314+
{file.name}
315+
</p>
316+
<p class="text-muted-foreground mt-1 text-xs">
317+
{fileErrorData.modalityReasons[file.name] ||
318+
'Not supported by current model'}
307319
</p>
308320
</div>
309321
{/each}
310322
</div>
311323
</div>
312324
{/if}
313-
325+
314326
<!-- Supported file types -->
315-
<div class="rounded-md bg-muted/50 p-3">
316-
<h4 class="text-sm font-medium mb-2">This model supports:</h4>
317-
<p class="text-sm text-muted-foreground">
327+
<div class="bg-muted/50 rounded-md p-3">
328+
<h4 class="mb-2 text-sm font-medium">This model supports:</h4>
329+
<p class="text-muted-foreground text-sm">
318330
{fileErrorData.supportedTypes.join(', ')}
319331
</p>
320332
</div>
321333
</div>
322-
334+
323335
<AlertDialog.Footer>
324-
<AlertDialog.Action onclick={() => showFileErrorDialog = false}>
336+
<AlertDialog.Action onclick={() => (showFileErrorDialog = false)}>
325337
Got it
326338
</AlertDialog.Action>
327339
</AlertDialog.Footer>

0 commit comments

Comments
 (0)