Skip to content

Conversation

weibaohui
Copy link
Owner

修复yaml apply error

weibaohui added 11 commits July 6, 2025 16:14
添加i18n-jsautotranslate库用于实现页面内容的自动翻译功能
在布局组件中初始化翻译服务并设置DOM更新监听
为退出菜单项添加字体图标
添加语言切换功能组件(暂时注释掉)
初始化时开启office翻译面板和全文提取功能
- 在工具栏中添加语言切换下拉菜单,支持中英文切换
- 调整浮动工具栏右侧间距从40px改为60px
- 移除布局组件中注释掉的代码
- 在ToolBar组件中添加ignore类名避免事件冒泡
- 在App组件中设置默认语言为简体中文
- 移除未使用的LangLink组件
移除硬编码的中文繁体翻译配置,改为从外部文件导入英文翻译配置,提高可维护性
移除注释掉的none和giteeAI通道选项,明确使用client.edge作为翻译通道
将YAML解析逻辑重构为直接解析到map类型,再赋值给Unstructured对象,避免不必要的中间对象创建
Copy link
Contributor

coderabbitai bot commented Jul 7, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

  • 新功能

    • 引入了全新的国际化(i18n)支持,包括自动翻译服务,并新增了语言切换下拉菜单,可在简体中文和英文之间切换界面语言。
    • 新增 I18nTranslateProvider 组件,实现翻译服务的初始化与管理。
  • 界面优化

    • 工具栏新增语言选择下拉菜单,并为退出登录菜单项增加了图标。
    • 调整浮动工具栏在页面右侧的间距,从 40px 增加到 60px。
  • 依赖更新

    • 新增 i18n-jsautotranslate 依赖包以支持自动翻译功能。

Walkthrough

本次更新主要引入了前端国际化能力,通过新增 I18nTranslateProvider 组件并在主布局中挂载,实现了多语言支持。工具栏新增了语言切换下拉菜单。后端部分优化了 YAML 解析逻辑。样式微调了工具栏的右侧边距。依赖项中新增了国际化相关库。

Changes

文件/路径分组 变更摘要
pkg/controller/dynamic/dynamic.go 优化 Save 函数中 YAML 解析方式,先解析到 map 再赋值到 Object 字段。
ui/package.json 新增依赖 i18n-jsautotranslate@^3.17.0
ui/src/components/I18n/I18nTranslateProvider.tsx 新增国际化提供组件,初始化翻译服务,处理多语言切换逻辑。
ui/src/components/ToolBar/index.tsx 工具栏新增语言切换下拉菜单,支持中英文切换,优化用户菜单图标。
ui/src/layout/index.tsx 在主布局中引入并挂载 I18nTranslateProvider
ui/src/styles/global.scss .floating-toolbar-right 右侧距离由 40px 调整为 60px。

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Toolbar
    participant I18nProvider as I18nTranslateProvider
    participant Window

    User->>Toolbar: 点击语言切换菜单
    Toolbar->>Window: 调用 window.translate.changeLanguage
    Window->>I18nProvider: 触发语言切换
    I18nProvider->>Window: 更新页面语言
Loading

Poem

🐇
新增国际化,语言随心换,
工具栏添新颜,地球图标闪。
YAML 解析更严谨,
样式右移二十点。
代码世界多彩斑斓,
兔子为你欢快点赞!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cde41f7 and 89647c9.

⛔ Files ignored due to path filters (1)
  • ui/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • pkg/controller/dynamic/dynamic.go (1 hunks)
  • ui/package.json (1 hunks)
  • ui/src/components/I18n/I18nTranslateProvider.tsx (1 hunks)
  • ui/src/components/ToolBar/index.tsx (2 hunks)
  • ui/src/layout/index.tsx (3 hunks)
  • ui/src/styles/global.scss (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-yaml-apply-error

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@weibaohui weibaohui merged commit 99e3718 into main Jul 7, 2025
4 of 5 checks passed
@weibaohui weibaohui deleted the fix-yaml-apply-error branch July 7, 2025 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant