Skip to content

webui: add responsive chat width option to webui (#18067)#18068

Open
ImadSaddik wants to merge 87 commits into
ggml-org:masterfrom
ImadSaddik:feat/change_chat_screen_width
Open

webui: add responsive chat width option to webui (#18067)#18068
ImadSaddik wants to merge 87 commits into
ggml-org:masterfrom
ImadSaddik:feat/change_chat_screen_width

Conversation

@ImadSaddik
Copy link
Copy Markdown
Contributor

@ImadSaddik ImadSaddik commented Dec 15, 2025

Close #18067

Description

This PR addresses issue #18067 by introducing a "Responsive chat width" option in the Web UI settings.

responsive_chat_width_setting

Currently, the chat interface has a fixed maximum width (48rem), which results in significant unused screen space on large monitors (2K, 4K, ultrawide). This change allows users to opt in to a wider layout that scales better with higher resolutions.

Changes

  1. Added responsiveChatWidth to the settings dialog.
    • Default: false (maintains existing behavior).
    • Enabled: Applies new responsive width classes based on screen size.
  2. Added 3xl (1920px), 4xl (2400px), and 5xl (2880px) breakpoints in app.css to target high-resolution displays specifically.
  3. Updated the following components to respect the new setting:
    • ChatScreen
    • ChatMessages
    • ChatMessageAssistant
    • ChatForm
    • ChatProcessingInfo
  4. The specific width values in MAX_WIDTH_CLASSES are a starting point. I am happy to adjust them if the layout feels too wide or too narrow on specific screens.

Screenshots

Captured on a 2K display.

Before After
image image

Captured on a 1K display.

Before After
image image

How to Test

  1. Go to Settings > General.
  2. Toggle Responsive chat width to "On".
  3. Resize the window or view on a large screen (1080p+) to see the layout expand.

Motivation

On 2K and 4K screens, the previous fixed width used only a small percentage of the available viewport (~30% on 2K and ~20% on 4K)

Edit: I will continue working on this in the next weekend.

@ImadSaddik
Copy link
Copy Markdown
Contributor Author

ImadSaddik commented Dec 20, 2025

@avidwriter @allozaur @ServeurpersoCom

I finally found time to finish this feature. Here are the changes I made to the first version. I need your feedback before I write the e2e tests.

We now have two options:

  • Automatic width.
  • Custom width.

When Automatic width is checked, the custom field is disabled.

image

When Automatic width is not checked, the custom field is enabled and the app defaults to 48rem.

If you open the dropdown, you will find two types of options:

  • Predefined widths.
  • A Set pixel value option.
image

Selecting a predefined width is simple. If the user selects Set pixel value, an input field appears below the dropdown. They can type a number between 300 and, 10000.

Note

If the Set pixel value is greater than the user's screen width that won't cause the app to show a horizontal scroll because I am using max-width.

image

Does this make sense? I’m happy to hear your feedback.

@ImadSaddik
Copy link
Copy Markdown
Contributor Author

ImadSaddik commented Mar 15, 2026

Yes, in automatic mode, everything is fully responsive!

I keep discovering new things every time I look at the code 😅. I checked the interface on the master branch and noticed that the user message width is always set to 80%, while the AI message is 100%. That confused me at first because I was not sure if it was a problem in my branch, but I confirmed it is the default behavior.

Now that the custom mode is removed, the code is much simpler and easier to review.

I also found and fixed a bug in agentic mode.

image

Here is how the content looks after the fix:

image

@ServeurpersoCom
Copy link
Copy Markdown
Contributor

Since the "responsive" option works equally well whether enabled or disabled on a smartphone and a PC, I would personally enable it by default all the time (with the front-end default configuration JSON feature that I have to improve), but being able to disable it is also good because short lines are easier to read

@ServeurpersoCom
Copy link
Copy Markdown
Contributor

So maybe (@allozaur would have to confirm too) we can have just 2 options, responsive for everything, and responsive for the CoT and Thinking sections?

@ImadSaddik
Copy link
Copy Markdown
Contributor Author

@allozaur @ServeurpersoCom Do I need to include the build artifacts?

The PR is ready for review.

@ImadSaddik
Copy link
Copy Markdown
Contributor Author

ImadSaddik commented May 10, 2026

I have also noticed a few bugs while testing the app.

Duplicate PDF files in the dropdown.

image

Selecting individual tools is not possible

image

When you close the overlay, everything is deselected.

image

I wanted to mention these issues here so that I don't forget. I can create issues if you are not already working on fixing them.

@ServeurpersoCom
Copy link
Copy Markdown
Contributor

ServeurpersoCom commented May 10, 2026

@allozaur @ServeurpersoCom Do I need to include the build artifacts?

The PR is ready for review.

Yes, we add a commit "chore: update webui build output" at the end, in which you have "tools/server/public/bundle.js"

I always do the following:

cd tools/server/webui
npm run format
npm run lint
npm run check
npm run build

Good catch on the menu bugs. There's also a parasitic "-" inside the checkbox if you look closely (requires an MCP server configured to be seen) another PR to simplify the logic of this menu (KISS) is needed. I opened a ticket so I wouldn't forget : #22895

@allozaur
Copy link
Copy Markdown
Contributor

Btw soon we won't need the static builds in the source anymore

@ServeurpersoCom
Copy link
Copy Markdown
Contributor

Btw soon we won't need the static builds in the source anymore

That's great news!

@allozaur
Copy link
Copy Markdown
Contributor

@ImadSaddik let's come back to this after we've merged #22937 as this will get us free from any potential merge conflicts thanks to removing the static output

@ImadSaddik
Copy link
Copy Markdown
Contributor Author

@allozaur I will keep an eye on that PR and update this one accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to adjust the width of the main chat DIV on desktop

5 participants