refactor: Enum imports
This commit is contained in:
parent
48dbef1729
commit
1c214e9a49
|
|
@ -23,8 +23,7 @@ import type {
|
||||||
ApiRouterModelsUnloadResponse
|
ApiRouterModelsUnloadResponse
|
||||||
} from '$lib/types/api';
|
} from '$lib/types/api';
|
||||||
|
|
||||||
import { ServerMode, ServerModelStatus } from '$lib/enums/server';
|
import { ServerMode, ServerModelStatus, ModelModality } from '$lib/enums';
|
||||||
import { ModelModality } from '$lib/enums/model';
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ChatMessageType,
|
ChatMessageType,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
import { Button } from '$lib/components/ui/button';
|
import { Button } from '$lib/components/ui/button';
|
||||||
import { ChevronLeft, ChevronRight } from '@lucide/svelte';
|
import { ChevronLeft, ChevronRight } from '@lucide/svelte';
|
||||||
import { getFileTypeCategory } from '$lib/utils/file-type';
|
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 { isImageFile } from '$lib/utils/attachment-type';
|
||||||
import { DialogChatAttachmentPreview, DialogChatAttachmentsViewAll } from '$lib/components/app';
|
import { DialogChatAttachmentPreview, DialogChatAttachmentsViewAll } from '$lib/components/app';
|
||||||
import type { ChatAttachmentDisplayItem, ChatAttachmentPreviewItem } from '$lib/types/chat';
|
import type { ChatAttachmentDisplayItem, ChatAttachmentPreviewItem } from '$lib/types/chat';
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
ChatAttachmentThumbnailFile,
|
ChatAttachmentThumbnailFile,
|
||||||
DialogChatAttachmentPreview
|
DialogChatAttachmentPreview
|
||||||
} from '$lib/components/app';
|
} from '$lib/components/app';
|
||||||
import { FileTypeCategory } from '$lib/enums/files';
|
import { FileTypeCategory } from '$lib/enums';
|
||||||
import { getFileTypeCategory } from '$lib/utils/file-type';
|
import { getFileTypeCategory } from '$lib/utils/file-type';
|
||||||
import { isImageFile } from '$lib/utils/attachment-type';
|
import { isImageFile } from '$lib/utils/attachment-type';
|
||||||
import type { ChatAttachmentDisplayItem, ChatAttachmentPreviewItem } from '$lib/types/chat';
|
import type { ChatAttachmentDisplayItem, ChatAttachmentPreviewItem } from '$lib/types/chat';
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,9 @@
|
||||||
} from '$lib/components/app';
|
} from '$lib/components/app';
|
||||||
import { INPUT_CLASSES } from '$lib/constants/input-classes';
|
import { INPUT_CLASSES } from '$lib/constants/input-classes';
|
||||||
import { config } from '$lib/stores/settings.svelte';
|
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 {
|
import {
|
||||||
|
FileTypeCategory,
|
||||||
|
MimeTypeApplication,
|
||||||
FileExtensionAudio,
|
FileExtensionAudio,
|
||||||
FileExtensionImage,
|
FileExtensionImage,
|
||||||
FileExtensionPdf,
|
FileExtensionPdf,
|
||||||
|
|
@ -25,7 +19,14 @@
|
||||||
MimeTypeAudio,
|
MimeTypeAudio,
|
||||||
MimeTypeImage,
|
MimeTypeImage,
|
||||||
MimeTypeText
|
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';
|
import { isIMEComposing } from '$lib/utils/is-ime-composing';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
|
||||||
import * as Tooltip from '$lib/components/ui/tooltip';
|
import * as Tooltip from '$lib/components/ui/tooltip';
|
||||||
import { TOOLTIP_DELAY_DURATION } from '$lib/constants/tooltip-config';
|
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';
|
import { supportsAudio, supportsVision } from '$lib/stores/server.svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
ChatFormActionSubmit,
|
ChatFormActionSubmit,
|
||||||
SelectorModel
|
SelectorModel
|
||||||
} from '$lib/components/app';
|
} from '$lib/components/app';
|
||||||
import { FileTypeCategory } from '$lib/enums/files';
|
import { FileTypeCategory } from '$lib/enums';
|
||||||
import { getFileTypeCategory } from '$lib/utils/file-type';
|
import { getFileTypeCategory } from '$lib/utils/file-type';
|
||||||
import { supportsAudio } from '$lib/stores/server.svelte';
|
import { supportsAudio } from '$lib/stores/server.svelte';
|
||||||
import { config } from '$lib/stores/settings.svelte';
|
import { config } from '$lib/stores/settings.svelte';
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
import { fade, fly, slide } from 'svelte/transition';
|
import { fade, fly, slide } from 'svelte/transition';
|
||||||
import { Trash2 } from '@lucide/svelte';
|
import { Trash2 } from '@lucide/svelte';
|
||||||
import ChatScreenDragOverlay from './ChatScreenDragOverlay.svelte';
|
import ChatScreenDragOverlay from './ChatScreenDragOverlay.svelte';
|
||||||
import { ModelModality } from '$lib/enums/model';
|
import { ModelModality } from '$lib/enums';
|
||||||
|
|
||||||
let { showCenteredEmpty = false } = $props();
|
let { showCenteredEmpty = false } = $props();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Eye, Mic } from '@lucide/svelte';
|
import { Eye, Mic } from '@lucide/svelte';
|
||||||
import { ModelModality } from '$lib/enums/model';
|
import { ModelModality } from '$lib/enums';
|
||||||
import { cn } from '$lib/components/ui/utils';
|
import { cn } from '$lib/components/ui/utils';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ import {
|
||||||
MimeTypeImage,
|
MimeTypeImage,
|
||||||
MimeTypeApplication,
|
MimeTypeApplication,
|
||||||
MimeTypeText
|
MimeTypeText
|
||||||
} from '$lib/enums/files';
|
} from '$lib/enums';
|
||||||
|
|
||||||
// File type configuration using enums
|
// File type configuration using enums
|
||||||
export const AUDIO_FILE_TYPES = {
|
export const AUDIO_FILE_TYPES = {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
export { AttachmentType } from './attachment';
|
||||||
|
|
||||||
|
export {
|
||||||
|
FileTypeCategory,
|
||||||
|
FileTypeImage,
|
||||||
|
FileTypeAudio,
|
||||||
|
FileTypePdf,
|
||||||
|
FileTypeText,
|
||||||
|
FileExtensionImage,
|
||||||
|
FileExtensionAudio,
|
||||||
|
FileExtensionPdf,
|
||||||
|
FileExtensionText,
|
||||||
|
MimeTypeApplication,
|
||||||
|
MimeTypeAudio,
|
||||||
|
MimeTypeImage,
|
||||||
|
MimeTypeText
|
||||||
|
} from './files';
|
||||||
|
|
||||||
|
export { ModelModality } from './model';
|
||||||
|
|
||||||
|
export { ServerMode, ServerModelStatus } from './server';
|
||||||
|
|
@ -10,7 +10,7 @@ import type {
|
||||||
ApiChatMessageData,
|
ApiChatMessageData,
|
||||||
ApiModelListResponse
|
ApiModelListResponse
|
||||||
} from '$lib/types/api';
|
} from '$lib/types/api';
|
||||||
import { AttachmentType } from '$lib/enums/attachment';
|
import { AttachmentType } from '$lib/enums';
|
||||||
import type {
|
import type {
|
||||||
DatabaseMessage,
|
DatabaseMessage,
|
||||||
DatabaseMessageExtra,
|
DatabaseMessageExtra,
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ import { browser } from '$app/environment';
|
||||||
import { SERVER_PROPS_LOCALSTORAGE_KEY } from '$lib/constants/localstorage-keys';
|
import { SERVER_PROPS_LOCALSTORAGE_KEY } from '$lib/constants/localstorage-keys';
|
||||||
import { ChatService } from '$lib/services/chat';
|
import { ChatService } from '$lib/services/chat';
|
||||||
import { config } from '$lib/stores/settings.svelte';
|
import { config } from '$lib/stores/settings.svelte';
|
||||||
import { ServerMode } from '$lib/enums/server';
|
import { ServerMode, ModelModality } from '$lib/enums';
|
||||||
import { ModelModality } from '$lib/enums/model';
|
|
||||||
import { updateConfig } from '$lib/stores/settings.svelte';
|
import { updateConfig } from '$lib/stores/settings.svelte';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ServerModelStatus } from '$lib/enums/model';
|
import type { ServerModelStatus } from '$lib/enums';
|
||||||
import type { ChatMessagePromptProgress } from './chat';
|
import type { ChatMessagePromptProgress } from './chat';
|
||||||
|
|
||||||
export interface ApiChatMessageContentPart {
|
export interface ApiChatMessageContentPart {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import type { ChatMessageTimings, ChatRole, ChatMessageType } from '$lib/types/chat';
|
import type { ChatMessageTimings, ChatRole, ChatMessageType } from '$lib/types/chat';
|
||||||
import { AttachmentType } from '$lib/enums/attachment';
|
import { AttachmentType } from '$lib/enums';
|
||||||
|
|
||||||
export interface DatabaseConversation {
|
export interface DatabaseConversation {
|
||||||
currNode: string | null;
|
currNode: string | null;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { AttachmentType } from '$lib/enums/attachment';
|
import { AttachmentType, FileTypeCategory } from '$lib/enums';
|
||||||
import { FileTypeCategory } from '$lib/enums/files';
|
|
||||||
import { getFileTypeCategory } from '$lib/utils/file-type';
|
import { getFileTypeCategory } from '$lib/utils/file-type';
|
||||||
import { getFileTypeLabel } from '$lib/utils/file-preview';
|
import { getFileTypeLabel } from '$lib/utils/file-preview';
|
||||||
import type { DatabaseMessageExtra } from '$lib/types/database';
|
import type { DatabaseMessageExtra } from '$lib/types/database';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MimeTypeAudio } from '$lib/enums/files';
|
import { MimeTypeAudio } from '$lib/enums';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AudioRecorder - Browser-based audio recording with MediaRecorder API
|
* AudioRecorder - Browser-based audio recording with MediaRecorder API
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
import { convertPDFToImage, convertPDFToText } from './pdf-processing';
|
import { convertPDFToImage, convertPDFToText } from './pdf-processing';
|
||||||
import { isSvgMimeType, svgBase64UrlToPngDataURL } from './svg-to-png';
|
import { isSvgMimeType, svgBase64UrlToPngDataURL } from './svg-to-png';
|
||||||
import { isWebpMimeType, webpBase64UrlToPngDataURL } from './webp-to-png';
|
import { isWebpMimeType, webpBase64UrlToPngDataURL } from './webp-to-png';
|
||||||
import { FileTypeCategory } from '$lib/enums/files';
|
import { FileTypeCategory, AttachmentType } from '$lib/enums';
|
||||||
import { AttachmentType } from '$lib/enums/attachment';
|
|
||||||
import { config, settingsStore } from '$lib/stores/settings.svelte';
|
import { config, settingsStore } from '$lib/stores/settings.svelte';
|
||||||
import { supportsVision } from '$lib/stores/server.svelte';
|
import { supportsVision } from '$lib/stores/server.svelte';
|
||||||
import { getFileTypeCategory } from '$lib/utils/file-type';
|
import { getFileTypeCategory } from '$lib/utils/file-type';
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import {
|
||||||
PDF_FILE_TYPES,
|
PDF_FILE_TYPES,
|
||||||
TEXT_FILE_TYPES
|
TEXT_FILE_TYPES
|
||||||
} from '$lib/constants/supported-file-types';
|
} from '$lib/constants/supported-file-types';
|
||||||
import { FileTypeCategory } from '$lib/enums/files';
|
import { FileTypeCategory } from '$lib/enums';
|
||||||
|
|
||||||
export function getFileTypeCategory(mimeType: string): FileTypeCategory | null {
|
export function getFileTypeCategory(mimeType: string): FileTypeCategory | null {
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import {
|
||||||
MimeTypeApplication,
|
MimeTypeApplication,
|
||||||
MimeTypeText,
|
MimeTypeText,
|
||||||
FileTypeCategory
|
FileTypeCategory
|
||||||
} from '$lib/enums/files';
|
} from '$lib/enums';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a file type is supported by the current model's modalities
|
* Check if a file type is supported by the current model's modalities
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { MimeTypeApplication, MimeTypeImage } from '$lib/enums/files';
|
import { MimeTypeApplication, MimeTypeImage } from '$lib/enums';
|
||||||
import * as pdfjs from 'pdfjs-dist';
|
import * as pdfjs from 'pdfjs-dist';
|
||||||
|
|
||||||
type TextContent = {
|
type TextContent = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { isSvgMimeType, svgBase64UrlToPngDataURL } from './svg-to-png';
|
import { isSvgMimeType, svgBase64UrlToPngDataURL } from './svg-to-png';
|
||||||
import { isTextFileByName } from './text-files';
|
import { isTextFileByName } from './text-files';
|
||||||
import { isWebpMimeType, webpBase64UrlToPngDataURL } from './webp-to-png';
|
import { isWebpMimeType, webpBase64UrlToPngDataURL } from './webp-to-png';
|
||||||
import { FileTypeCategory } from '$lib/enums/files';
|
import { FileTypeCategory } from '$lib/enums';
|
||||||
import { getFileTypeCategory } from '$lib/utils/file-type';
|
import { getFileTypeCategory } from '$lib/utils/file-type';
|
||||||
import { supportsVision } from '$lib/stores/server.svelte';
|
import { supportsVision } from '$lib/stores/server.svelte';
|
||||||
import { settingsStore } from '$lib/stores/settings.svelte';
|
import { settingsStore } from '$lib/stores/settings.svelte';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { MimeTypeImage } from '$lib/enums/files';
|
import { MimeTypeImage } from '$lib/enums';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an SVG base64 data URL to a PNG data URL
|
* Convert an SVG base64 data URL to a PNG data URL
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import {
|
||||||
DEFAULT_BINARY_DETECTION_OPTIONS,
|
DEFAULT_BINARY_DETECTION_OPTIONS,
|
||||||
type BinaryDetectionOptions
|
type BinaryDetectionOptions
|
||||||
} from '$lib/constants/binary-detection';
|
} from '$lib/constants/binary-detection';
|
||||||
import { FileExtensionText } from '$lib/enums/files';
|
import { FileExtensionText } from '$lib/enums';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a filename indicates a text file based on its extension
|
* Check if a filename indicates a text file based on its extension
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { FileExtensionImage, MimeTypeImage } from '$lib/enums/files';
|
import { FileExtensionImage, MimeTypeImage } from '$lib/enums';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a WebP base64 data URL to a PNG data URL
|
* Convert a WebP base64 data URL to a PNG data URL
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue