feat(web): accept K and M suffixes in the context window field

The catalog's context window is now a text field that reads a decimal K or M
suffix — 1M is 1000K, matching how model capacities are quoted — and stores
the plain token count, so settings.yaml and the adapter are unchanged.

A stored count reads back in the shortest form that round-trips: 1000000 as
1M, 256000 as 256K, and 131072 written out, because it is not a whole number
of thousands. The field holds the typed text while its row has focus, since
re-deriving it from the parsed count on every keystroke would rewrite 1000
to 1K mid-word; text that does not parse stays on screen so the save-time
rejection names a row the user can still see and correct.
This commit is contained in:
Yichen Jiang
2026-07-31 14:36:16 +08:00
parent 2701862bf1
commit 935578ed98
10 changed files with 177 additions and 24 deletions

View File

@@ -14,7 +14,7 @@
- paragraph: 填入各提供方的 API 密钥即可使用其模型。
- list:
- listitem:
- text: DeepSeek 已启用
- text: DeepSeek
- button "编辑"
- text: DeepSeek deepseek-official API 密钥
- textbox "API 密钥":
@@ -36,7 +36,9 @@
- textbox "显示名称 1":
- /placeholder: 留空时使用模型 ID
- text: DeepSeek-V4-Pro
- spinbutton "上下文窗口 1": "1000000"
- textbox "上下文窗口 1":
- /placeholder: 1M
- text: 1M
- button "删除模型":
- img
- text: 删除模型
@@ -44,7 +46,9 @@
- textbox "显示名称 2":
- /placeholder: 留空时使用模型 ID
- text: Private Preview
- spinbutton "上下文窗口 2": "131072"
- textbox "上下文窗口 2":
- /placeholder: 1M
- text: "131072"
- button "删除模型":
- img
- text: 删除模型