From 1c214e9a490a2229e2ac97c672f2c58a55116710 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Sun, 23 Nov 2025 22:16:22 +0100 Subject: [PATCH] refactor: Enum imports --- tools/server/webui/src/app.d.ts | 3 +-- .../ChatAttachmentsList.svelte | 2 +- .../ChatAttachmentsViewAll.svelte | 2 +- .../app/chat/ChatForm/ChatForm.svelte | 19 +++++++++-------- .../ChatFormActionFileAttachments.svelte | 2 +- .../ChatFormActions/ChatFormActions.svelte | 2 +- .../app/chat/ChatScreen/ChatScreen.svelte | 2 +- .../components/app/misc/BadgeModality.svelte | 2 +- .../src/lib/constants/supported-file-types.ts | 2 +- tools/server/webui/src/lib/enums/index.ts | 21 +++++++++++++++++++ tools/server/webui/src/lib/services/chat.ts | 2 +- .../webui/src/lib/stores/server.svelte.ts | 3 +-- tools/server/webui/src/lib/types/api.d.ts | 2 +- .../server/webui/src/lib/types/database.d.ts | 2 +- .../webui/src/lib/utils/attachment-type.ts | 3 +-- .../webui/src/lib/utils/audio-recording.ts | 2 +- .../src/lib/utils/convert-files-to-extra.ts | 3 +-- tools/server/webui/src/lib/utils/file-type.ts | 2 +- .../src/lib/utils/modality-file-validation.ts | 2 +- .../webui/src/lib/utils/pdf-processing.ts | 2 +- .../src/lib/utils/process-uploaded-files.ts | 2 +- .../server/webui/src/lib/utils/svg-to-png.ts | 2 +- .../server/webui/src/lib/utils/text-files.ts | 2 +- .../server/webui/src/lib/utils/webp-to-png.ts | 2 +- 24 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 tools/server/webui/src/lib/enums/index.ts diff --git a/tools/server/webui/src/app.d.ts b/tools/server/webui/src/app.d.ts index a362c24b0f..8a9cb174bc 100644 --- a/tools/server/webui/src/app.d.ts +++ b/tools/server/webui/src/app.d.ts @@ -23,8 +23,7 @@ import type { ApiRouterModelsUnloadResponse } from '$lib/types/api'; -import { ServerMode, ServerModelStatus } from '$lib/enums/server'; -import { ModelModality } from '$lib/enums/model'; +import { ServerMode, ServerModelStatus, ModelModality } from '$lib/enums'; import type { ChatMessageType, diff --git a/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList.svelte b/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList.svelte index 4407cc30ae..46fc2d4313 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList.svelte @@ -3,7 +3,7 @@ import { Button } from '$lib/components/ui/button'; import { ChevronLeft, ChevronRight } from '@lucide/svelte'; import { getFileTypeCategory } from '$lib/utils/file-type'; - import { FileTypeCategory } from '$lib/enums/files'; + import { FileTypeCategory } from '$lib/enums'; import { isImageFile } from '$lib/utils/attachment-type'; import { DialogChatAttachmentPreview, DialogChatAttachmentsViewAll } from '$lib/components/app'; import type { ChatAttachmentDisplayItem, ChatAttachmentPreviewItem } from '$lib/types/chat'; diff --git a/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsViewAll.svelte b/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsViewAll.svelte index f83197d4f0..427ff32a7b 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsViewAll.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsViewAll.svelte @@ -4,7 +4,7 @@ ChatAttachmentThumbnailFile, DialogChatAttachmentPreview } from '$lib/components/app'; - import { FileTypeCategory } from '$lib/enums/files'; + import { FileTypeCategory } from '$lib/enums'; import { getFileTypeCategory } from '$lib/utils/file-type'; import { isImageFile } from '$lib/utils/attachment-type'; import type { ChatAttachmentDisplayItem, ChatAttachmentPreviewItem } from '$lib/types/chat'; diff --git a/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatForm.svelte b/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatForm.svelte index 15080a5ee2..8df27c84a4 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatForm.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatForm.svelte @@ -9,15 +9,9 @@ } from '$lib/components/app'; import { INPUT_CLASSES } from '$lib/constants/input-classes'; import { config } from '$lib/stores/settings.svelte'; - import { FileTypeCategory, MimeTypeApplication } from '$lib/enums/files'; - import { - AudioRecorder, - convertToWav, - createAudioFile, - isAudioRecordingSupported - } from '$lib/utils/audio-recording'; - import { onMount } from 'svelte'; import { + FileTypeCategory, + MimeTypeApplication, FileExtensionAudio, FileExtensionImage, FileExtensionPdf, @@ -25,7 +19,14 @@ MimeTypeAudio, MimeTypeImage, MimeTypeText - } from '$lib/enums/files'; + } from '$lib/enums'; + import { + AudioRecorder, + convertToWav, + createAudioFile, + isAudioRecordingSupported + } from '$lib/utils/audio-recording'; + import { onMount } from 'svelte'; import { isIMEComposing } from '$lib/utils/is-ime-composing'; interface Props { diff --git a/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionFileAttachments.svelte b/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionFileAttachments.svelte index 71cb88e80d..f0f9143798 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionFileAttachments.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionFileAttachments.svelte @@ -4,7 +4,7 @@ import * as DropdownMenu from '$lib/components/ui/dropdown-menu'; import * as Tooltip from '$lib/components/ui/tooltip'; import { TOOLTIP_DELAY_DURATION } from '$lib/constants/tooltip-config'; - import { FileTypeCategory } from '$lib/enums/files'; + import { FileTypeCategory } from '$lib/enums'; import { supportsAudio, supportsVision } from '$lib/stores/server.svelte'; interface Props { diff --git a/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte b/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte index 94973f49be..7275728395 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte @@ -7,7 +7,7 @@ ChatFormActionSubmit, SelectorModel } from '$lib/components/app'; - import { FileTypeCategory } from '$lib/enums/files'; + import { FileTypeCategory } from '$lib/enums'; import { getFileTypeCategory } from '$lib/utils/file-type'; import { supportsAudio } from '$lib/stores/server.svelte'; import { config } from '$lib/stores/settings.svelte'; diff --git a/tools/server/webui/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte b/tools/server/webui/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte index 91d4309019..e5dbb7ae74 100644 --- a/tools/server/webui/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte +++ b/tools/server/webui/src/lib/components/app/chat/ChatScreen/ChatScreen.svelte @@ -43,7 +43,7 @@ import { fade, fly, slide } from 'svelte/transition'; import { Trash2 } from '@lucide/svelte'; import ChatScreenDragOverlay from './ChatScreenDragOverlay.svelte'; - import { ModelModality } from '$lib/enums/model'; + import { ModelModality } from '$lib/enums'; let { showCenteredEmpty = false } = $props(); diff --git a/tools/server/webui/src/lib/components/app/misc/BadgeModality.svelte b/tools/server/webui/src/lib/components/app/misc/BadgeModality.svelte index b9413cb853..3610197fdd 100644 --- a/tools/server/webui/src/lib/components/app/misc/BadgeModality.svelte +++ b/tools/server/webui/src/lib/components/app/misc/BadgeModality.svelte @@ -1,6 +1,6 @@