Expose context window size in model settings

Move the ctx_length control for main and utility model slots above the Advanced disclosure while keeping embeddings excluded. Add a static regression guard so primary context controls stay visible outside Advanced.

Alessandro committed Jun 23, 2026 at 20:07 UTC 3fae1f49e7d3657ad2a259afb4ad21556a3db080
2 files changed +17 -14
plugins/_model_config/webui/model-field.html
+13 -13
@@ -141,6 +141,19 @@
141 </div>
142 </template>
143
144 + <!-- Context window size (main and utility only) -->
145 + <template x-if="modelType !== 'embedding'">
146 + <div class="field">
147 + <div class="field-label">
148 + <div class="field-title">Context window size</div>
149 + <div class="field-description">Maximum number of tokens in the context window. System prompt, chat history, RAG and response all count towards this limit.</div>
150 + </div>
151 + <div class="field-control">
152 + <input type="number" x-model.number="model.ctx_length" />
153 + </div>
154 + </div>
155 + </template>
156 +
157 <!-- Advanced Settings (collapsed by default) -->
158 <div class="advanced-section" x-data="{ advOpen: false }">
159 <div class="advanced-toggle" @click="advOpen = !advOpen">
@@ -162,19 +175,6 @@
175 </div>
176 </div>
177
165 - <!-- Context length (not for embedding) -->
166 - <template x-if="modelType !== 'embedding'">
167 - <div class="field">
168 - <div class="field-label">
169 - <div class="field-title">Context length</div>
170 - <div class="field-description">Maximum number of tokens in the context window. System prompt, chat history, RAG and response all count towards this limit.</div>
171 - </div>
172 - <div class="field-control">
173 - <input type="number" x-model.number="model.ctx_length" />
174 - </div>
175 - </div>
176 - </template>
177 -
178 <!-- Chat-specific: ctx_history, max_embeds -->
179 <template x-if="modelType === 'chat'">
180 <div>
tests/test_model_config_api_keys.py
+4 -1
@@ -222,16 +222,19 @@ def test_model_config_provider_switch_resets_custom_api_base():
222 assert '@change="model.api_base = \'\'"' in provider_select
223
224
225 -def test_model_config_vision_toggle_is_outside_advanced_settings():
225 +def test_model_config_primary_context_controls_are_outside_advanced_settings():
226 model_field_path = PROJECT_ROOT / "plugins" / "_model_config" / "webui" / "model-field.html"
227 content = model_field_path.read_text(encoding="utf-8")
228
229 vision_start = content.index('<div class="field-title">Supports Vision</div>')
230 + context_size_start = content.index('<div class="field-title">Context window size</div>')
231 advanced_start = content.index("<!-- Advanced Settings (collapsed by default) -->")
232 max_embeds_start = content.index('<div class="field-title">Max embeds</div>')
233
234 assert content.count('<div class="field-title">Supports Vision</div>') == 1
235 + assert content.count('<div class="field-title">Context window size</div>') == 1
236 assert vision_start < advanced_start
237 + assert context_size_start < advanced_start
238 assert advanced_start < max_embeds_start
239
240