Skip to content

SvelteKit-based WebUI #14839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 145 commits into
base: master
Choose a base branch
from
Draft

Conversation

allozaur
Copy link

No description provided.

allozaur added 15 commits July 21, 2025 13:16
Sets up a new SvelteKit project for the web UI with Storybook & ShadCN installed

This includes adding base files, Storybook configuration,
Prettier and ESLint configurations, a test setup, and basic
styling with Tailwind CSS.
Adds a theme mode watcher to the web UI.

This allows the UI to automatically switch between light and dark
mode based on the user's system preferences.
Introduces a script for streamlined web UI development.

This script simplifies the process of starting a development server with configurable options for model selection (local or Hugging Face), port number, and build execution. It improves the developer experience by automating setup and providing helpful usage instructions.
Changes the SvelteKit adapter to `@sveltejs/adapter-static`.
This allows for generating static HTML files for improved
performance and easier deployment to static hosting providers.

Configures the adapter to output files to the `../public` directory
and to use `index.html` as a fallback.
Implements a proof-of-concept SvelteKit application with core chat functionalities.

This includes:
- UI components for chat messages and input
- A chat service for handling API requests
- State management using Svelte reactivity
@@ -0,0 +1,38 @@
# sv
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update README file

@bayorm
Copy link

bayorm commented Jul 26, 2025

what is reason to change from react -> svelte? Would it be better just to improve UI with react?

Allows users to rename existing conversations in the chat sidebar.

This change introduces an edit dialog to the conversation item,
allowing users to input a new name for the conversation. The name
is then updated in the store.
@allozaur
Copy link
Author

what is reason to change from react -> svelte? Would it be better just to improve UI with react?

Hey @bayorm! That is a good question indeed :) In fact, there are couple of reasons:

  1. Svelte does not require VDOM to work as it is compiled to vanilla JavaScript at build time. This results in a much better performance in the browser and also smaller bundle size.

  2. React in general requires a lot of boilerplate and generally is not the most efficient way of writing frontend code. With Svelte, on the other hand, you have a straightforward approach to writing code for components and reactive state management which requires almost no boilerplate.

  3. React is still definitely the most popular thanks to its robust ecosystem and community, but honestly Svelte has matured enough and has grown its community and ecosystem significantly. Additionally it has some key advantages:

  • Much less code required to achieve the same effects
  • Really well thought reactivity and overall architectural patterns
  • Svelte is 100% free, community driven open source technology while React is officially developed by Meta which is a private company

Updates the chat form to enable sending messages even if the text input is empty, as long as there are uploaded files attached.

Also adds tooltips to the microphone and attachment buttons to indicate if the current model does not support audio or vision, respectively.
Hides the card from the user's message if the message content is empty.
Removes the need to specify the base URL for API calls within the `ChatService` class by utilizing Vite's proxy configuration.

This change streamlines the code and centralizes the base URL configuration in `vite.config.ts`.
It also adds a proxy for the `/slots` endpoint.
Updates the chat form and store to allow sending messages that consist of only attachments without requiring any text content. This prevents the form from being blocked when users only want to send files.
Centralizes and strengthens file type management by using enums for categories, MIME types, and extensions.

This improves code maintainability and type safety when dealing with different file types across the application.
It also enforces a consistent approach for file type detection.
Prevents uploading of unsupported file types to the chat.

Displays an alert message to the user when attempting to upload
unsupported files, informing them about the acceptable file formats.
Only processes supported files, improving the user experience.
Removes the dedicated text file extensions constant and instead relies on the `TextExtension` enum defined within supported file types.

This change improves maintainability and consolidates file type definitions.
Adds the ability to record and send audio messages directly from the chat form.

This includes:
- Implementing audio recording functionality using the MediaRecorder API.
- Providing UI elements (mic button) to control the recording process.
- Converting recorded audio to WAV format for broader compatibility.
- Supporting text files preview.
Enhances user feedback during assistant message generation by displaying real-time processing status, including initialization, preparation, and token generation.

Provides detailed insights like context usage, temperature, and top-p settings, and speculative decoding status to the user.

Introduces a `useProcessingState` hook to manage and track the processing state. It utilizes a polling mechanism via slots service to get processing states.
@allozaur allozaur force-pushed the allozaur/svelte-webui branch from 8cca487 to f02925d Compare August 12, 2025 15:51
Removes excessive console logs used for debugging purposes from the chat service and attachment preview components. These logs are no longer necessary and clutter the console, making it harder to identify relevant information.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an old UI generated artifact. It shouldn't be committed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @olegshulyakov thanks for your contribution. Please withhold with any review comments until the PR is marked as ready for review 😉

"@tailwindcss/vite": "^4.0.0",
"@types/node": "^22",
"@vitest/browser": "^3.2.3",
"bits-ui": "^2.8.11",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you replaced DaisyUI?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose to go with ShadCN for Svelte which uses Bits UI under the hood.

Refactors file upload logic to handle modality support. It now dynamically filters files based on the capabilities of the active model (vision, audio) and displays a detailed error message when incompatible files are selected, preventing unexpected behavior and improving user experience.

- Updates file input to dynamically accept file types based on model capabilities.
- Introduces an alert dialog to inform users about unsupported file types and reasons, with specific messages for both generally unsupported files and modality-related issues.
- Modifies PDF processing to ensure PDF files are processed as text for non-vision models and images for vision models, adapting the setting when necessary.
Implements a SPA fallback route that serves index.html for unmatched routes.

This enables client-side routing for dynamic routes when using embedded static files.
Excludes API routes from the fallback to ensure they are handled by dedicated handlers.
Also includes the required headers by pyodide (python interpreter)

Sets ssr to false in the layout.ts file to disable server-side rendering for the entire application.
This enables client-side rendering for the entire application.

Also refactors code copy function in Markdown component.
Improves the chat sidebar search component by adding a "search" type to the input for better mobile keyboard support and screen reader accessibility.
Also, adds a story to test the focus state of the search input.
Introduces new markdown fixtures for storybook.
Refactors context management by utilizing real-time slot data for
accurate context limit checks, replacing token estimation with
server-side slot information. Introduces a dedicated context service
and enhances error reporting to provide more informative messages
when context limits are exceeded, including the removal of both user
and assistant messages upon context errors.

Additionally, it tweaks the chat form textarea and message UI for better
visual consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants