ui: Linting & Formatting scripts (#26819)
This commit is contained in:
@@ -34,8 +34,8 @@ export const DEFAULT_AGENTIC_CONFIG: AgenticConfig = {
|
||||
} as const;
|
||||
|
||||
export const REASONING_TAGS = {
|
||||
START: '<think>',
|
||||
END: '</think>'
|
||||
END: '</think>',
|
||||
START: '<think>'
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -43,12 +43,12 @@ export const REASONING_TAGS = {
|
||||
* New messages use structured fields (reasoningContent, toolCalls, toolCallId).
|
||||
*/
|
||||
export const LEGACY_AGENTIC_TAGS = {
|
||||
TOOL_CALL_START: '<<<AGENTIC_TOOL_CALL_START>>>',
|
||||
TOOL_CALL_END: '<<<AGENTIC_TOOL_CALL_END>>>',
|
||||
TOOL_NAME_PREFIX: '<<<TOOL_NAME:',
|
||||
TOOL_ARGS_START: '<<<TOOL_ARGS_START>>>',
|
||||
TAG_SUFFIX: '>>>',
|
||||
TOOL_ARGS_END: '<<<TOOL_ARGS_END>>>',
|
||||
TAG_SUFFIX: '>>>'
|
||||
TOOL_ARGS_START: '<<<TOOL_ARGS_START>>>',
|
||||
TOOL_CALL_END: '<<<AGENTIC_TOOL_CALL_END>>>',
|
||||
TOOL_CALL_START: '<<<AGENTIC_TOOL_CALL_START>>>',
|
||||
TOOL_NAME_PREFIX: '<<<TOOL_NAME:'
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -56,20 +56,20 @@ export const LEGACY_AGENTIC_TAGS = {
|
||||
* New messages use the dedicated reasoningContent field.
|
||||
*/
|
||||
export const LEGACY_REASONING_TAGS = {
|
||||
START: '<<<reasoning_content_start>>>',
|
||||
END: '<<<reasoning_content_end>>>'
|
||||
END: '<<<reasoning_content_end>>>',
|
||||
START: '<<<reasoning_content_start>>>'
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* @deprecated Legacy regex patterns - only used for migration of old stored messages.
|
||||
*/
|
||||
export const LEGACY_AGENTIC_REGEX = {
|
||||
COMPLETED_TOOL_CALL:
|
||||
/<<<AGENTIC_TOOL_CALL_START>>>\n<<<TOOL_NAME:(.+?)>>>\n<<<TOOL_ARGS_START>>>([\s\S]*?)<<<TOOL_ARGS_END>>>([\s\S]*?)<<<AGENTIC_TOOL_CALL_END>>>/g,
|
||||
REASONING_BLOCK: /<<<reasoning_content_start>>>[\s\S]*?<<<reasoning_content_end>>>/g,
|
||||
REASONING_EXTRACT: /<<<reasoning_content_start>>>([\s\S]*?)<<<reasoning_content_end>>>/,
|
||||
REASONING_OPEN: /<<<reasoning_content_start>>>[\s\S]*$/,
|
||||
AGENTIC_TOOL_CALL_BLOCK: /\n*<<<AGENTIC_TOOL_CALL_START>>>[\s\S]*?<<<AGENTIC_TOOL_CALL_END>>>/g,
|
||||
AGENTIC_TOOL_CALL_OPEN: /\n*<<<AGENTIC_TOOL_CALL_START>>>[\s\S]*$/,
|
||||
HAS_LEGACY_MARKERS: /<<<(?:AGENTIC_TOOL_CALL_START|reasoning_content_start)>>>/
|
||||
COMPLETED_TOOL_CALL:
|
||||
/<<<AGENTIC_TOOL_CALL_START>>>\n<<<TOOL_NAME:(.+?)>>>\n<<<TOOL_ARGS_START>>>([\s\S]*?)<<<TOOL_ARGS_END>>>([\s\S]*?)<<<AGENTIC_TOOL_CALL_END>>>/g,
|
||||
HAS_LEGACY_MARKERS: /<<<(?:AGENTIC_TOOL_CALL_START|reasoning_content_start)>>>/,
|
||||
REASONING_BLOCK: /<<<reasoning_content_start>>>[\s\S]*?<<<reasoning_content_end>>>/g,
|
||||
REASONING_EXTRACT: /<<<reasoning_content_start>>>([\s\S]*?)<<<reasoning_content_end>>>/,
|
||||
REASONING_OPEN: /<<<reasoning_content_start>>>[\s\S]*$/
|
||||
} as const;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
export const API_MODELS = {
|
||||
LIST: '/v1/models',
|
||||
LOAD: '/models/load',
|
||||
UNLOAD: '/models/unload',
|
||||
SSE: '/models/sse'
|
||||
SSE: '/models/sse',
|
||||
UNLOAD: '/models/unload'
|
||||
};
|
||||
|
||||
// chat completion routes, the control route drives realtime inference (e.g. end reasoning)
|
||||
@@ -17,8 +17,8 @@ export const API_SLOTS = {
|
||||
};
|
||||
|
||||
export const API_TOOLS = {
|
||||
LIST: '/tools',
|
||||
EXECUTE: '/tools'
|
||||
EXECUTE: '/tools',
|
||||
LIST: '/tools'
|
||||
};
|
||||
|
||||
// resumable stream routes, the conv::model identity travels as the conv_id query param
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Component } from 'svelte';
|
||||
import { MessageSquare, Zap, FolderOpen } from '@lucide/svelte';
|
||||
import { FolderOpen, MessageSquare, Zap } from '@lucide/svelte';
|
||||
import { FILE_TYPE_ICONS } from '$lib/constants/icons';
|
||||
import {
|
||||
AttachmentAction,
|
||||
@@ -7,6 +6,7 @@ import {
|
||||
AttachmentItemVisibleWhen,
|
||||
AttachmentMenuItemId
|
||||
} from '$lib/enums';
|
||||
import type { Component } from 'svelte';
|
||||
|
||||
export interface AttachmentMenuItem {
|
||||
/** Unique identifier for the item */
|
||||
@@ -35,47 +35,47 @@ export interface AttachmentMenuItem {
|
||||
*/
|
||||
export const ATTACHMENT_FILE_ITEMS: AttachmentMenuItem[] = [
|
||||
{
|
||||
id: AttachmentMenuItemId.IMAGES,
|
||||
label: 'Images',
|
||||
icon: FILE_TYPE_ICONS.image,
|
||||
action: AttachmentAction.FILE_UPLOAD,
|
||||
class: 'images-button',
|
||||
enabledWhen: AttachmentItemEnabledWhen.HAS_VISION_MODALITY,
|
||||
disabledTooltip: 'Image processing requires a vision model',
|
||||
action: AttachmentAction.FILE_UPLOAD
|
||||
enabledWhen: AttachmentItemEnabledWhen.HAS_VISION_MODALITY,
|
||||
icon: FILE_TYPE_ICONS.image,
|
||||
id: AttachmentMenuItemId.IMAGES,
|
||||
label: 'Images'
|
||||
},
|
||||
{
|
||||
id: AttachmentMenuItemId.AUDIO,
|
||||
label: 'Audio Files',
|
||||
icon: FILE_TYPE_ICONS.audio,
|
||||
action: AttachmentAction.FILE_UPLOAD,
|
||||
class: 'audio-button',
|
||||
enabledWhen: AttachmentItemEnabledWhen.HAS_AUDIO_MODALITY,
|
||||
disabledTooltip: 'Audio files processing requires an audio model',
|
||||
action: AttachmentAction.FILE_UPLOAD
|
||||
enabledWhen: AttachmentItemEnabledWhen.HAS_AUDIO_MODALITY,
|
||||
icon: FILE_TYPE_ICONS.audio,
|
||||
id: AttachmentMenuItemId.AUDIO,
|
||||
label: 'Audio Files'
|
||||
},
|
||||
{
|
||||
id: AttachmentMenuItemId.VIDEO,
|
||||
label: 'Video Files',
|
||||
icon: FILE_TYPE_ICONS.video,
|
||||
action: AttachmentAction.FILE_UPLOAD,
|
||||
class: 'video-button',
|
||||
enabledWhen: AttachmentItemEnabledWhen.HAS_VIDEO_MODALITY,
|
||||
disabledTooltip: 'Video files processing requires a video model',
|
||||
action: AttachmentAction.FILE_UPLOAD
|
||||
enabledWhen: AttachmentItemEnabledWhen.HAS_VIDEO_MODALITY,
|
||||
icon: FILE_TYPE_ICONS.video,
|
||||
id: AttachmentMenuItemId.VIDEO,
|
||||
label: 'Video Files'
|
||||
},
|
||||
{
|
||||
id: AttachmentMenuItemId.TEXT,
|
||||
label: 'Text Files',
|
||||
action: AttachmentAction.FILE_UPLOAD,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
icon: FILE_TYPE_ICONS.text,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
action: AttachmentAction.FILE_UPLOAD
|
||||
id: AttachmentMenuItemId.TEXT,
|
||||
label: 'Text Files'
|
||||
},
|
||||
{
|
||||
id: AttachmentMenuItemId.PDF,
|
||||
label: 'PDF Files',
|
||||
icon: FILE_TYPE_ICONS.pdf,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
action: AttachmentAction.FILE_UPLOAD,
|
||||
disabledTooltip: 'PDFs will be converted to text. Image-based PDFs may not work properly.',
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
hasEnabledTooltip: true,
|
||||
action: AttachmentAction.FILE_UPLOAD
|
||||
icon: FILE_TYPE_ICONS.pdf,
|
||||
id: AttachmentMenuItemId.PDF,
|
||||
label: 'PDF Files'
|
||||
}
|
||||
];
|
||||
|
||||
@@ -83,30 +83,30 @@ export const ATTACHMENT_EXTRA_ITEMS: AttachmentMenuItem[] = [];
|
||||
|
||||
export const ATTACHMENT_PROMPT_ITEMS: AttachmentMenuItem[] = [
|
||||
{
|
||||
id: AttachmentMenuItemId.SYSTEM_MESSAGE,
|
||||
label: 'System Message',
|
||||
icon: MessageSquare,
|
||||
action: AttachmentAction.SYSTEM_PROMPT_CLICK,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
hasEnabledTooltip: true,
|
||||
action: AttachmentAction.SYSTEM_PROMPT_CLICK
|
||||
icon: MessageSquare,
|
||||
id: AttachmentMenuItemId.SYSTEM_MESSAGE,
|
||||
label: 'System Message'
|
||||
},
|
||||
{
|
||||
action: AttachmentAction.MCP_PROMPT_CLICK,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
icon: Zap,
|
||||
id: AttachmentMenuItemId.MCP_PROMPT,
|
||||
label: 'MCP Prompt',
|
||||
icon: Zap,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
action: AttachmentAction.MCP_PROMPT_CLICK,
|
||||
visibleWhen: AttachmentItemVisibleWhen.HAS_MCP_PROMPTS_SUPPORT
|
||||
}
|
||||
];
|
||||
|
||||
export const ATTACHMENT_MCP_ITEMS: AttachmentMenuItem[] = [
|
||||
{
|
||||
action: AttachmentAction.MCP_RESOURCES_CLICK,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
icon: FolderOpen,
|
||||
id: AttachmentMenuItemId.MCP_RESOURCES,
|
||||
label: 'MCP Resources',
|
||||
icon: FolderOpen,
|
||||
enabledWhen: AttachmentItemEnabledWhen.ALWAYS,
|
||||
action: AttachmentAction.MCP_RESOURCES_CLICK,
|
||||
visibleWhen: AttachmentItemVisibleWhen.HAS_MCP_RESOURCES_SUPPORT
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { BinaryDetectionOptions } from '$lib/types';
|
||||
|
||||
export const DEFAULT_BINARY_DETECTION_OPTIONS: BinaryDetectionOptions = {
|
||||
maxAbsoluteNullBytes: 2,
|
||||
prefixLength: 1024 * 10, // Check the first 10KB of the string
|
||||
suspiciousCharThresholdRatio: 0.15, // Allow up to 15% suspicious chars
|
||||
maxAbsoluteNullBytes: 2
|
||||
suspiciousCharThresholdRatio: 0.15 // Allow up to 15% suspicious chars
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// (see ChatMessageToolCallBlockGetDatetime and
|
||||
// ChatMessageToolCallBlockSearchResults for prior art).
|
||||
|
||||
import type { Component } from 'svelte';
|
||||
import {
|
||||
Braces,
|
||||
Clock,
|
||||
@@ -20,6 +19,7 @@ import {
|
||||
Terminal
|
||||
} from '@lucide/svelte';
|
||||
import { BuiltInTool, ToolSource } from '$lib/enums';
|
||||
import type { Component } from 'svelte';
|
||||
|
||||
export interface BuiltinToolUiEntry {
|
||||
icon: Component;
|
||||
@@ -28,34 +28,35 @@ export interface BuiltinToolUiEntry {
|
||||
}
|
||||
|
||||
export const BUILTIN_TOOL_UI: Readonly<Record<BuiltInTool, BuiltinToolUiEntry>> = {
|
||||
[BuiltInTool.READ_FILE]: { icon: FileText, label: 'Read file', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.EDIT_FILE]: { icon: FilePen, label: 'Edit file', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.WRITE_FILE]: { icon: FilePlus, label: 'Write file', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.FILE_GLOB_SEARCH]: {
|
||||
icon: FileSearch,
|
||||
label: 'Search files',
|
||||
source: ToolSource.BUILTIN
|
||||
},
|
||||
[BuiltInTool.GREP_SEARCH]: {
|
||||
icon: SearchCode,
|
||||
label: 'Search in files',
|
||||
source: ToolSource.BUILTIN
|
||||
},
|
||||
[BuiltInTool.GET_DATETIME]: { icon: Clock, label: 'Current time', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.GET_INFO]: { icon: Info, label: 'Runtime info', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.EXEC_SHELL_COMMAND]: {
|
||||
icon: Terminal,
|
||||
label: 'Run command',
|
||||
source: ToolSource.BUILTIN
|
||||
},
|
||||
[BuiltInTool.FILE_GLOB_SEARCH]: {
|
||||
icon: FileSearch,
|
||||
label: 'Search files',
|
||||
source: ToolSource.BUILTIN
|
||||
},
|
||||
[BuiltInTool.GET_DATETIME]: { icon: Clock, label: 'Current time', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.GET_INFO]: { icon: Info, label: 'Runtime info', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.GREP_SEARCH]: {
|
||||
icon: SearchCode,
|
||||
label: 'Search in files',
|
||||
source: ToolSource.BUILTIN
|
||||
},
|
||||
[BuiltInTool.READ_FILE]: { icon: FileText, label: 'Read file', source: ToolSource.BUILTIN },
|
||||
[BuiltInTool.RUN_JAVASCRIPT]: {
|
||||
icon: Braces,
|
||||
label: 'Run JavaScript',
|
||||
source: ToolSource.FRONTEND
|
||||
}
|
||||
},
|
||||
[BuiltInTool.WRITE_FILE]: { icon: FilePlus, label: 'Write file', source: ToolSource.BUILTIN }
|
||||
} as const;
|
||||
|
||||
export function getBuiltinToolUi(toolName: string | undefined): BuiltinToolUiEntry | null {
|
||||
if (!toolName) return null;
|
||||
|
||||
return (BUILTIN_TOOL_UI as Record<string, BuiltinToolUiEntry>)[toolName] ?? null;
|
||||
}
|
||||
|
||||
@@ -22,23 +22,23 @@ interface ChatCommandsOptions {
|
||||
export function getChatCommands(options: ChatCommandsOptions): ChatFormCommand[] {
|
||||
return [
|
||||
{
|
||||
name: 'prompt',
|
||||
description: 'Insert an MCP prompt',
|
||||
action: ChatFormCommandAction.PROMPT,
|
||||
disabled: !options.hasPrompts()
|
||||
description: 'Insert an MCP prompt',
|
||||
disabled: !options.hasPrompts(),
|
||||
name: 'prompt'
|
||||
},
|
||||
{
|
||||
name: 'cwd',
|
||||
description: SET_WORKING_DIRECTORY_LABEL,
|
||||
keywords: ['current working directory'],
|
||||
action: ChatFormCommandAction.CWD,
|
||||
disabled: !options.hasCwdTools()
|
||||
description: SET_WORKING_DIRECTORY_LABEL,
|
||||
disabled: !options.hasCwdTools(),
|
||||
keywords: ['current working directory'],
|
||||
name: 'cwd'
|
||||
},
|
||||
{
|
||||
name: 'model',
|
||||
description: 'Select model',
|
||||
action: ChatFormCommandAction.MODEL,
|
||||
disabled: !options.showModelSelector
|
||||
description: 'Select model',
|
||||
disabled: !options.showModelSelector,
|
||||
name: 'model'
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
export const ERROR_MESSAGES = {
|
||||
HTTP: {
|
||||
ACCESS_DENIED: 'Access denied',
|
||||
GENERIC: 'Request failed',
|
||||
INTERNAL_ERROR: 'Server error - check server logs',
|
||||
NOT_FOUND: 'Not found',
|
||||
TEMPORARILY_UNAVAILABLE: 'Server temporarily unavailable'
|
||||
},
|
||||
NETWORK: {
|
||||
GENERIC: 'Failed to connect to server',
|
||||
NXDOMAIN: 'Server not found - check server address',
|
||||
REFUSED: 'Connection refused - server may be offline',
|
||||
TIMEOUT: 'Request timed out',
|
||||
UNREACHABLE: 'Server is not running or unreachable'
|
||||
},
|
||||
HTTP: {
|
||||
GENERIC: 'Request failed',
|
||||
ACCESS_DENIED: 'Access denied',
|
||||
INTERNAL_ERROR: 'Server error - check server logs',
|
||||
NOT_FOUND: 'Not found',
|
||||
TEMPORARILY_UNAVAILABLE: 'Server temporarily unavailable'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,35 +4,35 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
Eye as VisionIcon,
|
||||
File as FileIcon,
|
||||
FileText as FileTextIcon,
|
||||
Image as ImageIcon,
|
||||
Eye as VisionIcon,
|
||||
Mic as AudioIcon,
|
||||
Video as VideoIcon
|
||||
} from '@lucide/svelte';
|
||||
import { FileTypeCategory, ModelModality } from '$lib/enums';
|
||||
|
||||
export const FILE_TYPE_ICONS = {
|
||||
[FileTypeCategory.IMAGE]: ImageIcon,
|
||||
[FileTypeCategory.AUDIO]: AudioIcon,
|
||||
[FileTypeCategory.VIDEO]: VideoIcon,
|
||||
[FileTypeCategory.IMAGE]: ImageIcon,
|
||||
[FileTypeCategory.PDF]: FileIcon,
|
||||
[FileTypeCategory.TEXT]: FileTextIcon,
|
||||
[FileTypeCategory.PDF]: FileIcon
|
||||
[FileTypeCategory.VIDEO]: VideoIcon
|
||||
} as const;
|
||||
|
||||
export const DEFAULT_FILE_ICON = FileIcon;
|
||||
|
||||
export const MODALITY_ICONS = {
|
||||
[ModelModality.VISION]: VisionIcon,
|
||||
[ModelModality.AUDIO]: AudioIcon,
|
||||
[ModelModality.VIDEO]: VideoIcon
|
||||
[ModelModality.VIDEO]: VideoIcon,
|
||||
[ModelModality.VISION]: VisionIcon
|
||||
} as const;
|
||||
|
||||
export const MODALITY_LABELS = {
|
||||
[ModelModality.VISION]: 'Vision',
|
||||
[ModelModality.AUDIO]: 'Audio',
|
||||
[ModelModality.VIDEO]: 'Video'
|
||||
[ModelModality.VIDEO]: 'Video',
|
||||
[ModelModality.VISION]: 'Vision'
|
||||
} as const;
|
||||
|
||||
// Shared SVG icon strings for copy and preview buttons
|
||||
|
||||
@@ -47,9 +47,9 @@ export const BINARY_CONTENT_LABEL = 'Binary content';
|
||||
* Used for generating attachment filenames from MIME types.
|
||||
*/
|
||||
export const IMAGE_MIME_TO_EXTENSION: Record<string, string> = {
|
||||
[MimeTypeImage.GIF]: 'gif',
|
||||
[MimeTypeImage.JPEG]: 'jpg',
|
||||
[MimeTypeImage.JPG]: 'jpg',
|
||||
[MimeTypeImage.PNG]: 'png',
|
||||
[MimeTypeImage.GIF]: 'gif',
|
||||
[MimeTypeImage.WEBP]: 'webp'
|
||||
} as const;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Zap, Globe, Radio } from '@lucide/svelte';
|
||||
import { Globe, Radio, Zap } from '@lucide/svelte';
|
||||
import { MCPTransportType } from '$lib/enums';
|
||||
import { MimeTypeImage } from '$lib/enums/files.enums';
|
||||
import type { ClientCapabilities, Implementation } from '$lib/types';
|
||||
import type { Component } from 'svelte';
|
||||
import { MimeTypeImage } from '$lib/enums/files.enums';
|
||||
|
||||
export const DEFAULT_CLIENT_VERSION = '1.0.0';
|
||||
export const MCP_CLIENT_NAME = 'llama-ui-mcp';
|
||||
@@ -27,11 +27,11 @@ export const MCP_ALLOWED_ICON_MIME_TYPES = new Set([
|
||||
export const MCP_PROTOCOL_VERSION = '2025-06-18';
|
||||
|
||||
export const DEFAULT_MCP_CONFIG = {
|
||||
protocolVersion: MCP_PROTOCOL_VERSION,
|
||||
capabilities: { tools: { listChanged: true } } as ClientCapabilities,
|
||||
clientInfo: { name: MCP_CLIENT_NAME, version: DEFAULT_CLIENT_VERSION } as Implementation,
|
||||
requestTimeoutSeconds: 300, // 5 minutes for long-running tools
|
||||
connectionTimeoutMs: 10_000 // 10 seconds for connection establishment
|
||||
connectionTimeoutMs: 10_000, // 10 seconds for connection establishment
|
||||
protocolVersion: MCP_PROTOCOL_VERSION,
|
||||
requestTimeoutSeconds: 300 // 5 minutes for long-running tools
|
||||
} as const;
|
||||
|
||||
export const MCP_SERVER_ID_PREFIX = 'LlamaUI-MCP-Server';
|
||||
@@ -85,16 +85,16 @@ export const REDACTED_HEADERS = new Set([
|
||||
|
||||
/** Human-readable labels for MCP transport types */
|
||||
export const MCP_TRANSPORT_LABELS: Record<MCPTransportType, string> = {
|
||||
[MCPTransportType.WEBSOCKET]: 'WebSocket',
|
||||
[MCPTransportType.SSE]: 'SSE',
|
||||
[MCPTransportType.STREAMABLE_HTTP]: 'HTTP',
|
||||
[MCPTransportType.SSE]: 'SSE'
|
||||
[MCPTransportType.WEBSOCKET]: 'WebSocket'
|
||||
};
|
||||
|
||||
/** Icon components for MCP transport types */
|
||||
export const MCP_TRANSPORT_ICONS: Record<MCPTransportType, Component> = {
|
||||
[MCPTransportType.WEBSOCKET]: Zap,
|
||||
[MCPTransportType.SSE]: Radio,
|
||||
[MCPTransportType.STREAMABLE_HTTP]: Globe,
|
||||
[MCPTransportType.SSE]: Radio
|
||||
[MCPTransportType.WEBSOCKET]: Zap
|
||||
};
|
||||
|
||||
/** Standard SSE endpoint path indicators */
|
||||
|
||||
@@ -17,14 +17,14 @@ export const MENTION_BADGE_ICON_CLASSNAME = 'h-3 w-3 shrink-0';
|
||||
* valid for both.
|
||||
*/
|
||||
export const MENTION_BADGE_SVG_ATTRIBUTES: Readonly<Record<string, string>> = {
|
||||
xmlns: 'http://www.w3.org/2000/svg',
|
||||
viewBox: '0 0 24 24',
|
||||
'aria-hidden': 'true',
|
||||
fill: 'none',
|
||||
stroke: 'currentColor',
|
||||
'stroke-width': '2',
|
||||
'stroke-linecap': 'round',
|
||||
'stroke-linejoin': 'round',
|
||||
'aria-hidden': 'true'
|
||||
'stroke-width': '2',
|
||||
viewBox: '0 0 24 24',
|
||||
xmlns: 'http://www.w3.org/2000/svg'
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* Labels shown while a model loads, keyed by the stage reported on /models/sse.
|
||||
*/
|
||||
export const MODEL_LOAD_STAGE_LABELS: Record<ApiModelLoadStage, string> = {
|
||||
text_model: 'Loading weights',
|
||||
mmproj_model: 'Loading projector',
|
||||
spec_model: 'Loading draft',
|
||||
mmproj_model: 'Loading projector'
|
||||
text_model: 'Loading weights'
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,40 +6,40 @@
|
||||
import { APP_NAME } from './app';
|
||||
|
||||
export const MEDIA_QUERIES = {
|
||||
DISPLAY_MODE_STANDALONE: '(display-mode: standalone)',
|
||||
PREFERS_DARK: '(prefers-color-scheme: dark)',
|
||||
PREFERS_LIGHT: '(prefers-color-scheme: light)',
|
||||
DISPLAY_MODE_STANDALONE: '(display-mode: standalone)'
|
||||
PREFERS_LIGHT: '(prefers-color-scheme: light)'
|
||||
} as const;
|
||||
|
||||
export const THEME_COLORS = {
|
||||
LIGHT: '#ffffff',
|
||||
DARK: '#0d0d0d',
|
||||
ACCENT_BLUE: '#2563eb',
|
||||
ACCENT_BLUE_HOVER: '#1d4ed8',
|
||||
BACKGROUND_LIGHT: 'white',
|
||||
BACKGROUND_DARK: '#111111',
|
||||
BACKGROUND_LIGHT: 'white',
|
||||
DARK: '#0d0d0d',
|
||||
LIGHT: '#ffffff',
|
||||
TITLE_UPDATE_ALERT: {
|
||||
BORDER_LIGHT: 'zinc-200',
|
||||
BORDER_DARK: 'zinc-700',
|
||||
BG_LIGHT: 'white',
|
||||
BG_DARK: 'zinc-800',
|
||||
TEXT_LIGHT: 'zinc-500',
|
||||
TEXT_DARK: 'zinc-400'
|
||||
BG_LIGHT: 'white',
|
||||
BORDER_DARK: 'zinc-700',
|
||||
BORDER_LIGHT: 'zinc-200',
|
||||
TEXT_DARK: 'zinc-400',
|
||||
TEXT_LIGHT: 'zinc-500'
|
||||
}
|
||||
} as const;
|
||||
|
||||
export const FAVICON_PATHS = {
|
||||
ICO_LIGHT: 'favicon.ico',
|
||||
ICO_DARK: 'favicon-dark.ico',
|
||||
SVG_LIGHT: 'favicon.svg',
|
||||
SVG_DARK: 'favicon-dark.svg'
|
||||
ICO_LIGHT: 'favicon.ico',
|
||||
SVG_DARK: 'favicon-dark.svg',
|
||||
SVG_LIGHT: 'favicon.svg'
|
||||
} as const;
|
||||
|
||||
// Substituted for `currentColor` in src/lib/assets/logo.svg when generating
|
||||
// the light/dark static sources consumed by the PWA asset generator.
|
||||
export const FAVICON_COLORS = {
|
||||
LIGHT: '#111111',
|
||||
DARK: '#fafafa'
|
||||
DARK: '#fafafa',
|
||||
LIGHT: '#111111'
|
||||
} as const;
|
||||
|
||||
export const FAVICON_SELECTORS = {
|
||||
@@ -52,50 +52,50 @@ export const APPLE_ASSETS = {
|
||||
} as const;
|
||||
|
||||
export const PWA_MANIFEST = {
|
||||
background_color: THEME_COLORS.BACKGROUND_LIGHT,
|
||||
description: 'Local AI chat interface powered by llama.cpp',
|
||||
display: 'standalone' as const,
|
||||
icons: [
|
||||
{ sizes: '64x64', src: 'pwa-64x64.png', type: 'image/png' },
|
||||
{ sizes: '192x192', src: 'pwa-192x192.png', type: 'image/png' },
|
||||
{ purpose: 'any' as const, sizes: '512x512', src: 'pwa-512x512.png', type: 'image/png' },
|
||||
{
|
||||
purpose: 'maskable' as const,
|
||||
sizes: '512x512',
|
||||
src: 'maskable-icon-512x512.png',
|
||||
type: 'image/png'
|
||||
}
|
||||
],
|
||||
name: APP_NAME,
|
||||
short_name: APP_NAME,
|
||||
description: 'Local AI chat interface powered by llama.cpp',
|
||||
start_url: './',
|
||||
display: 'standalone' as const,
|
||||
background_color: THEME_COLORS.BACKGROUND_LIGHT,
|
||||
theme_color: THEME_COLORS.BACKGROUND_LIGHT,
|
||||
icons: [
|
||||
{ src: 'pwa-64x64.png', sizes: '64x64', type: 'image/png' },
|
||||
{ src: 'pwa-192x192.png', sizes: '192x192', type: 'image/png' },
|
||||
{ src: 'pwa-512x512.png', sizes: '512x512', type: 'image/png', purpose: 'any' as const },
|
||||
{
|
||||
src: 'maskable-icon-512x512.png',
|
||||
sizes: '512x512',
|
||||
type: 'image/png',
|
||||
purpose: 'maskable' as const
|
||||
}
|
||||
]
|
||||
theme_color: THEME_COLORS.BACKGROUND_LIGHT
|
||||
};
|
||||
|
||||
export const PWA_ICON_PATHS = {
|
||||
MASKABLE_512: '/maskable-icon-512x512.png',
|
||||
PWA_64: '/pwa-64x64.png',
|
||||
PWA_192: '/pwa-192x192.png',
|
||||
PWA_512: '/pwa-512x512.png',
|
||||
MASKABLE_512: '/maskable-icon-512x512.png'
|
||||
PWA_512: '/pwa-512x512.png'
|
||||
} as const;
|
||||
|
||||
/** Apple device dimensions (logical points) and DPR, from Apple HIG. */
|
||||
export const APPLE_DEVICES = {
|
||||
'640x1136': { dpr: 2, height: 568, width: 320 }, // iPhone 6/7/8 Plus
|
||||
'744x1133': { dpr: 2, height: 573, width: 376 }, // iPad mini 8.3"
|
||||
'750x1334': { dpr: 2, height: 667, width: 375 }, // iPhone 6/7/8, 14
|
||||
'1032x1376': { dpr: 2, height: 1376, width: 1032 }, // iPad Air 13"
|
||||
// iPhones (DPR 3)
|
||||
'1170x2532': { width: 390, height: 844, dpr: 3 }, // iPhone 13, 15
|
||||
'1179x2556': { width: 393, height: 852, dpr: 3 }, // iPhone 14, 15 Pro, 16
|
||||
'1206x2622': { width: 402, height: 874, dpr: 3 }, // iPhone 16 Plus, 16e
|
||||
'1284x2778': { width: 428, height: 926, dpr: 3 }, // iPhone 15 Plus
|
||||
'1290x2796': { width: 430, height: 932, dpr: 3 }, // iPhone 15 Pro Max, 16 Pro
|
||||
'1320x2868': { width: 440, height: 956, dpr: 3 }, // iPhone 16 Pro Max
|
||||
'750x1334': { width: 375, height: 667, dpr: 2 }, // iPhone 6/7/8, 14
|
||||
'640x1136': { width: 320, height: 568, dpr: 2 }, // iPhone 6/7/8 Plus
|
||||
'1170x2532': { dpr: 3, height: 844, width: 390 }, // iPhone 13, 15
|
||||
'1179x2556': { dpr: 3, height: 852, width: 393 }, // iPhone 14, 15 Pro, 16
|
||||
'1206x2622': { dpr: 3, height: 874, width: 402 }, // iPhone 16 Plus, 16e
|
||||
'1284x2778': { dpr: 3, height: 926, width: 428 }, // iPhone 15 Plus
|
||||
'1290x2796': { dpr: 3, height: 932, width: 430 }, // iPhone 15 Pro Max, 16 Pro
|
||||
'1320x2868': { dpr: 3, height: 956, width: 440 }, // iPhone 16 Pro Max
|
||||
'1640x2360': { dpr: 2, height: 1180, width: 820 }, // iPad Air 10.9"
|
||||
// iPads (DPR 2)
|
||||
'1668x2388': { width: 834, height: 1194, dpr: 2 }, // iPad Air 11", iPad 11"
|
||||
'2048x2732': { width: 1024, height: 1366, dpr: 2 }, // iPad Pro 12.9"
|
||||
'1640x2360': { width: 820, height: 1180, dpr: 2 }, // iPad Air 10.9"
|
||||
'1032x1376': { width: 1032, height: 1376, dpr: 2 }, // iPad Air 13"
|
||||
'744x1133': { width: 376, height: 573, dpr: 2 } // iPad mini 8.3"
|
||||
'1668x2388': { dpr: 2, height: 1194, width: 834 }, // iPad Air 11", iPad 11"
|
||||
'2048x2732': { dpr: 2, height: 1366, width: 1024 } // iPad Pro 12.9"
|
||||
} as const;
|
||||
|
||||
export type AppleDeviceKey = keyof typeof APPLE_DEVICES;
|
||||
@@ -183,7 +183,6 @@ export const PUBLIC_ENDPOINTS = [
|
||||
'/workbox-<hash>.js'
|
||||
] as const;
|
||||
export const BUILD_CONFIG = {
|
||||
OUTPUT_DIR: './dist',
|
||||
GUIDE_COMMENT: `
|
||||
<!--
|
||||
This is a static build of the frontend.
|
||||
@@ -191,12 +190,13 @@ export const BUILD_CONFIG = {
|
||||
Do not edit this file directly.
|
||||
To make changes, refer to the "Web UI" section in the README.
|
||||
-->
|
||||
`.trim()
|
||||
`.trim(),
|
||||
OUTPUT_DIR: './dist'
|
||||
} as const;
|
||||
|
||||
export const REGEX_PATTERNS = {
|
||||
SPLASH_FILE: /^apple-splash-(portrait|landscape)-(dark-)?(\d+)x(\d+)\.png$/,
|
||||
HEAD_CLOSE: /\t*<\/head>/
|
||||
HEAD_CLOSE: /\t*<\/head>/,
|
||||
SPLASH_FILE: /^apple-splash-(portrait|landscape)-(dark-)?(\d+)x(\d+)\.png$/
|
||||
} as const;
|
||||
|
||||
// Device names used by @vite-pwa/assets-generator for splash screen generation.
|
||||
@@ -235,22 +235,22 @@ export const PWA_GENERATOR_DEVICES = [
|
||||
// post-processed into the static favicon.svg so the in-app logo (which reads
|
||||
// src/lib/assets/logo.svg directly) is unaffected.
|
||||
export const PWA_ASSET_GENERATOR = {
|
||||
LINK_PRESET: '2023',
|
||||
FAVICON_PADDING: 0.04,
|
||||
SPLASH_PADDING: 0.75,
|
||||
FIT_MODE: 'contain',
|
||||
ADD_MEDIA_SCREEN: true,
|
||||
BASE_PATH: './',
|
||||
XHTML: false,
|
||||
DARK_PREFIX: 'dark-',
|
||||
FAVICON_PADDING: 0.04,
|
||||
FIT_MODE: 'contain',
|
||||
LINK_PRESET: '2023',
|
||||
PNG_COMPRESSION_LEVEL: 9,
|
||||
PNG_QUALITY: 60,
|
||||
DARK_PREFIX: 'dark-'
|
||||
SPLASH_PADDING: 0.75,
|
||||
XHTML: false
|
||||
} as const;
|
||||
|
||||
export const CACHE_SETTINGS = {
|
||||
IMMUTABLE_MAX_AGE_SECONDS: 31536000,
|
||||
API_CACHE_MAX_AGE_SECONDS: 60 * 60 * 24,
|
||||
API_CACHE_MAX_ENTRIES: 50,
|
||||
IMMUTABLE_MAX_AGE_SECONDS: 31536000,
|
||||
MAX_FILE_SIZE_BYTES: 10 * 1024 * 1024
|
||||
} as const;
|
||||
|
||||
@@ -271,35 +271,46 @@ export const SW_CONFIG = {
|
||||
|
||||
// Runtime caching configuration for Workbox
|
||||
export const RUNTIME_CACHING = {
|
||||
HANDLER: 'NetworkFirst',
|
||||
CACHE_NAME: 'api-cache'
|
||||
CACHE_NAME: 'api-cache',
|
||||
HANDLER: 'NetworkFirst'
|
||||
} as const;
|
||||
|
||||
// Workbox runtime caching patterns
|
||||
export const API_CACHING_PATTERNS = {
|
||||
V1_API: /^\/v1\/.*/,
|
||||
STATIC_API: /^\/(health|props|models|tools|slots|cors-proxy).*/
|
||||
STATIC_API: /^\/(health|props|models|tools|slots|cors-proxy).*/,
|
||||
V1_API: /^\/v1\/.*/
|
||||
} as const;
|
||||
|
||||
// SvelteKit PWA plugin options
|
||||
export const PWA_KIT_OPTIONS = {} as const;
|
||||
|
||||
export const APPLE_META_TAGS = {
|
||||
MOBILE_WEB_APP_CAPABLE: { name: 'apple-mobile-web-app-capable', content: 'yes' },
|
||||
STATUS_BAR_STYLE: { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' },
|
||||
MOBILE_WEB_APP_TITLE: { name: 'apple-mobile-web-app-title' }
|
||||
MOBILE_WEB_APP_CAPABLE: { content: 'yes', name: 'apple-mobile-web-app-capable' },
|
||||
MOBILE_WEB_APP_TITLE: { name: 'apple-mobile-web-app-title' },
|
||||
STATUS_BAR_STYLE: { content: 'black-translucent', name: 'apple-mobile-web-app-status-bar-style' }
|
||||
} as const;
|
||||
|
||||
// Splash screen HTML link tag prefix used by generateSplashScreenLinks
|
||||
export const SPLASH_LINK = {
|
||||
HTML: '<link rel="apple-touch-startup-image"',
|
||||
DARK_MEDIA_SUFFIX: ' and (prefers-color-scheme: dark)'
|
||||
DARK_MEDIA_SUFFIX: ' and (prefers-color-scheme: dark)',
|
||||
HTML: '<link rel="apple-touch-startup-image"'
|
||||
} as const;
|
||||
|
||||
// SvelteKit PWA plugin configuration — used by @vite.config.ts
|
||||
import type { SvelteKitPWAOptions } from '@vite-pwa/sveltekit';
|
||||
|
||||
export const SVELTEKIT_PWA_OPTIONS: SvelteKitPWAOptions = {
|
||||
devOptions: {
|
||||
enabled: true,
|
||||
suppressWarnings: true
|
||||
},
|
||||
|
||||
// SvelteKit-specific options
|
||||
kit: {
|
||||
// Include version file for proper cache invalidation
|
||||
includeVersionFile: true
|
||||
},
|
||||
|
||||
// Strategy: generateSW - the plugin generates a service worker automatically
|
||||
// using Workbox. For a custom SW, use 'injectManifest' instead.
|
||||
// Manifest configuration
|
||||
@@ -324,38 +335,27 @@ export const SVELTEKIT_PWA_OPTIONS: SvelteKitPWAOptions = {
|
||||
// Runtime caching for API calls - use NetworkFirst so APIs are always fresh
|
||||
runtimeCaching: [
|
||||
{
|
||||
urlPattern: API_CACHING_PATTERNS.V1_API,
|
||||
handler: RUNTIME_CACHING.HANDLER,
|
||||
options: {
|
||||
cacheName: RUNTIME_CACHING.CACHE_NAME,
|
||||
expiration: {
|
||||
maxEntries: CACHE_SETTINGS.API_CACHE_MAX_ENTRIES,
|
||||
maxAgeSeconds: CACHE_SETTINGS.API_CACHE_MAX_AGE_SECONDS
|
||||
maxAgeSeconds: CACHE_SETTINGS.API_CACHE_MAX_AGE_SECONDS,
|
||||
maxEntries: CACHE_SETTINGS.API_CACHE_MAX_ENTRIES
|
||||
}
|
||||
}
|
||||
},
|
||||
urlPattern: API_CACHING_PATTERNS.V1_API
|
||||
},
|
||||
{
|
||||
urlPattern: API_CACHING_PATTERNS.STATIC_API,
|
||||
handler: RUNTIME_CACHING.HANDLER,
|
||||
options: {
|
||||
cacheName: RUNTIME_CACHING.CACHE_NAME,
|
||||
expiration: {
|
||||
maxEntries: CACHE_SETTINGS.API_CACHE_MAX_ENTRIES,
|
||||
maxAgeSeconds: CACHE_SETTINGS.API_CACHE_MAX_AGE_SECONDS
|
||||
maxAgeSeconds: CACHE_SETTINGS.API_CACHE_MAX_AGE_SECONDS,
|
||||
maxEntries: CACHE_SETTINGS.API_CACHE_MAX_ENTRIES
|
||||
}
|
||||
}
|
||||
},
|
||||
urlPattern: API_CACHING_PATTERNS.STATIC_API
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
devOptions: {
|
||||
enabled: true,
|
||||
suppressWarnings: true
|
||||
},
|
||||
|
||||
// SvelteKit-specific options
|
||||
kit: {
|
||||
// Include version file for proper cache invalidation
|
||||
includeVersionFile: true
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,8 +5,8 @@ import { ReasoningEffort } from '$lib/enums';
|
||||
* Maps the ReasoningEffort enum values to concrete token counts for the server.
|
||||
*/
|
||||
export const REASONING_EFFORT_TOKENS: Record<string, number> = {
|
||||
[ReasoningEffort.LOW]: 512,
|
||||
[ReasoningEffort.MEDIUM]: 2048,
|
||||
[ReasoningEffort.HIGH]: 8192,
|
||||
[ReasoningEffort.MAX]: -1 // unlimited
|
||||
[ReasoningEffort.LOW]: 512,
|
||||
[ReasoningEffort.MAX]: -1, // unlimited
|
||||
[ReasoningEffort.MEDIUM]: 2048
|
||||
};
|
||||
|
||||
@@ -7,18 +7,18 @@ import type { ReasoningEffortLevel } from '$lib/types';
|
||||
*/
|
||||
export const REASONING_EFFORT_LABELS: Record<string, string> = {
|
||||
[ReasoningEffort.DEFAULT]: 'Default',
|
||||
[ReasoningEffort.OFF]: 'Off',
|
||||
[ReasoningEffort.LOW]: 'Low',
|
||||
[ReasoningEffort.MEDIUM]: 'Medium',
|
||||
[ReasoningEffort.HIGH]: 'High',
|
||||
[ReasoningEffort.MAX]: 'Max'
|
||||
[ReasoningEffort.LOW]: 'Low',
|
||||
[ReasoningEffort.MAX]: 'Max',
|
||||
[ReasoningEffort.MEDIUM]: 'Medium',
|
||||
[ReasoningEffort.OFF]: 'Off'
|
||||
};
|
||||
|
||||
export const REASONING_EFFORT_LEVELS: ReasoningEffortLevel[] = [
|
||||
{ value: ReasoningEffort.DEFAULT, label: 'Default' },
|
||||
{ value: ReasoningEffort.OFF, label: 'Off' },
|
||||
{ value: ReasoningEffort.LOW, label: 'Low' },
|
||||
{ value: ReasoningEffort.MEDIUM, label: 'Medium' },
|
||||
{ value: ReasoningEffort.HIGH, label: 'High' },
|
||||
{ value: ReasoningEffort.MAX, label: 'Max', hasInfo: true }
|
||||
{ label: 'Default', value: ReasoningEffort.DEFAULT },
|
||||
{ label: 'Off', value: ReasoningEffort.OFF },
|
||||
{ label: 'Low', value: ReasoningEffort.LOW },
|
||||
{ label: 'Medium', value: ReasoningEffort.MEDIUM },
|
||||
{ label: 'High', value: ReasoningEffort.HIGH },
|
||||
{ hasInfo: true, label: 'Max', value: ReasoningEffort.MAX }
|
||||
];
|
||||
|
||||
@@ -6,33 +6,33 @@ import type { RecommendedMCPServer } from '$lib/types';
|
||||
// after the user clicks Add.
|
||||
export const RECOMMENDED_MCP_SERVERS: RecommendedMCPServer[] = [
|
||||
{
|
||||
description: 'Search the web and fetch full page content as clean markdown.',
|
||||
iconUrl: '/recommended-mcp/exa.ico',
|
||||
id: 'exa',
|
||||
name: 'Exa',
|
||||
description: 'Search the web and fetch full page content as clean markdown.',
|
||||
url: 'https://mcp.exa.ai/mcp',
|
||||
iconUrl: '/recommended-mcp/exa.ico'
|
||||
url: 'https://mcp.exa.ai/mcp'
|
||||
},
|
||||
{
|
||||
description: 'Search and browse AI models, datasets, spaces, and docs on the Hugging Face Hub.',
|
||||
iconUrl: '/recommended-mcp/huggingface.ico',
|
||||
id: 'huggingface',
|
||||
name: 'Hugging Face',
|
||||
description: 'Search and browse AI models, datasets, spaces, and docs on the Hugging Face Hub.',
|
||||
url: 'https://huggingface.co/mcp',
|
||||
iconUrl: '/recommended-mcp/huggingface.ico'
|
||||
url: 'https://huggingface.co/mcp'
|
||||
},
|
||||
{
|
||||
description: 'Search repositories, issues, pull requests and interact with code on GitHub.',
|
||||
iconUrlDark: '/recommended-mcp/github-dark.png',
|
||||
iconUrlLight: '/recommended-mcp/github-light.png',
|
||||
id: 'github',
|
||||
name: 'GitHub',
|
||||
description: 'Search repositories, issues, pull requests and interact with code on GitHub.',
|
||||
url: 'https://api.githubcopilot.com/mcp',
|
||||
iconUrlLight: '/recommended-mcp/github-light.png',
|
||||
iconUrlDark: '/recommended-mcp/github-dark.png',
|
||||
needsAuthorization: true
|
||||
needsAuthorization: true,
|
||||
url: 'https://api.githubcopilot.com/mcp'
|
||||
},
|
||||
{
|
||||
description: 'Browse up-to-date documentation and code examples for libraries and frameworks.',
|
||||
iconUrl: '/recommended-mcp/context7.png',
|
||||
id: 'context7',
|
||||
name: 'Context7',
|
||||
description: 'Browse up-to-date documentation and code examples for libraries and frameworks.',
|
||||
url: 'https://mcp.context7.com/mcp',
|
||||
iconUrl: '/recommended-mcp/context7.png'
|
||||
url: 'https://mcp.context7.com/mcp'
|
||||
}
|
||||
];
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
/** Query params the chat routes read from the URL. */
|
||||
export const URL_PARAMS = {
|
||||
/** Prompt to send on arrival. */
|
||||
QUERY: 'q',
|
||||
/** Model to select. */
|
||||
MODEL: 'model',
|
||||
/** Load the selected model instead of waiting for the first message. */
|
||||
LOAD: 'load',
|
||||
/** Model to select. */
|
||||
MODEL: 'model',
|
||||
/** Start a new chat. */
|
||||
NEW_CHAT: 'new_chat'
|
||||
NEW_CHAT: 'new_chat',
|
||||
/** Prompt to send on arrival. */
|
||||
QUERY: 'q'
|
||||
} as const;
|
||||
|
||||
/** Settings section slugs — used for routes and navigation. */
|
||||
export const SETTINGS_SECTION_SLUGS = {
|
||||
GENERAL: 'general',
|
||||
DISPLAY: 'display',
|
||||
SAMPLING: 'sampling',
|
||||
PENALTIES: 'penalties',
|
||||
AGENTIC: 'agentic',
|
||||
DEVELOPER: 'developer',
|
||||
TOOLS: 'tools',
|
||||
IMPORT_EXPORT: 'import-export'
|
||||
DISPLAY: 'display',
|
||||
GENERAL: 'general',
|
||||
IMPORT_EXPORT: 'import-export',
|
||||
PENALTIES: 'penalties',
|
||||
SAMPLING: 'sampling',
|
||||
TOOLS: 'tools'
|
||||
} as const;
|
||||
|
||||
export const ROUTES = {
|
||||
/** Root — start of the app. */
|
||||
START: '#/',
|
||||
/** New chat — root with new chat query param. */
|
||||
NEW_CHAT: `?${URL_PARAMS.NEW_CHAT}=true#/`,
|
||||
/** Chat base — for dynamic chat URLs use RouterService. */
|
||||
CHAT: '#/chat',
|
||||
/** MCP servers. */
|
||||
MCP_SERVERS: '#/mcp-servers',
|
||||
/** New chat — root with new chat query param. */
|
||||
NEW_CHAT: `?${URL_PARAMS.NEW_CHAT}=true#/`,
|
||||
/** Search — mobile-only full-page conversation search. */
|
||||
SEARCH: '#/search',
|
||||
/** Settings base — for dynamic settings URLs use RouterService. */
|
||||
SETTINGS: '#/settings',
|
||||
/** Search — mobile-only full-page conversation search. */
|
||||
SEARCH: '#/search'
|
||||
/** Root — start of the app. */
|
||||
START: '#/'
|
||||
} as const;
|
||||
|
||||
@@ -31,27 +31,27 @@ IMPORTANT:Identifier 'nerdamer' has already been declared, use it directly`;
|
||||
*/
|
||||
export function buildSandboxToolDefinition(includeSymbolicMath: boolean): OpenAIToolDefinition {
|
||||
return {
|
||||
type: ToolCallType.FUNCTION,
|
||||
function: {
|
||||
name: SANDBOX_TOOL_NAME,
|
||||
description: includeSymbolicMath
|
||||
? `Execute JS in a sandboxed browser worker (no DOM/page access). Top-level await ok; console.log for intermediates; top-level return is captured as result.${NERDAMER_DESCRIPTION}`
|
||||
: 'Execute JS in a sandboxed browser worker (no DOM/page access). Top-level await ok; console.log for intermediates; top-level return is captured as result.',
|
||||
name: SANDBOX_TOOL_NAME,
|
||||
parameters: {
|
||||
type: JsonSchemaType.OBJECT,
|
||||
properties: {
|
||||
code: {
|
||||
type: JsonSchemaType.STRING,
|
||||
description: 'JavaScript source to execute'
|
||||
description: 'JavaScript source to execute',
|
||||
type: JsonSchemaType.STRING
|
||||
},
|
||||
timeout_ms: {
|
||||
type: JsonSchemaType.NUMBER,
|
||||
description: `Execution timeout in milliseconds, default ${SANDBOX_TIMEOUT_MS_DEFAULT}, max ${SANDBOX_TIMEOUT_MS_MAX}`
|
||||
description: `Execution timeout in milliseconds, default ${SANDBOX_TIMEOUT_MS_DEFAULT}, max ${SANDBOX_TIMEOUT_MS_MAX}`,
|
||||
type: JsonSchemaType.NUMBER
|
||||
}
|
||||
},
|
||||
required: ['code']
|
||||
required: ['code'],
|
||||
type: JsonSchemaType.OBJECT
|
||||
}
|
||||
}
|
||||
},
|
||||
type: ToolCallType.FUNCTION
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,71 +5,71 @@
|
||||
* in settings field configurations to ensure consistency.
|
||||
*/
|
||||
export const SETTINGS_KEYS = {
|
||||
// General
|
||||
THEME: 'theme',
|
||||
API_KEY: 'apiKey',
|
||||
SYSTEM_MESSAGE: 'systemMessage',
|
||||
PASTE_LONG_TEXT_TO_FILE_LEN: 'pasteLongTextToFileLen',
|
||||
COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT: 'copyTextAttachmentsAsPlainText',
|
||||
SEND_ON_ENTER: 'sendOnEnter',
|
||||
ENABLE_CONTINUE_GENERATION: 'enableContinueGeneration',
|
||||
PDF_AS_IMAGE: 'pdfAsImage',
|
||||
TITLE_GENERATION_USE_FIRST_LINE: 'titleGenerationUseFirstLine',
|
||||
TITLE_GENERATION_USE_LLM: 'titleGenerationUseLLM',
|
||||
TITLE_GENERATION_PROMPT: 'titleGenerationPrompt',
|
||||
MAX_IMAGE_RESOLUTION: 'maxImageMPixels',
|
||||
// Display
|
||||
SHOW_MESSAGE_STATS: 'showMessageStats',
|
||||
SHOW_AGENTIC_TURN_STATS: 'showAgenticTurnStats',
|
||||
SHOW_THOUGHT_IN_PROGRESS: 'showThoughtInProgress',
|
||||
AUTO_MIC_ON_EMPTY: 'autoMicOnEmpty',
|
||||
RENDER_CONTENT_AS_RAW_TEXT: 'renderContentAsRawText',
|
||||
DISABLE_AUTO_SCROLL: 'disableAutoScroll',
|
||||
AGENTIC_MAX_TURNS: 'agenticMaxTurns',
|
||||
ALWAYS_SHOW_SIDEBAR_ON_DESKTOP: 'alwaysShowSidebarOnDesktop',
|
||||
FULL_HEIGHT_CODE_BLOCKS: 'fullHeightCodeBlocks',
|
||||
SHOW_RAW_MODEL_NAMES: 'showRawModelNames',
|
||||
SHOW_MODEL_QUANTIZATION: 'showModelQuantization',
|
||||
SHOW_MODEL_TAGS: 'showModelTags',
|
||||
SHOW_BUILD_VERSION: 'showBuildVersion',
|
||||
SHOW_FULL_PATH_IN_MENTIONS: 'showFullPathInMentions',
|
||||
SHOW_SYSTEM_MESSAGE: 'showSystemMessage',
|
||||
MENTION_SEARCH_MAX_DEPTH: 'mentionSearchMaxDepth',
|
||||
// Sampling
|
||||
TEMPERATURE: 'temperature',
|
||||
DYNATEMP_RANGE: 'dynatemp_range',
|
||||
DYNATEMP_EXPONENT: 'dynatemp_exponent',
|
||||
TOP_K: 'top_k',
|
||||
TOP_P: 'top_p',
|
||||
MIN_P: 'min_p',
|
||||
XTC_PROBABILITY: 'xtc_probability',
|
||||
XTC_THRESHOLD: 'xtc_threshold',
|
||||
TYP_P: 'typ_p',
|
||||
MAX_TOKENS: 'max_tokens',
|
||||
SAMPLERS: 'samplers',
|
||||
ALWAYS_SHOW_TOOL_CALL_CONTENT: 'alwaysShowToolCallContent',
|
||||
API_KEY: 'apiKey',
|
||||
AUTO_MIC_ON_EMPTY: 'autoMicOnEmpty',
|
||||
BACKEND_SAMPLING: 'backend_sampling',
|
||||
COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT: 'copyTextAttachmentsAsPlainText',
|
||||
CUSTOM_CSS: 'customCss',
|
||||
// PY_INTERPRETER_ENABLED: 'pyInterpreterEnabled',
|
||||
CUSTOM_JSON: 'customJson',
|
||||
DISABLE_AUTO_SCROLL: 'disableAutoScroll',
|
||||
// Developer
|
||||
DISABLE_REASONING_PARSING: 'disableReasoningParsing',
|
||||
DRY_ALLOWED_LENGTH: 'dry_allowed_length',
|
||||
DRY_BASE: 'dry_base',
|
||||
DRY_MULTIPLIER: 'dry_multiplier',
|
||||
DRY_PENALTY_LAST_N: 'dry_penalty_last_n',
|
||||
DYNATEMP_EXPONENT: 'dynatemp_exponent',
|
||||
DYNATEMP_RANGE: 'dynatemp_range',
|
||||
ENABLE_CONTINUE_GENERATION: 'enableContinueGeneration',
|
||||
EXCLUDE_REASONING_FROM_CONTEXT: 'excludeReasoningFromContext',
|
||||
FREQUENCY_PENALTY: 'frequency_penalty',
|
||||
FULL_HEIGHT_CODE_BLOCKS: 'fullHeightCodeBlocks',
|
||||
JS_SANDBOX_ENABLED: 'jsSandboxEnabled',
|
||||
MAX_IMAGE_RESOLUTION: 'maxImageMPixels',
|
||||
MAX_TOKENS: 'max_tokens',
|
||||
MCP_REQUEST_TIMEOUT_SECONDS: 'mcpRequestTimeoutSeconds',
|
||||
// MCP
|
||||
MCP_SERVERS: 'mcpServers',
|
||||
MENTION_SEARCH_MAX_DEPTH: 'mentionSearchMaxDepth',
|
||||
MIN_P: 'min_p',
|
||||
PASTE_LONG_TEXT_TO_FILE_LEN: 'pasteLongTextToFileLen',
|
||||
PDF_AS_IMAGE: 'pdfAsImage',
|
||||
// Performance
|
||||
PRE_ENCODE_CONVERSATION: 'preEncodeConversation',
|
||||
PRESENCE_PENALTY: 'presence_penalty',
|
||||
RENDER_CONTENT_AS_RAW_TEXT: 'renderContentAsRawText',
|
||||
// Penalties
|
||||
REPEAT_LAST_N: 'repeat_last_n',
|
||||
REPEAT_PENALTY: 'repeat_penalty',
|
||||
PRESENCE_PENALTY: 'presence_penalty',
|
||||
FREQUENCY_PENALTY: 'frequency_penalty',
|
||||
DRY_MULTIPLIER: 'dry_multiplier',
|
||||
DRY_BASE: 'dry_base',
|
||||
DRY_ALLOWED_LENGTH: 'dry_allowed_length',
|
||||
DRY_PENALTY_LAST_N: 'dry_penalty_last_n',
|
||||
// MCP
|
||||
MCP_SERVERS: 'mcpServers',
|
||||
MCP_REQUEST_TIMEOUT_SECONDS: 'mcpRequestTimeoutSeconds',
|
||||
AGENTIC_MAX_TURNS: 'agenticMaxTurns',
|
||||
ALWAYS_SHOW_TOOL_CALL_CONTENT: 'alwaysShowToolCallContent',
|
||||
// Performance
|
||||
PRE_ENCODE_CONVERSATION: 'preEncodeConversation',
|
||||
// Developer
|
||||
DISABLE_REASONING_PARSING: 'disableReasoningParsing',
|
||||
EXCLUDE_REASONING_FROM_CONTEXT: 'excludeReasoningFromContext',
|
||||
SAMPLERS: 'samplers',
|
||||
SEND_ON_ENTER: 'sendOnEnter',
|
||||
SHOW_AGENTIC_TURN_STATS: 'showAgenticTurnStats',
|
||||
SHOW_BUILD_VERSION: 'showBuildVersion',
|
||||
SHOW_FULL_PATH_IN_MENTIONS: 'showFullPathInMentions',
|
||||
// Display
|
||||
SHOW_MESSAGE_STATS: 'showMessageStats',
|
||||
SHOW_MODEL_QUANTIZATION: 'showModelQuantization',
|
||||
SHOW_MODEL_TAGS: 'showModelTags',
|
||||
SHOW_RAW_MODEL_NAMES: 'showRawModelNames',
|
||||
SHOW_RAW_OUTPUT_SWITCH: 'showRawOutputSwitch',
|
||||
JS_SANDBOX_ENABLED: 'jsSandboxEnabled',
|
||||
SHOW_SYSTEM_MESSAGE: 'showSystemMessage',
|
||||
SHOW_THOUGHT_IN_PROGRESS: 'showThoughtInProgress',
|
||||
SYMBOLIC_MATH_ENABLED: 'symbolicMathEnabled',
|
||||
// PY_INTERPRETER_ENABLED: 'pyInterpreterEnabled',
|
||||
CUSTOM_JSON: 'customJson',
|
||||
CUSTOM_CSS: 'customCss'
|
||||
SYSTEM_MESSAGE: 'systemMessage',
|
||||
// Sampling
|
||||
TEMPERATURE: 'temperature',
|
||||
// General
|
||||
THEME: 'theme',
|
||||
TITLE_GENERATION_PROMPT: 'titleGenerationPrompt',
|
||||
TITLE_GENERATION_USE_FIRST_LINE: 'titleGenerationUseFirstLine',
|
||||
TITLE_GENERATION_USE_LLM: 'titleGenerationUseLLM',
|
||||
TOP_K: 'top_k',
|
||||
TOP_P: 'top_p',
|
||||
TYP_P: 'typ_p',
|
||||
XTC_PROBABILITY: 'xtc_probability',
|
||||
XTC_THRESHOLD: 'xtc_threshold'
|
||||
} as const;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,11 +12,11 @@ import {
|
||||
FileTypeImage,
|
||||
FileTypePdf,
|
||||
FileTypeText,
|
||||
MimeTypeAudio,
|
||||
MimeTypeVideo,
|
||||
MimeTypeImage,
|
||||
MimeTypeApplication,
|
||||
MimeTypeText
|
||||
MimeTypeAudio,
|
||||
MimeTypeImage,
|
||||
MimeTypeText,
|
||||
MimeTypeVideo
|
||||
} from '$lib/enums';
|
||||
import { FileExtensionVideo, FileTypeVideo } from '$lib/enums/files.enums';
|
||||
|
||||
@@ -44,6 +44,14 @@ export const VIDEO_FILE_TYPES = {
|
||||
} as const;
|
||||
|
||||
export const IMAGE_FILE_TYPES = {
|
||||
[FileTypeImage.GIF]: {
|
||||
extensions: [FileExtensionImage.GIF],
|
||||
mimeTypes: [MimeTypeImage.GIF]
|
||||
},
|
||||
[FileTypeImage.HEIC]: {
|
||||
extensions: [FileExtensionImage.HEIC, FileExtensionImage.HEIF],
|
||||
mimeTypes: [MimeTypeImage.HEIC, MimeTypeImage.HEIF]
|
||||
},
|
||||
[FileTypeImage.JPEG]: {
|
||||
extensions: [FileExtensionImage.JPG, FileExtensionImage.JPEG],
|
||||
mimeTypes: [MimeTypeImage.JPEG]
|
||||
@@ -52,21 +60,13 @@ export const IMAGE_FILE_TYPES = {
|
||||
extensions: [FileExtensionImage.PNG],
|
||||
mimeTypes: [MimeTypeImage.PNG]
|
||||
},
|
||||
[FileTypeImage.GIF]: {
|
||||
extensions: [FileExtensionImage.GIF],
|
||||
mimeTypes: [MimeTypeImage.GIF]
|
||||
},
|
||||
[FileTypeImage.WEBP]: {
|
||||
extensions: [FileExtensionImage.WEBP],
|
||||
mimeTypes: [MimeTypeImage.WEBP]
|
||||
},
|
||||
[FileTypeImage.SVG]: {
|
||||
extensions: [FileExtensionImage.SVG],
|
||||
mimeTypes: [MimeTypeImage.SVG]
|
||||
},
|
||||
[FileTypeImage.HEIC]: {
|
||||
extensions: [FileExtensionImage.HEIC, FileExtensionImage.HEIF],
|
||||
mimeTypes: [MimeTypeImage.HEIC, MimeTypeImage.HEIF]
|
||||
[FileTypeImage.WEBP]: {
|
||||
extensions: [FileExtensionImage.WEBP],
|
||||
mimeTypes: [MimeTypeImage.WEBP]
|
||||
}
|
||||
} as const;
|
||||
|
||||
@@ -78,69 +78,13 @@ export const PDF_FILE_TYPES = {
|
||||
} as const;
|
||||
|
||||
export const TEXT_FILE_TYPES = {
|
||||
[FileTypeText.PLAIN_TEXT]: {
|
||||
extensions: [FileExtensionText.TXT],
|
||||
mimeTypes: [MimeTypeText.PLAIN]
|
||||
},
|
||||
[FileTypeText.MARKDOWN]: {
|
||||
extensions: [FileExtensionText.MD],
|
||||
mimeTypes: [MimeTypeText.MARKDOWN]
|
||||
},
|
||||
[FileTypeText.ASCIIDOC]: {
|
||||
extensions: [FileExtensionText.ADOC],
|
||||
mimeTypes: [MimeTypeText.ASCIIDOC]
|
||||
},
|
||||
[FileTypeText.JAVASCRIPT]: {
|
||||
extensions: [FileExtensionText.JS],
|
||||
mimeTypes: [MimeTypeText.JAVASCRIPT, MimeTypeText.JAVASCRIPT_APP]
|
||||
},
|
||||
[FileTypeText.TYPESCRIPT]: {
|
||||
extensions: [FileExtensionText.TS],
|
||||
mimeTypes: [MimeTypeText.TYPESCRIPT]
|
||||
},
|
||||
[FileTypeText.JSX]: {
|
||||
extensions: [FileExtensionText.JSX],
|
||||
mimeTypes: [MimeTypeText.JSX]
|
||||
},
|
||||
[FileTypeText.TSX]: {
|
||||
extensions: [FileExtensionText.TSX],
|
||||
mimeTypes: [MimeTypeText.TSX]
|
||||
},
|
||||
[FileTypeText.CSS]: {
|
||||
extensions: [FileExtensionText.CSS],
|
||||
mimeTypes: [MimeTypeText.CSS]
|
||||
},
|
||||
[FileTypeText.HTML]: {
|
||||
extensions: [FileExtensionText.HTML, FileExtensionText.HTM],
|
||||
mimeTypes: [MimeTypeText.HTML]
|
||||
},
|
||||
[FileTypeText.JSON]: {
|
||||
extensions: [FileExtensionText.JSON],
|
||||
mimeTypes: [MimeTypeText.JSON]
|
||||
},
|
||||
[FileTypeText.XML]: {
|
||||
extensions: [FileExtensionText.XML],
|
||||
mimeTypes: [MimeTypeText.XML_TEXT, MimeTypeText.XML_APP]
|
||||
},
|
||||
[FileTypeText.YAML]: {
|
||||
extensions: [FileExtensionText.YAML, FileExtensionText.YML],
|
||||
mimeTypes: [MimeTypeText.YAML_TEXT, MimeTypeText.YAML_APP]
|
||||
},
|
||||
[FileTypeText.CSV]: {
|
||||
extensions: [FileExtensionText.CSV],
|
||||
mimeTypes: [MimeTypeText.CSV]
|
||||
},
|
||||
[FileTypeText.LOG]: {
|
||||
extensions: [FileExtensionText.LOG],
|
||||
mimeTypes: [MimeTypeText.PLAIN]
|
||||
},
|
||||
[FileTypeText.PYTHON]: {
|
||||
extensions: [FileExtensionText.PY],
|
||||
mimeTypes: [MimeTypeText.PYTHON]
|
||||
},
|
||||
[FileTypeText.JAVA]: {
|
||||
extensions: [FileExtensionText.JAVA],
|
||||
mimeTypes: [MimeTypeText.JAVA]
|
||||
[FileTypeText.BIBTEX]: {
|
||||
extensions: [FileExtensionText.BIB],
|
||||
mimeTypes: [MimeTypeText.BIBTEX]
|
||||
},
|
||||
[FileTypeText.CPP]: {
|
||||
extensions: [
|
||||
@@ -151,22 +95,102 @@ export const TEXT_FILE_TYPES = {
|
||||
],
|
||||
mimeTypes: [MimeTypeText.CPP_SRC, MimeTypeText.CPP_HDR, MimeTypeText.C_SRC, MimeTypeText.C_HDR]
|
||||
},
|
||||
[FileTypeText.PHP]: {
|
||||
extensions: [FileExtensionText.PHP],
|
||||
mimeTypes: [MimeTypeText.PHP]
|
||||
[FileTypeText.CSHARP]: {
|
||||
extensions: [FileExtensionText.CS],
|
||||
mimeTypes: [MimeTypeText.CSHARP]
|
||||
},
|
||||
[FileTypeText.RUBY]: {
|
||||
extensions: [FileExtensionText.RB],
|
||||
mimeTypes: [MimeTypeText.RUBY]
|
||||
[FileTypeText.CSS]: {
|
||||
extensions: [FileExtensionText.CSS],
|
||||
mimeTypes: [MimeTypeText.CSS]
|
||||
},
|
||||
[FileTypeText.CSV]: {
|
||||
extensions: [FileExtensionText.CSV],
|
||||
mimeTypes: [MimeTypeText.CSV]
|
||||
},
|
||||
[FileTypeText.CUDA]: {
|
||||
extensions: [FileExtensionText.CU, FileExtensionText.CUH],
|
||||
mimeTypes: [MimeTypeText.CUDA]
|
||||
},
|
||||
[FileTypeText.DART]: {
|
||||
extensions: [FileExtensionText.DART],
|
||||
mimeTypes: [MimeTypeText.DART]
|
||||
},
|
||||
[FileTypeText.GO]: {
|
||||
extensions: [FileExtensionText.GO],
|
||||
mimeTypes: [MimeTypeText.GO]
|
||||
},
|
||||
[FileTypeText.HASKELL]: {
|
||||
extensions: [FileExtensionText.HS],
|
||||
mimeTypes: [MimeTypeText.HASKELL]
|
||||
},
|
||||
[FileTypeText.HTML]: {
|
||||
extensions: [FileExtensionText.HTML, FileExtensionText.HTM],
|
||||
mimeTypes: [MimeTypeText.HTML]
|
||||
},
|
||||
[FileTypeText.JAVA]: {
|
||||
extensions: [FileExtensionText.JAVA],
|
||||
mimeTypes: [MimeTypeText.JAVA]
|
||||
},
|
||||
[FileTypeText.JAVASCRIPT]: {
|
||||
extensions: [FileExtensionText.JS],
|
||||
mimeTypes: [MimeTypeText.JAVASCRIPT, MimeTypeText.JAVASCRIPT_APP]
|
||||
},
|
||||
[FileTypeText.JSON]: {
|
||||
extensions: [FileExtensionText.JSON],
|
||||
mimeTypes: [MimeTypeText.JSON]
|
||||
},
|
||||
[FileTypeText.JSX]: {
|
||||
extensions: [FileExtensionText.JSX],
|
||||
mimeTypes: [MimeTypeText.JSX]
|
||||
},
|
||||
[FileTypeText.KOTLIN]: {
|
||||
extensions: [FileExtensionText.KT],
|
||||
mimeTypes: [MimeTypeText.KOTLIN]
|
||||
},
|
||||
[FileTypeText.LATEX]: {
|
||||
extensions: [FileExtensionText.TEX],
|
||||
mimeTypes: [MimeTypeText.LATEX, MimeTypeText.TEX, MimeTypeText.TEX_APP]
|
||||
},
|
||||
[FileTypeText.LOG]: {
|
||||
extensions: [FileExtensionText.LOG],
|
||||
mimeTypes: [MimeTypeText.PLAIN]
|
||||
},
|
||||
[FileTypeText.MARKDOWN]: {
|
||||
extensions: [FileExtensionText.MD],
|
||||
mimeTypes: [MimeTypeText.MARKDOWN]
|
||||
},
|
||||
[FileTypeText.PHP]: {
|
||||
extensions: [FileExtensionText.PHP],
|
||||
mimeTypes: [MimeTypeText.PHP]
|
||||
},
|
||||
[FileTypeText.PLAIN_TEXT]: {
|
||||
extensions: [FileExtensionText.TXT],
|
||||
mimeTypes: [MimeTypeText.PLAIN]
|
||||
},
|
||||
[FileTypeText.PROPERTIES]: {
|
||||
extensions: [FileExtensionText.PROPERTIES],
|
||||
mimeTypes: [MimeTypeText.PROPERTIES]
|
||||
},
|
||||
[FileTypeText.PYTHON]: {
|
||||
extensions: [FileExtensionText.PY],
|
||||
mimeTypes: [MimeTypeText.PYTHON]
|
||||
},
|
||||
[FileTypeText.R]: {
|
||||
extensions: [FileExtensionText.R],
|
||||
mimeTypes: [MimeTypeText.R]
|
||||
},
|
||||
[FileTypeText.RUBY]: {
|
||||
extensions: [FileExtensionText.RB],
|
||||
mimeTypes: [MimeTypeText.RUBY]
|
||||
},
|
||||
[FileTypeText.RUST]: {
|
||||
extensions: [FileExtensionText.RS],
|
||||
mimeTypes: [MimeTypeText.RUST]
|
||||
},
|
||||
[FileTypeText.SCALA]: {
|
||||
extensions: [FileExtensionText.SCALA],
|
||||
mimeTypes: [MimeTypeText.SCALA]
|
||||
},
|
||||
[FileTypeText.SHELL]: {
|
||||
extensions: [FileExtensionText.SH, FileExtensionText.BAT],
|
||||
mimeTypes: [MimeTypeText.SHELL, MimeTypeText.BAT]
|
||||
@@ -175,60 +199,36 @@ export const TEXT_FILE_TYPES = {
|
||||
extensions: [FileExtensionText.SQL],
|
||||
mimeTypes: [MimeTypeText.SQL]
|
||||
},
|
||||
[FileTypeText.R]: {
|
||||
extensions: [FileExtensionText.R],
|
||||
mimeTypes: [MimeTypeText.R]
|
||||
},
|
||||
[FileTypeText.SCALA]: {
|
||||
extensions: [FileExtensionText.SCALA],
|
||||
mimeTypes: [MimeTypeText.SCALA]
|
||||
},
|
||||
[FileTypeText.KOTLIN]: {
|
||||
extensions: [FileExtensionText.KT],
|
||||
mimeTypes: [MimeTypeText.KOTLIN]
|
||||
[FileTypeText.SVELTE]: {
|
||||
extensions: [FileExtensionText.SVELTE],
|
||||
mimeTypes: [MimeTypeText.SVELTE]
|
||||
},
|
||||
[FileTypeText.SWIFT]: {
|
||||
extensions: [FileExtensionText.SWIFT],
|
||||
mimeTypes: [MimeTypeText.SWIFT]
|
||||
},
|
||||
[FileTypeText.DART]: {
|
||||
extensions: [FileExtensionText.DART],
|
||||
mimeTypes: [MimeTypeText.DART]
|
||||
[FileTypeText.TSX]: {
|
||||
extensions: [FileExtensionText.TSX],
|
||||
mimeTypes: [MimeTypeText.TSX]
|
||||
},
|
||||
[FileTypeText.TYPESCRIPT]: {
|
||||
extensions: [FileExtensionText.TS],
|
||||
mimeTypes: [MimeTypeText.TYPESCRIPT]
|
||||
},
|
||||
[FileTypeText.VUE]: {
|
||||
extensions: [FileExtensionText.VUE],
|
||||
mimeTypes: [MimeTypeText.VUE]
|
||||
},
|
||||
[FileTypeText.SVELTE]: {
|
||||
extensions: [FileExtensionText.SVELTE],
|
||||
mimeTypes: [MimeTypeText.SVELTE]
|
||||
},
|
||||
[FileTypeText.LATEX]: {
|
||||
extensions: [FileExtensionText.TEX],
|
||||
mimeTypes: [MimeTypeText.LATEX, MimeTypeText.TEX, MimeTypeText.TEX_APP]
|
||||
},
|
||||
[FileTypeText.BIBTEX]: {
|
||||
extensions: [FileExtensionText.BIB],
|
||||
mimeTypes: [MimeTypeText.BIBTEX]
|
||||
},
|
||||
[FileTypeText.CUDA]: {
|
||||
extensions: [FileExtensionText.CU, FileExtensionText.CUH],
|
||||
mimeTypes: [MimeTypeText.CUDA]
|
||||
},
|
||||
[FileTypeText.VULKAN]: {
|
||||
extensions: [FileExtensionText.COMP],
|
||||
mimeTypes: [MimeTypeText.PLAIN]
|
||||
},
|
||||
[FileTypeText.HASKELL]: {
|
||||
extensions: [FileExtensionText.HS],
|
||||
mimeTypes: [MimeTypeText.HASKELL]
|
||||
[FileTypeText.XML]: {
|
||||
extensions: [FileExtensionText.XML],
|
||||
mimeTypes: [MimeTypeText.XML_TEXT, MimeTypeText.XML_APP]
|
||||
},
|
||||
[FileTypeText.CSHARP]: {
|
||||
extensions: [FileExtensionText.CS],
|
||||
mimeTypes: [MimeTypeText.CSHARP]
|
||||
},
|
||||
[FileTypeText.PROPERTIES]: {
|
||||
extensions: [FileExtensionText.PROPERTIES],
|
||||
mimeTypes: [MimeTypeText.PROPERTIES]
|
||||
[FileTypeText.YAML]: {
|
||||
extensions: [FileExtensionText.YAML, FileExtensionText.YML],
|
||||
mimeTypes: [MimeTypeText.YAML_TEXT, MimeTypeText.YAML_APP]
|
||||
}
|
||||
} as const;
|
||||
|
||||
@@ -30,8 +30,8 @@ export const SVG_MAX_BYTES = 256 * 1024;
|
||||
* so an author <style> stays scoped to that root and can not reach the page.
|
||||
*/
|
||||
export const SVG_SANITIZE_CONFIG = {
|
||||
USE_PROFILES: { svg: true, svgFilters: true },
|
||||
FORBID_TAGS: ['foreignObject', 'script']
|
||||
FORBID_TAGS: ['foreignObject', 'script'],
|
||||
USE_PROFILES: { svg: true, svgFilters: true }
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* Title generation constants */
|
||||
export const TITLE_GENERATION = {
|
||||
MIN_LENGTH: 3,
|
||||
FALLBACK: 'New Chat',
|
||||
DEFAULT_PROMPT:
|
||||
'Based on the following interaction, generate a short, concise title (maximum 6-8 words) that captures the main topic. Return ONLY the title text, nothing else. Do not use quotes.\n\nUser: {{USER}}\n\nAssistant: {{ASSISTANT}}\n\nTitle:',
|
||||
FALLBACK: 'New Chat',
|
||||
MIN_LENGTH: 3,
|
||||
PREFIX_PATTERN: /^(Title:|Subject:|Topic:)\s*/i,
|
||||
QUOTE_PATTERN: /^["]|["]$/g
|
||||
} as const;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ROUTES } from './routes';
|
||||
import { Package, Search, Settings, SquarePen } from '@lucide/svelte';
|
||||
import McpLogo from '$lib/components/app/mcp/McpLogo.svelte';
|
||||
import type { Component } from 'svelte';
|
||||
import { ROUTES } from './routes';
|
||||
|
||||
export const FORK_TREE_DEPTH_PADDING = 8;
|
||||
export const SYSTEM_MESSAGE_PLACEHOLDER = 'System message';
|
||||
@@ -26,18 +26,18 @@ export interface DesktopIconStripItem {
|
||||
}
|
||||
|
||||
export const SIDEBAR_ACTIONS_ITEMS: DesktopIconStripItem[] = [
|
||||
{ icon: SquarePen, tooltip: 'New chat', route: ROUTES.NEW_CHAT, keys: ['shift', 'cmd', 'o'] },
|
||||
{ icon: Search, tooltip: 'Search', keys: ['cmd', 'k'] },
|
||||
{ icon: SquarePen, keys: ['shift', 'cmd', 'o'], route: ROUTES.NEW_CHAT, tooltip: 'New chat' },
|
||||
{ icon: Search, keys: ['cmd', 'k'], tooltip: 'Search' },
|
||||
{
|
||||
activeRouteId: '/mcp-servers',
|
||||
icon: McpLogo,
|
||||
tooltip: 'MCP Servers',
|
||||
route: ROUTES.MCP_SERVERS,
|
||||
activeRouteId: '/mcp-servers'
|
||||
tooltip: 'MCP Servers'
|
||||
},
|
||||
{
|
||||
activeUrlIncludes: '#/settings',
|
||||
icon: Settings,
|
||||
tooltip: 'Settings',
|
||||
route: `${ROUTES.SETTINGS}/general`,
|
||||
activeUrlIncludes: '#/settings'
|
||||
tooltip: 'Settings'
|
||||
}
|
||||
];
|
||||
|
||||
@@ -10,38 +10,38 @@ export const TEMPLATE_EXPRESSION_REGEX = /\{([+#./;?&]?)([^}]+)\}/g;
|
||||
|
||||
/** RFC 6570 URI template operators */
|
||||
export const URI_TEMPLATE_OPERATORS = {
|
||||
/** Simple string expansion (default) */
|
||||
SIMPLE: '',
|
||||
/** Reserved expansion */
|
||||
RESERVED: '+',
|
||||
/** Form-style query continuation */
|
||||
FORM_CONTINUATION: '&',
|
||||
/** Form-style query */
|
||||
FORM_QUERY: '?',
|
||||
/** Fragment expansion */
|
||||
FRAGMENT: '#',
|
||||
/** Path segment expansion */
|
||||
PATH_SEGMENT: '/',
|
||||
/** Label expansion */
|
||||
LABEL: '.',
|
||||
/** Path-style parameters */
|
||||
PATH_PARAM: ';',
|
||||
/** Form-style query */
|
||||
FORM_QUERY: '?',
|
||||
/** Form-style query continuation */
|
||||
FORM_CONTINUATION: '&'
|
||||
/** Path segment expansion */
|
||||
PATH_SEGMENT: '/',
|
||||
/** Reserved expansion */
|
||||
RESERVED: '+',
|
||||
/** Simple string expansion (default) */
|
||||
SIMPLE: ''
|
||||
} as const;
|
||||
|
||||
/** URI template separators used in expansion */
|
||||
export const URI_TEMPLATE_SEPARATORS = {
|
||||
/** Comma separator for list expansion */
|
||||
COMMA: ',',
|
||||
/** Slash separator for path segments */
|
||||
SLASH: '/',
|
||||
/** Period separator for label expansion */
|
||||
PERIOD: '.',
|
||||
/** Semicolon separator for path parameters */
|
||||
SEMICOLON: ';',
|
||||
/** Ampersand prefix for query continuation */
|
||||
QUERY_CONTINUATION: '&',
|
||||
/** Question mark prefix for query string */
|
||||
QUERY_PREFIX: '?',
|
||||
/** Ampersand prefix for query continuation */
|
||||
QUERY_CONTINUATION: '&'
|
||||
/** Semicolon separator for path parameters */
|
||||
SEMICOLON: ';',
|
||||
/** Slash separator for path segments */
|
||||
SLASH: '/'
|
||||
} as const;
|
||||
|
||||
/** Maximum number of leading slashes to strip during URI normalization */
|
||||
|
||||
@@ -1,34 +1,12 @@
|
||||
const STD = ['com', 'net', 'org', 'gov', 'edu'] as const;
|
||||
|
||||
const STD_MIL = [...STD, 'mil'] as const;
|
||||
|
||||
const ccTLD_PREFIXES: Record<string, readonly string[]> = {
|
||||
ae: ['co', 'net', 'org', 'gov', 'ac', 'sch'],
|
||||
// --- Standard 5 only ---
|
||||
ar: STD,
|
||||
au: [...STD_MIL, 'id', 'asn', 'csiro'],
|
||||
bd: STD,
|
||||
bg: STD,
|
||||
cn: STD_MIL,
|
||||
eg: STD,
|
||||
gr: STD,
|
||||
hk: STD,
|
||||
hr: STD,
|
||||
lk: STD,
|
||||
mx: STD_MIL,
|
||||
my: STD_MIL,
|
||||
ng: STD,
|
||||
ph: STD,
|
||||
pk: STD,
|
||||
pl: STD,
|
||||
ro: STD,
|
||||
ru: STD,
|
||||
sa: STD,
|
||||
si: STD,
|
||||
tr: STD,
|
||||
tw: STD,
|
||||
ua: STD,
|
||||
ve: STD,
|
||||
|
||||
au: [...STD_MIL, 'id', 'asn', 'csiro'],
|
||||
br: [
|
||||
...STD_MIL,
|
||||
'art',
|
||||
@@ -84,9 +62,22 @@ const ccTLD_PREFIXES: Record<string, readonly string[]> = {
|
||||
'wiki',
|
||||
'zlg'
|
||||
],
|
||||
cn: STD_MIL,
|
||||
eg: STD,
|
||||
gr: STD,
|
||||
hk: STD,
|
||||
hr: STD,
|
||||
hu: ['co', 'net', 'org', 'gov', 'edu'],
|
||||
id: [...STD_MIL, 'co', 'go', 'or', 'web', 'sch'],
|
||||
il: ['co', 'net', 'org', 'gov', 'ac', 'muni'],
|
||||
in: [...STD_MIL, 'co', 'gen', 'ind', 'firm', 'ernet', 'nic'],
|
||||
jp: ['ac', 'ad', 'co', 'ed', 'go', 'gr', 'lg', 'ne', 'or'],
|
||||
ke: ['co', 'or', 'ne', 'go', 'ac', 'sc'],
|
||||
kr: [...STD_MIL, 'co', 'go', 'or', 'ac', 're'],
|
||||
lk: STD,
|
||||
mx: STD_MIL,
|
||||
my: STD_MIL,
|
||||
ng: STD,
|
||||
nz: [
|
||||
...STD_MIL,
|
||||
'co',
|
||||
@@ -100,19 +91,25 @@ const ccTLD_PREFIXES: Record<string, readonly string[]> = {
|
||||
'iwi',
|
||||
'parliament'
|
||||
],
|
||||
sg: [...STD, 'per'],
|
||||
th: ['co', 'go', 'or', 'in', 'ac', 'mi', 'net'],
|
||||
|
||||
ae: ['co', 'net', 'org', 'gov', 'ac', 'sch'],
|
||||
hu: ['co', 'net', 'org', 'gov', 'edu'],
|
||||
il: ['co', 'net', 'org', 'gov', 'ac', 'muni'],
|
||||
jp: ['ac', 'ad', 'co', 'ed', 'go', 'gr', 'lg', 'ne', 'or'],
|
||||
ke: ['co', 'or', 'ne', 'go', 'ac', 'sc'],
|
||||
ph: STD,
|
||||
pk: STD,
|
||||
pl: STD,
|
||||
ro: STD,
|
||||
rs: ['co', 'net', 'org', 'gov', 'edu'],
|
||||
ru: STD,
|
||||
sa: STD,
|
||||
sg: [...STD, 'per'],
|
||||
|
||||
si: STD,
|
||||
th: ['co', 'go', 'or', 'in', 'ac', 'mi', 'net'],
|
||||
tr: STD,
|
||||
tw: STD,
|
||||
ua: STD,
|
||||
uk: ['co', 'org', 'net', 'ac', 'gov', 'mil', 'nhs', 'police', 'mod', 'ltd', 'plc', 'me', 'sch'],
|
||||
ve: STD,
|
||||
za: ['co', 'org', 'net', 'web', 'law', 'mil']
|
||||
};
|
||||
|
||||
const WILDCARD_BASES: Record<string, readonly string[]> = {
|
||||
br: ['nom', 'blog'],
|
||||
jp: [
|
||||
|
||||
Reference in New Issue
Block a user