Repository navigation
Simplify model config panel - #11187
Sha1rholder wants to merge 12 commits into
Conversation
Linked issuesChecked at commit 20be701 #11175 明确区分未设置的采样参数和界面预设值,防止用户误解 · 2 of 2 met
|
There was a problem hiding this comment.
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
|
明天起床再看吧 |
43ca0d4 to
ce28d5b
Compare
ce28d5b to
b468838
Compare
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
a589d69 to
ace8b42
Compare
|
@Soulter 开发得有点久,已rebase确认没问题。麻烦佬有空review一下 |
Soulter
left a comment
There was a problem hiding this comment.
Hi, 根据之前私下讨论的结果,我觉得可以先将 reasoning level 的配置从二级菜单中挪到一级菜单。其他的改动可能还得再考虑一下。
ace8b42 to
d3a8f4b
Compare
|
@Soulter Done. Also rebased to latest master branch.
|
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.
restore temperature, top-p, and max-token defaults
d3a8f4b to
3ea345b
Compare



Closes #11175
Changes
Breaking changes
max_tokensfallback. Set it explicitly if needed.Verification
masterin 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:
Bug Fixes:
Enhancements:
Build:
Documentation:
Tests:
Chores: