Skip to content

fix(web): widen max_tokens number input in LLM settings popover - #18265

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
euvre:fix/agent-max-tokens-input-width
Aug 14, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
euvre:fix/agent-max-tokens-input-width

Conversation

@euvre

@euvre euvre commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Problem

In the Agent component's LLM settings popover, the Max_Tokens number input is too narrow: its width is set via numberInputClassName="w-20" (80px), and because the field row is a flex container (flex items-center gap-4 justify-between, ~254px wide) the default flex-shrink: 1 shrinks the wrapper even further (measured ~53.86px). As a result, large values such as 128000 (the max) are visually truncated.

Fix

Change the Max_Tokens field's numberInputClassName from w-20 to w-24 shrink-0 in web/src/components/llm-setting-items/next.tsx:

  • w-24 widens the input to 96px so 6-digit values fit;
  • shrink-0 prevents the flex parent from shrinking it back down (w-24 alone still computed to ~53.86px).

Verification

Verified in browser against a local instance (agent with model glm-4.6v-Flash):

  • Input wrapper now computes to exactly 96px;
  • 128000 is fully visible (scrollWidth 94 <= clientWidth 94);
  • 7-digit intermediate values (~66px text width) also fit.
Before After
128000 truncated in ~54px input 128000 fully visible in 96px input

The Max_Tokens number input in the agent component's LLM settings
popover used numberInputClassName="w-20" (80px), and its flex parent
(flex items-center gap-4 justify-between) shrank it further via the
default flex-shrink: 1, so 6-digit values like 128000 were truncated.

Widen to w-24 (96px) and add shrink-0 so the input keeps its full
width inside the flex row. Verified in browser: wrapper computes to
exactly 96px and 128000 fits (scrollWidth 94 <= clientWidth 94).
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. 🧰 typescript Pull requests that update Typescript code labels Aug 14, 2026
@euvre
euvre requested a review from wangq8 August 14, 2026 05:41
@euvre euvre added the ci Continue Integration label Aug 14, 2026
@coderabbitai

coderabbitai Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c05ed4e7-e2cb-455c-9280-71ec0ca1622a

📥 Commits

Reviewing files that changed from the base of the PR and between c23d5fc and 7c33ca5.

📒 Files selected for processing (1)
  • web/src/components/llm-setting-items/next.tsx

📝 Walkthrough

Walkthrough

The max-tokens input now uses w-24 shrink-0 instead of w-20.

Changes

Max-tokens input layout

Layer / File(s) Summary
Update max-tokens input sizing
web/src/components/llm-setting-items/next.tsx
The max-tokens input uses a wider fixed width and does not shrink.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 7c33c

This localized change widens the Max_Tokens input and prevents flexbox from shrinking it, allowing large values to remain visible; no actionable merge-blocking risk remains.

Suggested reviewers: cike8899, jinhai-cn

Poem

A rabbit checks the tokens in line,
The input grows by a careful design.
It holds its width, steady and bright,
No shrinking steals its space tonight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: widening the Max_Tokens input and preventing flex shrinking.
Description check ✅ Passed The description explains the problem, fix, affected file, and browser verification, although it does not use the required Summary heading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the fix. The root cause is clear: w-20 (80px) was being flex-shrunk below 80px in the flex items-center gap-4 justify-between row, truncating 6-digit values like 128000.

  • w-24 (96px) plus shrink-0 correctly prevents the flex parent from collapsing the input, and cn (tailwind-merge) lets w-24 override the base w-16.
  • Verified in SliderInputFormField that numberInputClassName is merged last, so the override is effective.
  • No regressions expected — this only affects the max_tokens number input width in the LLM settings popover.

LGTM. (nit) Other SliderInputFormField usages relying on the default w-16/w-20 could hit the same truncation for 5–6 digit values, but that's out of scope here.

@euvre
euvre requested a review from wangq8 August 14, 2026 05:49

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. w-24 (96px) with shrink-0 correctly widens the input and prevents the flex parent from shrinking it back down, so 6-digit values like 128000 are fully visible. Small, targeted change with no regressions.

@wangq8
wangq8 merged commit 5d408d0 into infiniflow:main Aug 14, 2026
12 checks passed
nikminer pushed a commit to nikminer/ragflow-mws that referenced this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files. 🧰 typescript Pull requests that update Typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants