Skip to content

Fix noto sans cyrillic#8015

Open
Midwich wants to merge 1 commit intoAstrBotDevs:masterfrom
Midwich:fix-noto-sans-cyrillic
Open

Fix noto sans cyrillic#8015
Midwich wants to merge 1 commit intoAstrBotDevs:masterfrom
Midwich:fix-noto-sans-cyrillic

Conversation

@Midwich
Copy link
Copy Markdown
Contributor

@Midwich Midwich commented May 5, 2026

The WebUI currently loads Noto Sans SC (Simplified Chinese variant) from Google Fonts, which does not include Cyrillic glyphs. As a result, Russian text falls back to the system sans-serif, causing inconsistent and often poor rendering depending on the user's OS.

This change ensures Cyrillic text renders correctly while preserving optimal CJK text rendering.

Modifications / 改动点

  • index.html: Added family=Noto+Sans to the Google Fonts URL (loaded alongside existing Noto+Sans+SC)

  • _variables.scss: Added 'Noto Sans' at the end of $cjk-sans-fallback so Chinese text still prefers system CJK fonts first, while Cyrillic text falls through to Noto Sans

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

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

Verified locally: Russian text in WebUI now renders with Noto Sans instead of system fallback.


Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 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.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Improve dashboard font support for Cyrillic text and extend default web search configuration keys.

Bug Fixes:

  • Ensure the WebUI loads a base Noto Sans font to correctly render Cyrillic characters instead of falling back to system sans-serif.

Enhancements:

  • Extend the CJK sans-serif fallback stack to include Noto Sans while preserving preferred system CJK fonts.
  • Add a default configuration entry for the Firecrawl web search API key.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. area:webui The bug / feature is about webui(dashboard) of astrbot. labels May 5, 2026
Copy link
Copy Markdown
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 - I've left some high level feedback:

  • Since Noto Sans is now loaded with a full 100–900 weight range, consider whether all those weights are actually used in the dashboard to avoid unnecessary font payload and reduce page load overhead.
  • You added websearch_firecrawl_key as a list default in the config; double-check that the rest of the code handling this key expects a list (not a string or single token) to avoid type mismatches at runtime.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Since `Noto Sans` is now loaded with a full 100–900 weight range, consider whether all those weights are actually used in the dashboard to avoid unnecessary font payload and reduce page load overhead.
- You added `websearch_firecrawl_key` as a list default in the config; double-check that the rest of the code handling this key expects a list (not a string or single token) to avoid type mismatches at runtime.

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.

Copy link
Copy Markdown
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

This pull request introduces a new configuration key for Firecrawl web search and updates the dashboard's font configuration to include 'Noto Sans'. Feedback indicates that the Firecrawl addition is out of scope for this PR and lacks required unit tests. Additionally, there is a recommendation to include 'Noto Sans SC' in the CJK font fallback list to ensure the loaded webfont is correctly utilized when local system fonts are missing.

Comment thread astrbot/core/config/default.py Outdated
"websearch_bocha_key": [],
"websearch_brave_key": [],
"websearch_baidu_app_builder_key": "",
"websearch_firecrawl_key": [],
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.

medium

This change appears to be unrelated to the PR's objective of fixing Cyrillic fonts. It adds a configuration key for Firecrawl web search, which should ideally be handled in a separate pull request to maintain a clean and focused commit history. Additionally, per repository guidelines, new functionality should be accompanied by corresponding unit tests.

References
  1. New functionality, such as handling attachments, should be accompanied by corresponding unit tests.

Comment thread dashboard/src/scss/_variables.scss Outdated
$font-size-root: 1rem;
$border-radius-root: 8px;
$cjk-sans-fallback: 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei' !default;
$cjk-sans-fallback: 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei', 'Noto Sans' !default;
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.

medium

The Google Font loaded in index.html is Noto Sans SC, but the fallback list uses Noto Sans CJK SC. While the latter is a common local font name, the webfont will not be used as a fallback unless 'Noto Sans SC' is explicitly included in the list. Consider adding it after the system fonts to ensure the Chinese webfont works as intended when local CJK fonts are missing.

$cjk-sans-fallback: 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei', 'Noto Sans SC', 'Noto Sans' !default;

@Midwich Midwich force-pushed the fix-noto-sans-cyrillic branch from 5774f53 to d120beb Compare May 5, 2026 08:39
The WebUI only loaded Noto Sans SC (Simplified Chinese), which lacks
Cyrillic glyphs. Russian text fell back to system sans-serif, causing
poor rendering depending on the OS.

Changes:
- Load Noto Sans (regular) from Google Fonts alongside Noto Sans SC
- Add 'Noto Sans' at the END of $cjk-sans-fallback (after CJK fonts)
  so Chinese text still renders with system CJK fonts first,
  while Cyrillic text falls through to Noto Sans.

This ensures both Chinese and Cyrillic text render correctly.
@Midwich Midwich force-pushed the fix-noto-sans-cyrillic branch from d120beb to 4a0c3e3 Compare May 5, 2026 08:43
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:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant