Skip to content

Comments

fix: localize provider source config UI#4933

Merged
Soulter merged 7 commits intoAstrBotDevs:masterfrom
letr007:fix/provider-i18n
Feb 8, 2026
Merged

fix: localize provider source config UI#4933
Soulter merged 7 commits intoAstrBotDevs:masterfrom
letr007:fix/provider-i18n

Conversation

@letr007
Copy link
Contributor

@letr007 letr007 commented Feb 6, 2026

在模型提供商源配置界面中,多处文案未接入 i18n,且 provider 高级配置使用旧元数据导致中英文混杂、语言切换不生效。此改动
统一对 provider 元数据做 i18n 转换并补齐中英文资源,使配置页在中英文环境下正常展示。

Modifications / 改动点

  • 后端:复用 ConfigMetadataI18n 转换 provider 元数据(包含嵌套 items/template_schema),并保持 config_template 不丢
    失。

  • 前端:AstrBotConfig.vue 支持 i18n key 翻译;provider tabs 文案在语言切换时可响应更新;provider source “新增”按钮接入
    i18n。

  • 资源:补齐 provider_group 配置项的中英文翻译,包括 gm_thinking_config / anth_thinking_config 等高级配置项。

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

QQ20260207-022609 QQ20260207-022542

Checklist / 检查清单

  • 😊 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。/ If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
  • 👀 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。/ My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
  • 🤓 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到了 requirements.txtpyproject.toml 文件相应位置。/ I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
  • 😮 我的更改没有引入恶意代码。/ My changes do not introduce malicious code.

Summary by Sourcery

本地化提供方来源配置的元数据和 UI,使后端元数据与前端面板在 i18n 上得到正确支持。

Bug Fixes:

  • 通过将所有标签和选项卡接入 i18n,修复提供方来源配置 UI 中语言混用以及文本不随语言变更而更新的问题。

Enhancements:

  • 扩展后端配置元数据的 i18n 转换能力,以支持嵌套项、模板 schema,并在转换过程中保留各提供方的配置模板。
  • 更新共享配置组件,当元数据的 description 和 hint 字段为 i18n key 时,对其进行翻译。
  • 在 provider sources 组合式逻辑中,使提供方类型选项卡定义对语言变更具有响应性。

Chores:

  • 为提供方配置元数据和与提供方相关的 UI 文本新增并完善 i18n 资源条目,覆盖英文和中文。
Original summary in English

Summary by Sourcery

Localize provider source configuration metadata and UI to correctly support i18n across backend metadata and frontend panels.

Bug Fixes:

  • Fix mixed-language and non-reactive text in provider source configuration UI by wiring all labels and tabs through i18n.

Enhancements:

  • Extend backend config metadata i18n conversion to handle nested items, template schemas, and preserve config templates for providers.
  • Update shared configuration component to translate metadata description and hint fields when they are i18n keys.
  • Make provider type tab definitions reactive to language changes in the provider sources composable.

Chores:

  • Add and complete i18n resource entries for provider configuration metadata and provider-related UI strings in both English and Chinese.

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Feb 6, 2026
@dosubot
Copy link

dosubot bot commented Feb 6, 2026

Related Documentation

Checked 1 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - 我在这里给出了一些总体反馈:

  • convert_to_i18n_keys 中,新的 convert_items 辅助函数只会向下传递选定的键(descriptionhintlabelsnameitemstemplate_schema),并会丢弃 item 字段上的其他自定义属性(例如 optionsslider 或未来可能新增的标志位);建议像之前那样显式将这些已知属性加入白名单并保留它们,以避免悄悄丢失元数据。
  • 现在 providerTypes 是一个 computed 值,需确保所有使用它的地方都把它当作响应式数据来处理(例如在脚本中使用 .value,只在模板中直接使用);或者,如果你实际上不需要它在 JS 层面保持响应式,考虑将其重命名为 providerTypeOptions,并让它作为一个由 computed 翻译映射派生出来的普通数组。
提供给 AI 代理的提示词
Please address the comments from this code review:

## Overall Comments
- In `convert_to_i18n_keys`, the new `convert_items` helper only propagates selected keys (`description`, `hint`, `labels`, `name`, `items`, `template_schema`) and drops any other custom attributes on item fields (e.g. `options`, `slider`, or future flags); consider explicitly whitelisting and preserving those known attributes as was done before to avoid silently losing metadata.
- Now that `providerTypes` is a computed, ensure all its usages treat it as reactive (e.g. `.value` in script, direct use only in templates) or consider renaming it to `providerTypeOptions` and keeping it as a plain array derived from a computed translation map if you don't actually need it to be reactive at the JS level.

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据你的反馈改进之后的评审。
Original comment in English

Hey - I've left some high level feedback:

  • In convert_to_i18n_keys, the new convert_items helper only propagates selected keys (description, hint, labels, name, items, template_schema) and drops any other custom attributes on item fields (e.g. options, slider, or future flags); consider explicitly whitelisting and preserving those known attributes as was done before to avoid silently losing metadata.
  • Now that providerTypes is a computed, ensure all its usages treat it as reactive (e.g. .value in script, direct use only in templates) or consider renaming it to providerTypeOptions and keeping it as a plain array derived from a computed translation map if you don't actually need it to be reactive at the JS level.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `convert_to_i18n_keys`, the new `convert_items` helper only propagates selected keys (`description`, `hint`, `labels`, `name`, `items`, `template_schema`) and drops any other custom attributes on item fields (e.g. `options`, `slider`, or future flags); consider explicitly whitelisting and preserving those known attributes as was done before to avoid silently losing metadata.
- Now that `providerTypes` is a computed, ensure all its usages treat it as reactive (e.g. `.value` in script, direct use only in templates) or consider renaming it to `providerTypeOptions` and keeping it as a plain array derived from a computed translation map if you don't actually need it to be reactive at the JS level.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@dosubot dosubot bot added the area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. label Feb 6, 2026
Copy link
Member

@Soulter Soulter left a comment

Choose a reason for hiding this comment

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

platform 相关的是否也可以一起 i18n

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 7, 2026
@letr007
Copy link
Contributor Author

letr007 commented Feb 7, 2026

platform也有漏网吗,让我看一下

@letr007
Copy link
Contributor Author

letr007 commented Feb 7, 2026

@Soulter 平台消息类别下的各平台名称我没有做更改,若要更改的话有些复杂可能引入未知问题,其次是我认为平台名称本身就是其官方名称,没有再行翻译的必要性
image

@Soulter Soulter merged commit e48950d into AstrBotDevs:master Feb 8, 2026
6 checks passed
united-pooh pushed a commit to united-pooh/AstrBot that referenced this pull request Feb 19, 2026
* fix: localize provider source ui

* feat: localize provider metadata keys

* chore: add provider metadata translations

* chore: format provider i18n changes

* fix: preserve metadata fields in i18n conversion

* fix: internationalize platform config and dialog

* fix: add Weixin official account platform icon

---------

Co-authored-by: Soulter <905617992@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants