Skip to content

feat(desktop): accept K/M suffixes in model context-window inputs #5168

Description

@sunrioa

Problem

Desktop context-window inputs require a raw integer token count. In the Add Model dialog, entering common values such as 1000k or 1M is not accepted, and the field reports “Enter a context window” rather than explaining the unsupported format.

To reproduce, open Settings → Models, select a connection that allows adding a model, enter a model ID, enter 1000k or 1M as its context window, and click Add.

Model documentation commonly uses these abbreviations, so expanding them manually is inconvenient. Checked against main commit 10269d3c2c5935618ade5834005b24a99e5b04b9.

Desired outcome

Accept decimal K/M suffixes in both the Add Model dialog and the existing model's context-window editor, while preserving plain integer input:

  • 128000 → 128000
  • 128k / 128K → 128000
  • 1000k / 1m / 1M → 1000000
  • 1.5M → 1500000

Use K = 1,000 and M = 1,000,000, accept surrounding whitespace, and continue storing a positive integer token count. Invalid input should show a format-specific error rather than a required-field error.

Existing saved integer values and runtime context-budget behavior should remain unchanged. Saving while the field is still focused must persist the current value on the first click, and both Desktop inputs should follow the same parsing rules.

Alternatives or workarounds

Enter the expanded integer, for example 1000000 instead of 1M.

Related: #4870 / #4871 add configurable context targets. The open PR includes K/M parsing for CLI input, but does not add this support to the Desktop model settings inputs.

AI assistance: OpenAI Codex inspected the implementation and prepared and submitted this issue at the contributor's request.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions