- Replace isomorphic-dompurify with htmlparser2 (works in Web Workers)
- Add sanitizeHtmlForMultimedia() for video/audio/source tag allowlisting
- Update tests to expect escaped (not stripped) disallowed tags
feat(markdown): allow video and audio tags (#2037)
* feat(markdown): allow video and audio tags in markdown
- Add custom image renderer to convert video/audio URLs to media tags
- Use DOMPurify to sanitize raw HTML, allowing only video/audio/source
- Add comprehensive tests for media rendering and XSS prevention
* feat(mcp): increase tool timeout from 30s to 60s
* feat(mcp): update tool prompt to mention video/audio support
* test: update markdown test for DOMPurify behavior
MCP Tool Progress Notifications and MCP SDK bump. (#2030)
Refactors the requireAuthUser function to always append the 'next' parameter to the login URL, removing conditional logic based on shared state or pathname.
* Preserve original content-type in fetch-url API
The API now returns the content-type from the fetched response instead of always using text/plain. This allows clients to receive the correct content type for the requested resource.
* Improve MIME type handling for URL file fetches
Adds a utility for safer MIME type inference and selection, using file extensions and forwarded headers. Updates file fetch logic in UrlFetchModal and loadAttachmentsFromUrls to use the new helper, improving filename extraction and MIME type accuracy. The API endpoint now always returns 'text/plain' for safety, exposing the original content type in a custom header.
* Update src/lib/components/chat/UrlFetchModal.svelte
Co-authored-by: Eliott C. <coyotte508@gmail.com>
* Update src/lib/utils/loadAttachmentsFromUrls.ts
Co-authored-by: Eliott C. <coyotte508@gmail.com>
---------
Co-authored-by: Eliott C. <coyotte508@gmail.com>
- Update examples and Helm envs to use hf.co endpoint
- Relax isStrictHfMcpLogin to allow both hf.co and huggingface.co
- Keeps functionality identical while preferring the shorter domain
* Update ServerCard.svelte
feat(mcp): add Model Context Protocol integration with tool support
Improve MCP tools caching and server selection logic
Replaces single-entry MCP tools cache with a multi-keyed cache based on server configuration, improving cache accuracy for different server sets. Refactors server selection logic in runMcpFlow to better handle custom server lists and selected server names. Removes MCP flow from generate.ts, streamlining text generation logic.
* Add OAuth authentication for MCP servers
Introduces browser-based OAuth flow for MCP servers, including new auth helpers, localStorage management, and UI actions for authentication and sign-out. Server cards now support authentication, and enabled servers include persisted auth headers for API requests. Adds callback handler and route for OAuth completion.
* Add server authentication status and UI indicators
Introduces an 'authRequired' property to MCPServer and health check responses to indicate when authenti…
* Add custom scrollbar class to Modal component
Applied the 'scrollbar-custom' class to the Modal's main container to enable custom scrollbar styling. This improves the appearance and consistency of scrollbars within modals.
* Add support for loading attachments from URLs
Implements the ability to load file attachments via URL parameters using a new utility (loadAttachmentsFromUrls) and a server-side proxy endpoint (/api/fetch-url) to securely fetch remote files. Updates chat and model pages to handle 'attachments' query parameters, injects file content into user messages, and improves multimodal message preparation. Also includes minor UI adjustments for file display and refactors Plausible analytics script initialization.
* Block redirects in fetch-url API endpoint
Redirect to shared conversation after login (#1962)
* Add custom scrollbar class to Modal component
Applied the 'scrollbar-custom' class to the Modal's main container to enable custom scrollbar styling. This improves the appearance and consistency of scrollbars within modals.
* Add support for loading attachments from URLs
Implements the ability to load file attachments via URL parameters using a new utility (loadAttachmentsFromUrls) and a server-side proxy endpoint (/api/fetch-url) to securely fetch remote files. Updates chat and model pages to handle 'attachments' query parameters, injects file content into user messages, and improves multimodal message preparation. Also includes minor UI adjustments for file display and refactors Plausible analytics script initialization.
* Add support for 'prompt' URL param and draft binding
Introduces a utility to sanitize URL parameters and updates chat window logic to use a 'draft' state instead of 'message'. Both main and model-specific chat pages now support pre-filling the chat input from a 'prompt' URL parameter, and clear the parameter after use. This improves UX for deep-linking and sharing prompts.
* Sanitize URL parameters in model page
Added usage of sanitizeUrlParam for 'q' and 'prompt' URL parameters in the model page to prevent unsafe input. Wrapped parameter handling in a try-catch block to improve error handling and log failures.
Replaces isInsideIncompleteCodeBlock with getOpenCodeFenceIndex for improved detection of open fenced code blocks. Updates all relevant handlers to use the new function, enhancing accuracy and maintainability when processing incomplete markdown inside code blocks.
Adds logic to prevent incomplete bold, italic, and bold-italic markdown formatting from being processed if the marker is inside an incomplete code block. This avoids incorrectly modifying text that is meant to be inside code blocks, improving the robustness of markdown parsing.
- Remove unused goto import in NavMenu.svelte
- Remove unused imports and worker variable in MarkdownRenderer.svelte
- Replace any types with string | boolean in settings.ts
- Preserve _countSingleDollarSigns with eslint-disable comment
Replaces all 2-space indentation with tabs in parseIncompleteMarkdown.ts for consistency with project style. Also applies minor whitespace and formatting adjustments in MarkdownRenderer.svelte and settings.ts for code style uniformity.
Refactor markdown rendering to use block-based processing
Introduces block-level parsing and rendering for markdown content by adding `parseBlocks.ts` and updating `marked.ts` to support block tokens with stable IDs. Refactors `MarkdownRenderer.svelte` to process and render markdown in independent blocks using the new `MarkdownBlock.svelte` component, improving memoization and streaming efficiency. This change also ensures better handling of complex markdown features such as footnotes and math blocks.
Add incomplete markdown parser for streaming support
Introduces parseIncompleteMarkdown to preprocess and complete partial markdown tokens, improving smooth streaming and rendering of incomplete markdown. Updates processTokens and processTokensSync in marked.ts to use this preprocessing step before lexing content.
Switch to isomorphic-dompurify and update jsdom usage
Replaces the custom dompurify utility with isomorphic-dompurify for improved SSR compatibility. Updates MarkdownRenderer and CodeBlock components to use the new sanitizer. Removes the now-unnecessary dompurify.ts utility. Updates related dependencies in package.json and aligns jsdom and related packages to compatible versions.
test: Replace isomorphic-dompurify with custom DOMPurify wrapper
Removed isomorphic-dompurify in favor of a local utility that provides DOMPurify for both browser and server environments using jsdom. Updated imports in CodeBlock.svelte and MarkdownRenderer.svelte, added src/lib/utils/dompurify.ts, switched dependency from isomorphic-dompurify to jsdom, and updated Vite config to mark jsdom as external.
Remove deprecated oldModels support from codebase
Eliminated all references to oldModels, including its import, configuration, and usage in model selection logic and API routes. This simplifies model management and removes unnecessary legacy code.
* Add AbortRegistry for user-initiated generation cancellation
Introduces an AbortRegistry singleton to track and manage AbortControllers for active conversation generations, enabling user-initiated cancellation of ongoing requests. Updates text generation and endpoint logic to support abort signals, and ensures proper cleanup and partial response handling when a generation is aborted. The stop-generating endpoint now triggers aborts via the registry.
* Remove 'continue message' feature from chat flow
Eliminated the 'continue message' functionality and related code, including the ContinueBtn component, associated props, and logic in both frontend and backend. This simplifies the message handling flow and removes unused parameters and UI elements.
fix CI (#1884)
Eliott C.
Unverified signature
2883086
* fix CI
* add playwright as dev dep
* lint
* clean up spaces-config with community tools
* try to make mongo run?
Enhance code token processing to include fenced block closure detection
* refactor: remove tokenizer-related functionality and dependencies
- Removed tokenizer dependencies from package.json.
- Deleted TokensCounter component and its usages across the application.
- Updated model configurations to exclude tokenizer properties.
- Refactored model processing logic to support only OpenAI-compatible endpoints.
- Adjusted API responses to omit tokenizer information.
- Cleaned up related utility functions and imports.
* Remove web search functionality and related components
- Deleted endpoints for various web search APIs (serpApi, serpStack, serper, webLocal, youApi).
- Removed generateQuery function and its usage in search.
- Eliminated web search related types and interfaces from the codebase.
- Updated Assistant and Conversation types to remove references to web search and embedding models.
- Cleaned up related utility functions and message updates for web search.
- Adjusted API routes and components to reflect the removal of web search features.
- Updated…
* feat(API): refactor API with Elysia
* feat: initial elysia setup
* feat: replace conv/[id] load function with universal
* fix: delete v1 catchall
* wip
* fix: response type
* fix: add cors
* feat: more routes in tools & assistants
* refacto: use normal svelte fetch in `/assistant/[assistantId]`
* refacto: use normal svelte fetch in `conversation/[id]`
* feat: use universal load function for `tools/[toolId]`
* wip: removing more server load function stuff
* feat: more routes to universal load functions
* feat: more routes to universal
* refactor: move tools loading to API endpoint
* refactor(api): implement tools search API endpoint and move load function
* fix: types on tool search
* refactor: update assistant route and remove redundant page load function
* refactor(api): move assistants page load function to api call
* refactor(settings): remove waterfall loading
* refactor: main load function
* fix: types
* feat: improve fetchJSON to handle empty responses
* …
Revert "refactor: new API & universal load functions (#1743)"
* feat(API): refactor API with Elysia
* feat: initial elysia setup
* feat: replace conv/[id] load function with universal
* fix: delete v1 catchall
* wip
* fix: response type
* fix: add cors
* feat: more routes in tools & assistants
* refacto: use normal svelte fetch in `/assistant/[assistantId]`
* refacto: use normal svelte fetch in `conversation/[id]`
* feat: use universal load function for `tools/[toolId]`
* wip: removing more server load function stuff
* feat: more routes to universal load functions
* feat: more routes to universal
* refactor: move tools loading to API endpoint
* refactor(api): implement tools search API endpoint and move load function
* fix: types on tool search
* refactor: update assistant route and remove redundant page load function
* refactor(api): move assistants page load function to api call
* refactor(settings): remove waterfall loading
* refactor: main load function
* fix: types
* feat: improve fetchJSON to handle empty responses
* …
refactor: improve rendering perf. on low-end hardware
- Reintroduced MarkdownWorker for asynchronous processing of markdown content.
- Debounce message content updates dynamically based on render time
* feat(config): wip, make config controllable from DB, public side for now
* fix: build
* feat(config): add config manager env var toggle
* wip: make backend config use config manager
* fix: typechecks
* fix: circular import
* refactor: init hook sveltekit
* fix: disable config manager during tests
* refactor: use enum for semaphore, move delete from auto after 60s to separate `deleteAt` field
* feat: config manager checks for updates on requests
* fix: config script exit
* fix: remove top-level awaits
* fix: script await
* feat: filter config keys based on public environment variables for more security
* fix: change import to type for public environment variables
feat: add a local endpoint type for inference directly from chat-ui (#1778)
* feat: add a local endpoint type running llama.cpp from chat-ui
* fix: build image
* fix: lock file
* wip: try to make it more reliable
* feat: load chat template from .gguf file
* feat: load gguf models from `models/` folder
* fix: default config
* feat: make endpoint use chatSession instead of completion
* refactor: improve exit handling, exit immediately on second sinal
* fix: various fixes to improve reliability when calling multiple models at once
* docs: add instructions for adding .gguf files to the models directory
Add support for Jinja for chat model templates (#1739)
Ben Lewis+1: nsarrazin
Unverified signature
3aa87af
* Add support for Jinja for chat model templates
* feat(docs): improve docs regarding templates
---------
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
* feat(front): move markdown parsing to web worker
* feat: use webworker for markdown parsing
* feat(markdown-worker): implement message buffering and processing
* fix(markdown): import KaTeX CSS locally instead of via CDN
* fix(markdown): make sure messages are serializable
* feat(markdown): make sure links have target blank
* refactor(markdown): improve HTML escaping function formatting