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

feat: Sender support speech #154

Merged
merged 4 commits into from
Oct 15, 2024
Merged

feat: Sender support speech #154

merged 4 commits into from
Oct 15, 2024

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Oct 15, 2024

Preview

https://speech.x-73x.pages.dev/components/sender-cn#sender-demo-speech

Summary by CodeRabbit

  • 新功能

    • 引入了新的 SpeechButton 组件,支持语音录制状态的图标切换。
    • 新增 RecordingIcon 组件,显示动画录音图标。
    • Sender 组件现在支持语音输入功能,新增 allowSpeech 属性。
    • 新增自定义 React Hook useSpeech,用于管理语音识别功能。
  • 文档

    • 更新了 speech.md 文件,添加了中文和英文的麦克风权限说明。
    • 更新了 Sender 组件的文档,包含新的 allowSpeech 属性说明。
  • 样式

    • 改进了 Sender 组件的样式逻辑,新增加载和录音图标的样式。
  • 修复

    • 更新了 StopLoadingIcon 组件的 SVG <title> 元素,提高可访问性。

Copy link
Contributor

coderabbitai bot commented Oct 15, 2024

📝 Walkthrough

Walkthrough

本次更改涉及多个组件的更新和新功能的添加。StopLoadingIcon 组件的 SVG <title> 元素进行了语义性修改,以提高可访问性。ActionButton 组件的接口新增了与语音相关的属性,并更新了点击处理逻辑。引入了新的 RecordingIconSpeechButton 组件,后者利用上下文管理语音录制状态。此外,文档和样式逻辑也进行了相应更新,以支持新的语音输入功能和样式增强。

Changes

文件路径 更改摘要
components/sender/StopLoading.tsx 更新 SVG <title> 元素为 "Stop Loading"。
components/sender/components/ActionButton.tsx ActionButtonContextPropsActionButtonProps 接口新增与语音相关的属性,更新点击处理逻辑。
components/sender/components/ClearButton.tsx, components/sender/components/LoadingButton.tsx, components/sender/components/SendButton.tsx ClearButtonLoadingButtonSendButton 函数修改为非导出函数,保留功能。
components/sender/components/SpeechButton/RecordingIcon.tsx, components/sender/components/SpeechButton/index.tsx 新增 RecordingIconSpeechButton 组件,后者根据语音录制状态渲染不同图标。
components/sender/demo/speech.md, components/sender/demo/speech.tsx 更新 speech.md 文件以包含中文和英文的麦克风权限部分,新增 Demo 组件。
components/sender/index.en-US.md, components/sender/index.zh-CN.md, components/sender/index.tsx 更新 Sender 组件文档,新增 allowSpeech 属性,集成语音功能。
components/sender/style/index.ts 更新 Sender 组件的样式逻辑,新增 SenderToken 接口和样式生成函数。
components/sender/useSpeech.ts 新增自定义钩子 useSpeech,管理语音识别功能和麦克风权限。

Poem

在兔子窝里欢声笑,
新功能如春花绽放,
语音录制真奇妙,
按钮跳舞乐无穷。
让我们一起欢庆吧!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3f03263 and 391486f.

⛔ Files ignored due to path filters (3)
  • 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
  • components/sender/__tests__/__snapshots__/index.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (14)
  • components/sender/StopLoading.tsx (1 hunks)
  • components/sender/components/ActionButton.tsx (1 hunks)
  • components/sender/components/ClearButton.tsx (1 hunks)
  • components/sender/components/LoadingButton.tsx (1 hunks)
  • components/sender/components/SendButton.tsx (1 hunks)
  • components/sender/components/SpeechButton/RecordingIcon.tsx (1 hunks)
  • components/sender/components/SpeechButton/index.tsx (1 hunks)
  • components/sender/demo/speech.md (1 hunks)
  • components/sender/demo/speech.tsx (1 hunks)
  • components/sender/index.en-US.md (2 hunks)
  • components/sender/index.tsx (7 hunks)
  • components/sender/index.zh-CN.md (2 hunks)
  • components/sender/style/index.ts (1 hunks)
  • components/sender/useSpeech.ts (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

🪧 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 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 Oct 15, 2024

Preview is ready

Copy link

Deploying x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 391486f
Status: ✅  Deploy successful!
Preview URL: https://8fe7e5fb.x-73x.pages.dev
Branch Preview URL: https://speech.x-73x.pages.dev

View logs

@afc163
Copy link
Member

afc163 commented Oct 15, 2024

移动端样式长什么样?

@zombieJ
Copy link
Member Author

zombieJ commented Oct 15, 2024

移动端样式长什么样?

移动端的还没开始搞,PC 和移动端设计是两套东西:

image

@zombieJ zombieJ merged commit f436a50 into main Oct 15, 2024
9 checks passed
@zombieJ zombieJ deleted the speech branch October 15, 2024 06:22
@afc163
Copy link
Member

afc163 commented Nov 25, 2024

没写测试用例。

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