Skip to content

Simplify model config panel - #11187

Open
Sha1rholder wants to merge 12 commits into
AstrBotDevs:masterfrom
Sha1rholder:flatten-config-model-panel
Open

Sha1rholder wants to merge 12 commits into
AstrBotDevs:masterfrom
Sha1rholder:flatten-config-model-panel

Conversation

@Sha1rholder

@Sha1rholder Sha1rholder commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #11175

Changes

  • Edit reasoning effort, temperature, top-p, output limits, and custom request parameters directly in the model dialog. Suggested values stay visible, and empty fields are omitted on save.
  • Move native Gemini 3 and 4 reasoning effort into each model’s settings, with model-specific options.
  • Improve mobile layouts and numeric validation across WebUI settings.
  • Change default Temperature placeholder from 0.6 to 1

Breaking changes

  • Reapply any saved Gemini provider-level Thinking Level in each model’s Reasoning Effort setting.
  • If your OpenAI Responses model sets max_tokens, rename it to max_output_tokens in the custom request parameters.
  • NVIDIA-hosted MiniMax M3 no longer gets an automatic max_tokens fallback. Set it explicitly if needed.

Verification

  • Gemini and dashboard API tests: 194 passed. Dashboard build and i18n checks passed.
  • Full suite: 5,799 passed, 36 skipped, and 9 failed. All 9 failures also reproduced on master in the same environment. (not my duty)

Summary by Sourcery

Move model request-parameter editing into the model configuration dialog and make WebUI configuration editing more consistent and validated.

New Features:

  • Edit model reasoning effort, sampling controls, output limits, and custom request parameters inline in the model configuration dialog, with suggested defaults omitted when left blank.
  • Configure Gemini 3 and 4 reasoning effort per model using model-specific options.

Bug Fixes:

  • Require valid numeric and other form values before saving WebUI configuration across system, provider, platform, and extension settings.
  • Reject Anthropic provider initialization when no API key is configured.
  • Preserve supported Gemini generation parameters and handle requests safely when the Gemini client is closed.

Enhancements:

  • Improve configuration forms for mobile layouts, numeric constraints, empty optional fields, and inline custom parameters.
  • Set the default Temperature suggestion to 1 and use Anthropic's defined default max_tokens when requests omit it.
  • Remove the automatic max_tokens fallback for NVIDIA-hosted MiniMax M3; users must configure a limit when required.
  • Remove Gemini provider-level Thinking Level defaults and hide the legacy setting; reasoning level is now configured per model.

Build:

  • Enable noEmit in the dashboard TypeScript configuration.

Documentation:

  • Update English and Chinese model-configuration and WebUI navigation guides for inline model parameters and per-model Gemini reasoning settings.

Tests:

  • Update Gemini, Anthropic, OpenAI Responses, and dashboard API tests to cover the configuration and provider behavior changes.

Chores:

  • Update English, Japanese, Russian, and Chinese dashboard translations and add bilingual unreleased changelog entries for model configuration changes.

@sourcery-ai

sourcery-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

Checked at commit 20be701

#11175 明确区分未设置的采样参数和界面预设值,防止用户误解 · 2 of 2 met

# Requirement Status Notes
1 Clearly distinguish unset sampling parameters from suggested UI values. ✅ Met Inline fields start empty, show suggested values as placeholders, and remove the parameter when cleared; the docs also explain that blank suggestions are omitted on save.
2 Set the default Temperature suggestion to 1.0. ✅ Met The Temperature template default is 1.0, including the Gemini model configuration.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've found 9 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="dashboard/src/composables/useProviderModelConfigDialog.ts" line_range="143" />
<code_context>

   async function saveEditedProvider() {
     if (!providerEditData.value) return
+    if (providerEditForm.value && !(await providerEditForm.value.validate()).valid) return

     savingProviders.value.push(providerEditData.value.id)
</code_context>
<issue_to_address>
**Pending save targets another model**

When form validation is still pending and the user cancels the dialog and opens another model, `saveEditedProvider` reads `providerEditData` and `providerEditOriginalId` only after the validation await, so a submit that resumes after the dialog is canceled and another model is opened saves the newly opened model instead of the one originally submitted.

Capture the submitted provider data, mode, and target ID before awaiting validation, and prevent dialog switching or duplicate submissions while validation is pending.
</issue_to_address>

### Comment 2
<location path="dashboard/src/components/shared/ConfigNumberInput.vue" line_range="56" />
<code_context>
+function updateValue(value) {
+  numericTemp.value = value ?? ''
+  const number = Number(numericTemp.value)
+  emit('update:modelValue', numericTemp.value === '' ? '' : Number.isFinite(number) ? number : numericTemp.value)
+}
+</script>
</code_context>
<issue_to_address>
**Cleared numeric fields save as empty strings**

When a user clears a numeric field in a regular configuration panel, including an integer or float without a slider or an `AstrBotConfig` outside a validating form, `ConfigNumberInput.updateValue` emits `''`, and `ConfigItemRenderer` forwards it without normalization; because `required` defaults to false and no enclosing form rejects it, generic config edits save an empty string where callers expect a number or the previous numeric fallback.

Normalize cleared numeric values to the previous numeric fallback instead of emitting an empty string for generic configuration fields.

Also at `dashboard/src/components/shared/ConfigItemRenderer.vue:180`.
</issue_to_address>

### Comment 3
<location path="dashboard/src/composables/useProviderModelConfigDialog.ts" line_range="95" />
<code_context>
+      || (editableProvider.provider_source_id ? 'chat_completion' : undefined)
+    if (providerType === 'chat_completion') {
+      // Omitted values still need an editable field when the dialog is reopened.
+      editableProvider.max_context_tokens ??= ''
+    }
+    // Keep model fields together without introducing fields on other provider types.
</code_context>
<issue_to_address>
**Context limit missing during model add**

When `buildModelProviderConfig` returns a chat model without a `max_context_tokens` key, `openModelAddDialog` does not apply the blank-field initialization added to `openProviderEdit`. When `buildModelProviderConfig` omits `max_context_tokens`, `AstrBotConfig` renders only keys present in the editable data, so the new model’s context limit cannot be set until after creation.

Initialize `max_context_tokens` to an editable blank in `openModelAddDialog` for chat-completion providers when the builder omits it.
</issue_to_address>

### Comment 4
<location path="dashboard/tests/objectEditor.test.mjs" line_range="119" />
<code_context>
+  pair._originalKey = pair.key;
+  pair.key = 'temperature';
+  await nextTick();
+  assert.equal(state.nonTemplatePairs.value.length, 1);
+  assert.equal(state.nonTemplatePairs.value[0], pair);
+  assert.equal(props.modelValue.custom, 1);
</code_context>
<issue_to_address>
**Template-key test fails on correct behavior**

When the test adds a key that exists in `template_schema`, when `temperature` is in the template schema, this test's assertion expects one non-template row, but `addKeyValuePair` routes the key through `updateTemplateValue`, which creates a template-bound pair that `nonTemplatePairs` filters out. The test fails before reaching its rename checks.

Assert against the template-bound pair in `localKeyValuePairs`, or use a non-template key for the subsequent rename scenario.
</issue_to_address>

### Comment 5
<location path="dashboard/src/composables/useProviderModelConfigDialog.ts" line_range="48" />
<code_context>
+
+    const extraBody = schema.provider.items.custom_extra_body
+    if (extraBody) {
+      extraBody.render_type = 'inline'
+      for (const [key, constraints] of Object.entries({
+        max_tokens: { min: 1, integer: true },
</code_context>
<issue_to_address>
**Old parameter entry lacks a mapping**

The `custom_extra_body` editor moves from a dialog to inline fields, but the relevant docs and changelog do not map the old entry to the new one, leaving users following previous instructions without a migration path.

Add an old-entry → new-entry mapping for the custom request-body editor to the relevant docs and changelog, and update the WebUI mapping pages if this entry point is in their scope.
</issue_to_address>

### Comment 6
<location path="dashboard/tests/configNumberInput.test.mjs" line_range="1" />
<code_context>
+import assert from 'node:assert/strict';
+import fs from 'node:fs';
+import test from 'node:test';
</code_context>
<issue_to_address>
**New test files are added**

The PR adds four dashboard test files, contrary to the repository rule, so the change leaves generated test files in the repository.

Remove the newly added test files.

Also at `dashboard/tests/objectEditor.test.mjs:1`, `dashboard/tests/providerModelConfigDialog.test.mjs:1`, `dashboard/tests/reasoningEffortInput.test.mjs:1`.
</issue_to_address>

### Comment 7
<location path="dashboard/tests/reasoningEffortInput.test.mjs" line_range="52" />
<code_context>
+
+test('selecting custom preserves the value until edited and never emits the sentinel', async t => {
+	const { state, props, emitted, input } = mountInput(t, 'high');
+	state.selectOption(state.customOption);
+	assert.equal(props.modelValue, 'high');
+	assert.deepEqual(emitted, []);
</code_context>
<issue_to_address>
**Custom selection can stay closed**

When `selectOption(customOption)` does not activate custom mode, when `selectOption(customOption)` fails to activate custom mode, this test still passes: it checks that the model and emissions are unchanged, then directly invokes the text-field handler even though the `v-if` would leave that field unrendered. Users cannot enter a custom value.

Assert that the selection is the custom sentinel immediately after choosing Custom, before invoking the text-field handler.
</issue_to_address>

### Comment 8
<location path="astrbot/core/config/default.py" line_range="2387" />
<code_context>
                                 "name": "Temperature",
                                 "description": "温度参数",
-                                "hint": "控制输出的随机性,范围通常为 0-2。值越高越随机。",
+                                "hint": "控制输出的随机性,范围通常为 0-2,值越高越随机。不推荐手动设置。",
                                 "type": "float",
-                                "default": 0.6,
</code_context>
<issue_to_address>
**Set temperature default**

The issue recommends setting AstrBot's default temperature to 1.0. This change removes the displayed preset and leaves the field without a default, relying instead on the provider's default.
</issue_to_address>

### Comment 9
<location path="dashboard/src/components/shared/ObjectEditor.vue" line_range="229" />
<code_context>
 import { useI18n } from '@/i18n/composables'
 import { useToast } from '@/utils/toast'
 import { useConfigTextResolver } from '@/composables/useConfigTextResolver'
+import ReasoningEffortInput from '../provider/ReasoningEffortInput.vue'

 const { t } = useI18n()
</code_context>
<issue_to_address>
**Shared editor depends on provider UI**

The shared `ObjectEditor` now imports a provider-specific input, so generic configuration editing depends on the provider feature layer. Reusing that editor outside the dashboard’s provider UI also pulls in provider-specific rendering, and future provider-to-shared reuse risks a circular dependency.

Move the reasoning-effort input into the shared layer or inject the specialized renderer through a slot or renderer registry.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 6 findings to address first, and the editor now writes model parameters and context limits into provider configuration, which can change later requests if a value is mishandled. Those saved settings can be corrected by editing the provider configuration, but reverting the code would not restore values already saved.

Blocking findings: dashboard/src/composables/useProviderModelConfigDialog.ts:143, dashboard/src/components/shared/ConfigNumberInput.vue:56, dashboard/src/composables/useProviderModelConfigDialog.ts:95, dashboard/tests/objectEditor.test.mjs:119, dashboard/tests/reasoningEffortInput.test.mjs:52, and 1 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread dashboard/tests/objectEditor.test.mjs Resolved
Comment thread astrbot/core/config/default.py Resolved
@Sha1rholder

Copy link
Copy Markdown
Contributor Author

明天起床再看吧

@Sha1rholder
Sha1rholder marked this pull request as draft November 17, 2026 06:52
@Sha1rholder
Sha1rholder force-pushed the flatten-config-model-panel branch from 43ca0d4 to ce28d5b Compare November 17, 2026 07:31
@Sha1rholder
Sha1rholder marked this pull request as ready for review November 17, 2026 07:34
@Sha1rholder
Sha1rholder marked this pull request as draft November 17, 2026 08:00
@Sha1rholder
Sha1rholder force-pushed the flatten-config-model-panel branch from ce28d5b to b468838 Compare November 17, 2026 15:38
@Sha1rholder Sha1rholder changed the title Flatten model config panel Simplify model config panel Nov 18, 2026
@Sha1rholder
Sha1rholder marked this pull request as ready for review November 18, 2026 06:09
@Sha1rholder
Sha1rholder marked this pull request as draft November 18, 2026 06:31
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
astrbot/core/provider/sources/gemini_source.py 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@Sha1rholder
Sha1rholder marked this pull request as ready for review November 18, 2026 07:44
@Sha1rholder
Sha1rholder force-pushed the flatten-config-model-panel branch from a589d69 to ace8b42 Compare November 18, 2026 08:07
@Sha1rholder

Copy link
Copy Markdown
Contributor Author

@Soulter 开发得有点久,已rebase确认没问题。麻烦佬有空review一下

@Soulter Soulter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi, 根据之前私下讨论的结果,我觉得可以先将 reasoning level 的配置从二级菜单中挪到一级菜单。其他的改动可能还得再考虑一下。

@Sha1rholder
Sha1rholder force-pushed the flatten-config-model-panel branch from ace8b42 to d3a8f4b Compare November 23, 2026 16:07

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

New gaps against the linked issues

Comment thread astrbot/core/config/default.py Resolved
@Sha1rholder

Copy link
Copy Markdown
Contributor Author

@Soulter Done. Also rebased to latest master branch.

image image image

Add reasoning effort presets with custom values, shared numeric inputs
with validation, and reusable config layouts. Remove preset parameter
defaults and update configuration hints and documentation.
Preserve incomplete numeric input for validation and prevent mouse wheel
changes to focused number fields. Replace the number required
translation key with a generic required field message.
Block dashboard saves when configuration fields are invalid and preserve
empty required numeric inputs for validation. Allow optional fields to
be cleared and defer unset Gemini thinking and TTS parameters to
provider defaults.
top-p

Remove sampling and output token presets from the dashboard, keeping
reasoning effort optional. Pass custom Gemini parameters to the SDK and
stop translating max_tokens for OpenAI Responses. Drop the MiniMax M3
token fallback while retaining the default Claude requires.
@Sha1rholder
Sha1rholder marked this pull request as draft November 30, 2026 14:21
@Sha1rholder
Sha1rholder force-pushed the flatten-config-model-panel branch from d3a8f4b to 3ea345b Compare November 30, 2026 14:23
@Sha1rholder Sha1rholder mentioned this pull request Nov 30, 2026
4 of 6 tasks
@Sha1rholder

Copy link
Copy Markdown
Contributor Author

@Soulter @RC-CHN Please have a look. I've dealt with merge conflicts.

@Sha1rholder
Sha1rholder marked this pull request as ready for review November 30, 2026 14:44

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.

明确区分未设置的采样参数和界面预设值,防止用户误解

3 participants