Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Sender with actions missing SpeechButton #549

Merged
merged 3 commits into from
Feb 21, 2025
Merged

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Feb 21, 2025

修复 Sender 的 actions 缺少 SpeechButton 组件的问题。

Summary by CodeRabbit

  • 新特性
    • 在发送界面中新增了语音按钮,与现有的操作按钮一起显示,方便用户使用语音输入功能。
    • 语音功能在特定条件下启用,增强了交互体验,用户可在消息发送过程中选择语音输入。

Copy link
Contributor

coderabbitai bot commented Feb 21, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • components/sender/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • components/sender/__tests__/__snapshots__/demo.test.ts.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

本次改动在 sender 模块中新增了 SpeechButton 组件,扩展了两个主要组件。在 Demo 组件中,SpeechButton 被加入到原有的 SendButtonLoadingButtonClearButton 之间,并在 Space 组件内渲染;在 ForwardSender 组件中,ActionsRender 类型更新包含了 SpeechButton,并在 allowSpeech 为 true 时条件渲染该按钮。整个改动仅涉及 UI 组件的集成,控制流与状态管理未做改动。

Changes

File(s) Change Summary
components/sender/demo/…/actions.tsx 在 Demo 组件中新增 SpeechButton,与其他按钮(SendButton、LoadingButton、ClearButton)一起渲染。
components/sender/…/index.tsx 更新 ActionsRender 类型,加入 SpeechButton;在 ForwardSender 中根据 allowSpeech 条件渲染该按钮。

Sequence Diagram(s)

sequenceDiagram
    participant User as 用户
    participant Demo as Demo组件
    participant ActionPanel as 按钮区容器
    participant SpeechButton as SpeechButton组件
    participant Sender as ForwardSender组件

    User->>Demo: 加载并展示动作面板
    Demo->>ActionPanel: 传递按钮组件(Send, Loading, Clear, Speech)
    ActionPanel->>SpeechButton: 渲染 SpeechButton(当允许语音时)
    User->>SpeechButton: 点击 Speech 按钮
    SpeechButton->>Sender: 触发语音输入逻辑
    Sender-->>SpeechButton: 返回处理结果
Loading

Poem

我是草地上跳跃的小兔子,
看着新按钮闪耀着诗意的光辉,
语音随风,心声随影,
一按之间梦想传递无限可能,
欢庆代码更新,跃动心中欢喜!


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

Copy link

github-actions bot commented Feb 21, 2025

Preview is ready

Copy link

codecov bot commented Feb 21, 2025

Bundle Report

Bundle size has no change ✅

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
components/sender/index.tsx (1)

346-348: 语音功能状态管理完善

语音按钮的状态管理逻辑完整,包括:

  • 禁用状态控制
  • 录音状态同步
  • 触发回调处理

建议添加错误处理逻辑。

 onSpeech: () => triggerSpeech(false),
 onSpeechDisabled: !speechPermission,
 speechRecording,
+onSpeechError: (error: Error) => {
+  console.error('Speech recognition error:', error);
+  // 可以在这里添加用户提示
+},
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ba911ce and 601347a.

⛔ Files ignored due to path filters (2)
  • components/sender/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • components/sender/__tests__/__snapshots__/demo.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • components/sender/demo/actions.tsx (1 hunks)
  • components/sender/index.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: test / react component workflow
  • GitHub Check: build preview
  • GitHub Check: size
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: test / react component workflow
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
components/sender/demo/actions.tsx (1)

38-38: 新增语音按钮组件集成

SpeechButton 组件已正确集成到操作按钮中。按钮布局合理,位于清除按钮和发送按钮之间。

Also applies to: 46-46

components/sender/index.tsx (3)

36-36: 类型定义更新完善

ActionsRender 接口中已正确添加 SpeechButton 组件类型定义。


261-264: 语音按钮条件渲染逻辑合理

语音按钮的条件渲染逻辑正确,仅在 allowSpeech 为真时显示。按钮布局合理,位于加载/发送按钮之前。


274-274: 组件导出更新完整

SpeechButton 已正确添加到自定义 actions 的组件列表中,确保用户可以在自定义渲染时使用该组件。

Copy link

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 601347a
Status: ✅  Deploy successful!
Preview URL: https://56b764ca.ant-design-x.pages.dev
Branch Preview URL: https://fix-miss-speech.ant-design-x.pages.dev

View logs

Copy link

github-actions bot commented Feb 21, 2025

size-limit report 📦

Path Size
dist/antdx.min.js 40.3 KB (-51 B 🔽)

Copy link

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 90ddf92
Status:⚡️  Build in progress...

View logs

Copy link

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 90ddf92
Status: ✅  Deploy successful!
Preview URL: https://8ca67df8.ant-design-x.pages.dev
Branch Preview URL: https://fix-miss-speech.ant-design-x.pages.dev

View logs

Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.79%. Comparing base (ba911ce) to head (90ddf92).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #549   +/-   ##
=======================================
  Coverage   91.79%   91.79%           
=======================================
  Files          67       67           
  Lines        1463     1463           
  Branches      385      386    +1     
=======================================
  Hits         1343     1343           
  Misses        120      120           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zombieJ zombieJ merged commit 511bb80 into main Feb 21, 2025
15 checks passed
@zombieJ zombieJ deleted the fix-miss-speech branch February 21, 2025 07:13
@addingtonbear
Copy link

great work!

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.

4 participants