Skip to content

fix: 为前端的EdgeTTS,Gemini TTS,GSVI TTS(API)适配器添加i18n#5403

Open
Li-shi-ling wants to merge 10 commits intoAstrBotDevs:masterfrom
Li-shi-ling:fix/provider-i18n
Open

fix: 为前端的EdgeTTS,Gemini TTS,GSVI TTS(API)适配器添加i18n#5403
Li-shi-ling wants to merge 10 commits intoAstrBotDevs:masterfrom
Li-shi-ling:fix/provider-i18n

Conversation

@Li-shi-ling
Copy link
Contributor

@Li-shi-ling Li-shi-ling commented Feb 24, 2026

前端的EdgeTTS,Gemini TTS,GSVI TTS(API)缺少i18n文件的注册
这个修改添加了其对应的i18n

Fixed #5390

Modifications / 改动点

修改了
astrbot\core\config\default.py
dashboard\src\i18n\locales\en-US\features\config-metadata.json
dashboard\src\i18n\locales\zh-CN\features\config-metadata.json

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

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

image image image

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.
    没有恶意代码

@auto-assign auto-assign bot requested review from Soulter and anka-afk February 24, 2026 08:30
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 24, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Li-shi-ling, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在解决前端EdgeTTS、Gemini TTS和GSVI TTS(API)适配器缺少国际化支持的问题。通过在后端配置默认文件中添加新的TTS服务配置项,并同步更新前端的多语言配置文件,确保了这些文本转语音服务的配置选项能够以用户选择的语言正确显示和理解。这提升了应用程序的用户体验和可访问性,使得不同语言的用户都能轻松配置和使用这些TTS功能。

Highlights

  • i18n支持: 为前端的EdgeTTS、Gemini TTS和GSVI TTS(API)适配器添加了国际化(i18n)配置,解决了相关配置项在多语言环境下的显示问题。
  • 后端配置更新: 在后端默认配置文件中新增了Gemini TTS、GPT-SoVITS和Edge TTS相关的详细配置项,包括API密钥、模型选择、音色、语速等参数。
  • 前端多语言文件: 更新了前端的英文(en-US)和中文(zh-CN)i18n配置文件,为所有新增的TTS配置项提供了对应的描述和提示信息,并对部分现有中文翻译进行了优化。
Changelog
  • astrbot/core/agent/handoff.py
    • 移除了一个不必要的空行。
  • astrbot/core/config/default.py
    • 新增了Google Gemini TTS的API密钥、基础地址、超时时间、模型、前缀和音色等配置项。
    • 新增了GPT-SoVITS的角色和情感选择配置项。
    • 新增了Edge TTS的音色、语速、音量和音调调节配置项。
  • dashboard/src/i18n/locales/en-US/features/config-metadata.json
    • 添加了Google Gemini TTS、GPT-SoVITS和Edge TTS相关配置项的英文描述和提示。
    • 添加了代理地址(proxy)配置项的英文描述和提示。
  • dashboard/src/i18n/locales/zh-CN/features/config-metadata.json
    • 更新了“Moonshot AI API Key”的描述为中文“Moonshot AI API 密钥”。
    • 将Slack连接模式及其相关配置项(主机、路径、端口)的描述和提示翻译为中文。
    • 添加了Google Gemini TTS、GPT-SoVITS和Edge TTS相关配置项的中文描述和提示。
    • 更新了“ONNX Model Directory”和“Language”的描述和提示为中文。
    • 添加了代理地址(proxy)配置项的中文描述和提示。
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 - 我发现了 1 个问题,并且给出了一些整体层面的反馈:

  • default.py 中新增的配置项描述和提示目前都直接写成了中文;建议保持 default.py 与语言无关(language-neutral),把所有面向用户的文本都移到 i18n JSON 中,这样描述才可以被正确本地化。
  • 新增的一些键,比如 characteremotionratevolumepitch,都比较通用,在共享配置命名空间中可能会有歧义;建议通过前缀或命名空间进行区分(例如 gsvitts_characteredge_tts_rate),以提高清晰度并避免命名冲突。
  • edge-tts-voice 这个键使用了连字符(hyphen),而其他选项使用的是下划线;统一命名规范(例如改为 edge_tts_voice)可以提升各配置字段之间的一致性。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new config item descriptions and hints added in `default.py` are all hardcoded in Chinese; consider keeping `default.py` language-neutral and moving human-facing text entirely into the i18n JSONs so that descriptions can be localized properly.
- Some of the newly added keys like `character`, `emotion`, `rate`, `volume`, and `pitch` are quite generic and may be ambiguous in a shared config namespace; consider prefixing or namespacing them (e.g., `gsvitts_character`, `edge_tts_rate`) for clarity and to avoid collisions.
- The `edge-tts-voice` key uses a hyphen while other options use underscores; aligning the naming convention (e.g., `edge_tts_voice`) would improve consistency across configuration fields.

## Individual Comments

### Comment 1
<location path="astrbot/core/config/default.py" line_range="1537-1541" />
<code_context>
                     },
                 },
                 "items": {
+                    "gemini_tts_api_key": {
+                        "description": "Google Gemini TTS API 密钥",
+                        "type": "string",
+                        "hint": "请在 Google Cloud Console 获取 Gemini TTS API 密钥,用于身份验证和服务调用。",
+                    },
+                    "gemini_tts_api_base": {
</code_context>
<issue_to_address>
**🚨 suggestion (security):** 考虑在配置 schema 中将 Gemini TTS API 密钥标记为机密/敏感字段。

如果配置 schema 支持 `secret` / `is_password`(或类似)的标记,请将 `gemini_tts_api_key` 标记为敏感字段,这样界面可以对其做遮挡显示,降低意外泄露的风险(例如日志或截图中被暴露),并与其他 API 密钥的处理方式保持一致。

```suggestion
                    "gemini_tts_api_key": {
                        "description": "Google Gemini TTS API 密钥",
                        "type": "string",
                        "hint": "请在 Google Cloud Console 获取 Gemini TTS API 密钥,用于身份验证和服务调用。",
                        "secret": True,
                    },
```
</issue_to_address>

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

Hey - I've found 1 issue, and left some high level feedback:

  • The new config item descriptions and hints added in default.py are all hardcoded in Chinese; consider keeping default.py language-neutral and moving human-facing text entirely into the i18n JSONs so that descriptions can be localized properly.
  • Some of the newly added keys like character, emotion, rate, volume, and pitch are quite generic and may be ambiguous in a shared config namespace; consider prefixing or namespacing them (e.g., gsvitts_character, edge_tts_rate) for clarity and to avoid collisions.
  • The edge-tts-voice key uses a hyphen while other options use underscores; aligning the naming convention (e.g., edge_tts_voice) would improve consistency across configuration fields.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new config item descriptions and hints added in `default.py` are all hardcoded in Chinese; consider keeping `default.py` language-neutral and moving human-facing text entirely into the i18n JSONs so that descriptions can be localized properly.
- Some of the newly added keys like `character`, `emotion`, `rate`, `volume`, and `pitch` are quite generic and may be ambiguous in a shared config namespace; consider prefixing or namespacing them (e.g., `gsvitts_character`, `edge_tts_rate`) for clarity and to avoid collisions.
- The `edge-tts-voice` key uses a hyphen while other options use underscores; aligning the naming convention (e.g., `edge_tts_voice`) would improve consistency across configuration fields.

## Individual Comments

### Comment 1
<location path="astrbot/core/config/default.py" line_range="1537-1541" />
<code_context>
                     },
                 },
                 "items": {
+                    "gemini_tts_api_key": {
+                        "description": "Google Gemini TTS API 密钥",
+                        "type": "string",
+                        "hint": "请在 Google Cloud Console 获取 Gemini TTS API 密钥,用于身份验证和服务调用。",
+                    },
+                    "gemini_tts_api_base": {
</code_context>
<issue_to_address>
**🚨 suggestion (security):** Consider marking the Gemini TTS API key as a secret/sensitive field in the config schema.

If the config schema supports a `secret`/`is_password` (or similar) flag, please mark `gemini_tts_api_key` as sensitive so UIs can mask it and reduce the risk of accidental exposure (e.g., in logs or screenshots), consistent with other API keys.

```suggestion
                    "gemini_tts_api_key": {
                        "description": "Google Gemini TTS API 密钥",
                        "type": "string",
                        "hint": "请在 Google Cloud Console 获取 Gemini TTS API 密钥,用于身份验证和服务调用。",
                        "secret": True,
                    },
```
</issue_to_address>

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.

@Li-shi-ling
Copy link
Contributor Author

astrbot/core/agent/handoff.py是被ruff改的!

@dosubot dosubot bot added the area:webui The bug / feature is about webui(dashboard) of astrbot. label Feb 24, 2026
@dosubot
Copy link

dosubot bot commented Feb 24, 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

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

此 PR 为前端的 EdgeTTS、Gemini TTS、GSVI TTS (API) 适配器添加了 i18n 支持,并补充了一些其他配置项的翻译,目标明确,实现清晰。我发现了一个会导致 JSON 解析失败的语法错误,请修复。除此之外,代码看起来不错。

@li-shi-ning
Copy link

Code Review

此 PR 为前端的 EdgeTTS、Gemini TTS、GSVI TTS (API) 适配器添加了 i18n 支持,并补充了一些其他配置项的翻译,目标明确,实现清晰。我发现了一个会导致 JSON 解析失败的语法错误,请修复。除此之外,代码看起来不错。

额,能指出来在哪吗?

@Li-shi-ling
Copy link
Contributor Author

Code Review

此 PR 为前端的 EdgeTTS、Gemini TTS、GSVI TTS (API) 适配器添加了 i18n 支持,并补充了一些其他配置项的翻译,目标明确,实现清晰。我发现了一个会导致 JSON 解析失败的语法错误,请修复。除此之外,代码看起来不错。

我用编译器检查了,没有json格式错误啊

@Li-shi-ling
Copy link
Contributor Author

修改edge-tts-voice为edge_tts_voice后的测试

image

@Li-shi-ling
Copy link
Contributor Author

对于命名空间的问题
需要我去给他们全部加上前缀吗

@Li-shi-ling Li-shi-ling changed the title Feat: 为前端的EdgeTTS,Gemini TTS,GSVI TTS(API)适配器注册i18n fix: 为前端的EdgeTTS,Gemini TTS,GSVI TTS(API)适配器注册i18n Feb 25, 2026
@Li-shi-ling Li-shi-ling changed the title fix: 为前端的EdgeTTS,Gemini TTS,GSVI TTS(API)适配器注册i18n fix: 为前端的EdgeTTS,Gemini TTS,GSVI TTS(API)适配器添加i18n Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:webui The bug / feature is about webui(dashboard) of astrbot. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 前端 azure tts provider_group.provider.proxy 没有做 i18n

2 participants