Skip to content

Conversation

@yujonglee
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Jun 4, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

New audio sample conversion utilities were added to the audio-utils crate. The pyannote crate's default feature configuration was changed by removing the "local" feature and updating a dependency version. The workspace and the local-stt plugin added dependencies on hypr-pyannote, hypr-audio-utils, dirs, and hound. The LocalSttPluginExt trait gained an async method for processing WAV files with segmentation and transcription (partially commented out), and a corresponding async ignored test was introduced.

Changes

File(s) Change Summary
Cargo.toml, plugins/local-stt/Cargo.toml Added hypr-pyannote (local path, no features), hypr-audio-utils, dirs, and hound as dependencies.
crates/pyannote/Cargo.toml Removed "local" from default features; changed knf-rs dependency from Git revision to version "0.2.9".
crates/audio-utils/src/lib.rs Added public functions i16_to_f32_samples and f32_to_i16_samples for audio sample format conversions.
plugins/local-stt/src/ext.rs Added async process_wav method to LocalSttPluginExt trait and implementation for segmenting and transcribing WAV files (segmentation and transcription loops commented out).
plugins/local-stt/src/lib.rs Added an async ignored test test_local_stt2 for the new process_wav method.

Sequence Diagram(s)

sequenceDiagram
    participant Test as test_local_stt2
    participant App as Tauri App Instance
    participant Plugin as LocalSttPluginExt
    participant Whisper as Whisper Model
    participant Pyannote as Pyannote Segmenter

    Test->>App: Build app and get plugin
    Test->>Plugin: process_wav(model_path, audio_path)
    Plugin->>Plugin: Read WAV file as i16 samples
    Plugin->>Whisper: Initialize with model_path
    Plugin->>Pyannote: Segment audio samples (16 kHz) [commented out]
    loop For each segment [commented out]
        Plugin->>Plugin: Convert i16 to f32 samples
        Plugin->>Whisper: Transcribe segment
        Whisper-->>Plugin: Transcription result
    end
    Plugin-->>Test: Vec<Word> (recognized words, currently empty)
Loading

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9da8dd0 and 9a07763.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • crates/audio-utils/src/lib.rs (1 hunks)
  • crates/pyannote/Cargo.toml (2 hunks)
  • plugins/local-stt/Cargo.toml (2 hunks)
  • plugins/local-stt/src/ext.rs (3 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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 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.

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

@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: 5

🧹 Nitpick comments (1)
plugins/local-stt/src/ext.rs (1)

190-201: Potential precision loss when converting seconds to milliseconds

(start_sec * 1000.0) as u64 truncates instead of rounding and silently overflows at ≈ 18 M hours. Consider u128::try_from((start_sec * 1000.0).round()) or keep f64 until the UI layer actually needs an integer.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3eadf88 and 9da8dd0.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • Cargo.toml (1 hunks)
  • crates/audio-utils/src/lib.rs (1 hunks)
  • crates/pyannote/Cargo.toml (1 hunks)
  • plugins/local-stt/Cargo.toml (2 hunks)
  • plugins/local-stt/src/ext.rs (3 hunks)
  • plugins/local-stt/src/lib.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{js,ts,tsx,rs}`: 1. No error handling. 2. No unused imports, variables, or functions. 3. For comments, keep it minimal. It should be about "Why", not "What".

**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".

  • plugins/local-stt/src/lib.rs
  • crates/audio-utils/src/lib.rs
  • plugins/local-stt/src/ext.rs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: ci (windows, windows-latest)
  • GitHub Check: ci
  • GitHub Check: ci (macos, macos-latest)
🔇 Additional comments (6)
crates/pyannote/Cargo.toml (1)

7-7: LGTM: Explicit feature management

Removing "local" from default features promotes explicit feature activation, giving downstream consumers better control over enabled functionality.

Cargo.toml (1)

53-53: LGTM: Proper workspace dependency addition

The workspace dependency follows the established pattern and enables proper usage of the pyannote crate across the workspace.

plugins/local-stt/src/lib.rs (1)

122-139:

✅ Verification successful

Verify process_wav method availability

The test structure is well-formed and follows good practices with the #[ignore] annotation. However, ensure that the process_wav method is properly implemented on the app extension trait.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the process_wav method exists in the ext module
# Expected: Find the process_wav method implementation

ast-grep --pattern $'impl $_ for $_ {
  $$$
  async fn process_wav($$$) {
    $$$
  }
  $$$
}'

Length of output: 95


🏁 Script executed:

#!/bin/bash
# Locate all references to `process_wav` in Rust source files
rg -n "process_wav" -A 3 --glob "*.rs"

Length of output: 822


process_wav method confirmed available

The process_wav extension is defined and implemented in plugins/local-stt/src/ext.rs, so the test will compile and run as expected.

• Trait signature: plugins/local-stt/src/ext.rs line 18
• Async implementation: plugins/local-stt/src/ext.rs line 164

No further changes needed—approving the test.

plugins/local-stt/Cargo.toml (3)

27-27: LGTM: Audio utilities dependency

The hypr-audio-utils dependency supports the new audio sample conversion functionality.


32-32: LGTM: Explicit feature activation

The hypr-pyannote dependency with explicit "local" feature aligns with the feature management changes and supports audio segmentation functionality.


41-42: LGTM: Supporting dependencies

Both dirs and hound dependencies are appropriate for the new WAV file processing functionality and path handling in tests.

Comment on lines 179 to 188
let mut segmenter = hypr_pyannote::local::segmentation::Segmenter::new(16000).unwrap();
let segments = segmenter.process(&samples, 16000).unwrap();

let mut words = Vec::new();

for segment in segments {
let audio_f32 = hypr_audio_utils::i16_to_f32_samples(&segment.samples);

let whisper_segments = model.transcribe(&audio_f32).unwrap();

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Multiple unwrap()s hide real processing errors

Segmenter::new, process, and model.transcribe all propagate Results that you discard. If segmentation or Whisper fails you will crash instead of returning a meaningful error to the caller. Replace the three unwrap()s with ? and convert the upstream error into your crate error type.
This also satisfies the repository guideline of not omitting error handling.

🤖 Prompt for AI Agents
In plugins/local-stt/src/ext.rs around lines 179 to 188, the code uses unwrap()
on the results of Segmenter::new, segmenter.process, and model.transcribe, which
causes panics on errors. Replace these unwrap() calls with the ? operator to
propagate errors properly, and convert the upstream errors into your crate's
error type using appropriate From or map_err conversions to ensure meaningful
error handling and compliance with repository guidelines.

@yujonglee yujonglee changed the title Audio batch processing Added process_wav implementation in local-stt plugin Jun 20, 2025
@yujonglee yujonglee merged commit 6bee896 into main Jun 20, 2025
3 of 6 checks passed
@yujonglee yujonglee deleted the audio-batch branch June 20, 2025 06:38
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.

2 participants