Skip to content

app/ui: render chat messages with automatic text direction - #16954

Open
tenderdeve wants to merge 2 commits into
ollama:mainfrom
tenderdeve:feat/16940-rtl-chat-ui
Open

tenderdeve wants to merge 2 commits into
ollama:mainfrom
tenderdeve:feat/16940-rtl-chat-ui

Conversation

@tenderdeve

Copy link
Copy Markdown

Fixes #16940

Assistant and user messages were always rendered left-to-right, so responses in RTL languages (Arabic, Persian, Hebrew, Urdu, Kurdish, ...) came out misaligned and hard to read.

Set dir="auto" on the user message bubble and the assistant markdown container, so the browser determines direction per message from its first strong character. RTL content lays out right-to-left, LTR content is unchanged, and mixed content is handled by the Unicode bidi algorithm. Code blocks are pinned to dir="ltr" so code stays left-aligned inside an RTL message.

No new dependencies. Added tests covering the auto direction on message content and the LTR pin on code blocks.

The qwen3-vl parser always started in the thinking-collection state when
the model supported thinking, ignoring the request's think value. With
think=false the model emits an answer directly with no </think> tag, so
the parser kept treating every token as reasoning and never produced
content, ending in finish_reason=length.

Pass the think value through to setInitialState and start in the content
state when thinking is disabled, matching the qwen3.5 and deepseek3
parsers.

Fixes ollama#16945
Assistant and user messages were always laid out left-to-right, so
responses in RTL languages (Arabic, Persian, Hebrew, Urdu, ...) were
misaligned and hard to read. Set dir="auto" on the user bubble and the
assistant markdown container so the browser picks direction per message
from its content, while keeping code blocks left-to-right.

Fixes ollama#16940

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native RTL Support for Chat UI (Arabic, Persian, Hebrew & Other Right-to-Left Languages)

1 participant