Repository navigation
fix(models): save a typed provider name with the Save button - #969
Merged
Merged
Conversation
The provider name field kept its value in ProviderDetail's local state, and only the separate Rename button moved the provider in the draft. The footer Save serialized the draft as-is, so a name typed without pressing Rename was silently dropped. The field now edits a draft owned by ModelsConfig. Save applies a pending name through the same path as Rename before writing models.json, so the enabledModels resync still receives the provider rename (and any model renames under the new id). The move itself lives in renameProviderEntry(), which also refuses an id another provider already has instead of letting Object.fromEntries replace that provider; Rename and Save report it. Fixes agegr#903
Owner
|
Reviewed. #903 reproduces on What I checked:
Merged locally with current Generated by Claude Code |
Kano-u
pushed a commit
to Kano-u/pi-web
that referenced
this pull request
Oct 2, 2026
…#907 agegr#941 agegr#946 agegr#961 agegr#968 agegr#969 agegr#1007 agegr#1008 agegr#1009 agegr#1010) 上游已把我们提前摘取的 agegr#884 / agegr#871 / agegr#996 / agegr#961 原样合并(agegr#961 逐字节相同), agegr#967 与 agegr#963 由上游的 agegr#1009 / agegr#1008 接管。 冲突解决: - demo/ 对齐上游 fe288c0,撤销 agegr#963 对 demo 的两处改动(`@/lib/chat-phase-label` 在 demo/lib 下不存在,会打断 Pages 构建)。 - AGENTS.md:保留我们的 default-project 条目,open-folder 换成上游的 open-in-explorer。 - MessageView.tsx / SessionSidebar.tsx / FileExplorer.tsx:以上游为准, DismissButton 采用上游的独立文件,保留我们的思考卡片与文件管理改动。 - SessionSidebar 移除引用已删函数的旧 agegr#951 工作区按钮(agegr#951 的其他入口另行收尾)。
windli2018
pushed a commit
to aiti-ai/aiti-ai
that referenced
this pull request
Nov 6, 2026
The provider name field kept its value in ProviderDetail's local state, and only the separate Rename button moved the provider in the draft. The footer Save serialized the draft as-is, so a name typed without pressing Rename was silently dropped. The field now edits a draft owned by ModelsConfig. Save applies a pending name through the same path as Rename before writing models.json, so the enabledModels resync still receives the provider rename (and any model renames under the new id). The move itself lives in renameProviderEntry(), which also refuses an id another provider already has instead of letting Object.fromEntries replace that provider; Rename and Save report it. Fixes agegr#903
windli2018
pushed a commit
to aiti-ai/aiti-ai
that referenced
this pull request
Nov 8, 2026
The provider name field kept its value in ProviderDetail's local state, and only the separate Rename button moved the provider in the draft. The footer Save serialized the draft as-is, so a name typed without pressing Rename was silently dropped. The field now edits a draft owned by ModelsConfig. Save applies a pending name through the same path as Rename before writing models.json, so the enabledModels resync still receives the provider rename (and any model renames under the new id). The move itself lives in renameProviderEntry(), which also refuses an id another provider already has instead of letting Object.fromEntries replace that provider; Rename and Save report it. Fixes agegr#903
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #903
Problem
In Settings → Models, editing a custom provider's name and clicking the footer Save didn't persist the new name. The name field lived in
ProviderDetail's local state, and only the separate Rename button moved the provider key in the draft.handleSaveserialized the draft as-is.Changes
ModelsConfig. Save applies a pending name through the same path as Rename before writingmodels.json, so theenabledModelsresync still receives the provider rename (and model renames under the new id).renameProviderEntry()helper inmodels-config-helpers.ts. It also refuses a name that another provider already has; previously Rename would silently overwrite that provider. Rename and Save now show amodels.providerNameTakenerror instead (en / zh-CN / zh-TW). This guard goes a little beyond the issue, so I can drop it if you'd prefer a narrower change.Testing
renameProviderEntry, plus a source check that Save applies the pending name (components/ModelsConfig.test.mjs). Source assertions incomponents/EnabledModelsSection.test.mjsare updated to follow the moved code. The new tests fail without the change.node --experimental-strip-types --test lib/i18n/*.test.mjs components/EnabledModelsSection.test.mjs components/ModelsConfig.test.mjs components/SettingsPanel.test.mjs: all pass.tsc --noEmitandeslinton the changed files: clean.next devwith a scratchPI_CODING_AGENT_DIR): renamed a provider in the field, clicked Save without Rename, andmodels.jsoncontained the new name.Note:
demo/components/ModelsConfig.tsxis a hand-copied snapshot and still has the old behaviour. I left it unchanged.