From 35e8e1097986530bf55f2e566bb72fa29df58a5e Mon Sep 17 00:00:00 2001 From: Armin Sander Date: Tue, 19 May 2026 05:47:46 +0200 Subject: [PATCH] Harper Spellcheck --- .harper-dictionary.txt | 6 ++++++ Cargo.toml | 2 +- audio-knife/src/app_error.rs | 2 +- audio-knife/src/event_scheduler.rs | 8 ++++---- audio-knife/src/main.rs | 2 +- audio-knife/src/mod_audio_fork.rs | 2 +- audio-knife/src/server_event_router.rs | 2 +- core/src/billing_collector.rs | 6 +++--- core/src/conversation.rs | 2 +- core/src/lib.rs | 8 ++++---- core/src/registry.rs | 2 +- core/src/service.rs | 2 +- external/openai-api-rs | 2 +- filter-test/src/main.rs | 2 +- services/aristech/src/synthesize.rs | 2 +- services/azure/src/synthesize.rs | 2 +- services/elevenlabs/src/transcribe.rs | 2 +- src/protocol.rs | 2 +- 18 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 .harper-dictionary.txt diff --git a/.harper-dictionary.txt b/.harper-dictionary.txt new file mode 100644 index 0000000..aaac240 --- /dev/null +++ b/.harper-dictionary.txt @@ -0,0 +1,6 @@ +BCP +ContextSwitch +FreeSWITCH +Inband +seekable +subtag diff --git a/Cargo.toml b/Cargo.toml index d863b0a..f7d43a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ tokio = { workspace = true } async-trait = { workspace = true } tracing-futures = "0.2.5" -# todo: is this needed? +# TODO: Is this needed? uuid = { workspace = true } # audio tracing diff --git a/audio-knife/src/app_error.rs b/audio-knife/src/app_error.rs index 6814243..3c4b10e 100644 --- a/audio-knife/src/app_error.rs +++ b/audio-knife/src/app_error.rs @@ -8,7 +8,7 @@ use axum::{ #[allow(unused)] pub struct AppError(anyhow::Error); -// Tell axum how to convert `AppError` into a response. +// Tell Axum how to convert `AppError` into a response. impl IntoResponse for AppError { fn into_response(self) -> Response { (StatusCode::BAD_REQUEST, self.0.to_string()).into_response() diff --git a/audio-knife/src/event_scheduler.rs b/audio-knife/src/event_scheduler.rs index 01c719b..c18b644 100644 --- a/audio-knife/src/event_scheduler.rs +++ b/audio-knife/src/event_scheduler.rs @@ -23,7 +23,7 @@ use context_switch::{AudioFormat, OutputModality, OutputPath, ServerEvent}; /// Runs an event scheduler that manages the timing of events sent to FreeSWITCH. /// -/// This delays audio pakets if more than 5 seconds are pending, and control pakets if currently +/// This delays audio packets if more than 5 seconds are pending, and control packets if currently /// audio is being assumed to be played back. pub async fn event_scheduler( mut receiver: UnboundedReceiver, @@ -60,7 +60,7 @@ pub async fn event_scheduler( } // Control path events are sent out immediately. sender.send(event).context("Sending control event")?; - // Even though only a control event was short circuited we need to kick the the + // Even though only a control event was short circuited we need to kick the // media scheduler. } OutputPath::Media => { @@ -102,7 +102,7 @@ impl MediaEventScheduler { } } - /// TODO: There could be situation in which ... when there is a conversation crossover ... the + /// TODO: There could be situation in which … when there is a conversation crossover … the /// started event was not sent yet when we received audio here. In this case, we have to ignore /// the audio and warn about it. pub fn notify_started(&mut self, modalities: &[OutputModality]) -> Result<()> { @@ -119,7 +119,7 @@ impl MediaEventScheduler { if let ServerEvent::ClearAudio { .. } = event { self.input_media_events .retain(|e| !matches!(e, ServerEvent::Audio { .. })); - // All the non-audio event before `ClearAudio` must be sent asap, too. + // All the non-audio event before `ClearAudio` must be sent as soon as possible, too. self.audio_finished = now; self.timed_events.iter_mut().for_each(|(t, _)| *t = now); } diff --git a/audio-knife/src/main.rs b/audio-knife/src/main.rs index 144dc18..e36d385 100644 --- a/audio-knife/src/main.rs +++ b/audio-knife/src/main.rs @@ -132,7 +132,7 @@ async fn main() -> Result<()> { ) .with_state(state); - // IMPORTANT: attempt to set TCP_NODELAY on every incoming connection. + // IMPORTANT: attempt to set `TCP_NODELAY` on every incoming connection. // We need to disable the Nagle algorithm to properly support low latency // live streaming small audio packets. let listener = TcpListener::bind(addr).await?.tap_io(|tcp_stream| { diff --git a/audio-knife/src/mod_audio_fork.rs b/audio-knife/src/mod_audio_fork.rs index a6928bc..48495b9 100644 --- a/audio-knife/src/mod_audio_fork.rs +++ b/audio-knife/src/mod_audio_fork.rs @@ -1,4 +1,4 @@ -//! mod_audio_fork specific types and audio processing. +//! `mod_audio_fork` specific types and audio processing. use anyhow::Result; use axum::extract::ws::{Message, WebSocket}; diff --git a/audio-knife/src/server_event_router.rs b/audio-knife/src/server_event_router.rs index afbad93..f8e7284 100644 --- a/audio-knife/src/server_event_router.rs +++ b/audio-knife/src/server_event_router.rs @@ -1,7 +1,7 @@ //! A component that routes server events that are received from ContextSwitch to multiple //! conversation targets. //! -//! Conceptually, this is similar to a reverse proxy. +//! Conceptually this is similar to a reverse proxy. use std::collections::{HashMap, hash_map::Entry}; use anyhow::{Context, Result, bail}; diff --git a/core/src/billing_collector.rs b/core/src/billing_collector.rs index 0e97bd9..31178cf 100644 --- a/core/src/billing_collector.rs +++ b/core/src/billing_collector.rs @@ -12,13 +12,13 @@ pub struct BillingRecords { records: Vec, } -/// Type definition for the inner HashMap key in BillingCollector -/// Contains (service, scope, name) +/// Type definition for the inner `HashMap` key in `BillingCollector` +/// Contains `(service, scope, name)` type BillingRecordKey = (String, Option, String); #[derive(Debug, Default)] pub struct BillingCollector { - /// The inner HashMap uses (service, scope, name) as the key and stores the BillingRecordValue. + /// The inner `HashMap` uses `(service, scope, name)` as the key and stores the `BillingRecordValue`. /// The scope is optional. records: HashMap>, } diff --git a/core/src/conversation.rs b/core/src/conversation.rs index e341021..038ca60 100644 --- a/core/src/conversation.rs +++ b/core/src/conversation.rs @@ -207,7 +207,7 @@ impl ConversationInput { } } -// For billing, or other purposes, it's very convenient the the output can be cloned. See +// For billing, or other purposes, it's very convenient the output can be cloned. See // azure-transcribe for example. #[derive(Debug, Clone)] pub struct ConversationOutput { diff --git a/core/src/lib.rs b/core/src/lib.rs index 48e3ff8..1e0b9c7 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -108,9 +108,9 @@ impl AudioConsumer { } } -// TODO: This might be overengineered, we probably are fine with Sender and -// Receiver without checking the format for which I guess the receiver is actually -// responsible, _and_ it might even ok for the receiver to receive different audio formats, e.g. in +// TODO: This might be overengineered, we probably are fine with `Sender` and +// `Receiver` without checking the format for which I guess the receiver is actually +// responsible, _and_ it might even okay for the receiver to receive different audio formats, e.g. in // low QoS situations? #[derive(Debug)] pub struct AudioProducer { @@ -132,7 +132,7 @@ impl AudioProducer { } } -/// Create an unidirectional audio channel. +/// Create a unidirectional audio channel. pub fn audio_channel(format: AudioFormat) -> (AudioProducer, AudioConsumer) { let (producer, consumer) = mpsc::unbounded_channel(); ( diff --git a/core/src/registry.rs b/core/src/registry.rs index e60721a..007559f 100644 --- a/core/src/registry.rs +++ b/core/src/registry.rs @@ -38,7 +38,7 @@ impl Registry { } } -/// We wrap the service to able to do Params deserialization. +/// We wrap the service to able to do Parameters deserialization. #[async_trait] pub trait WrappedService: fmt::Debug { async fn converse(&self, params: Value, conversation: Conversation) -> Result<()>; diff --git a/core/src/service.rs b/core/src/service.rs index 553f6b8..5fa9263 100644 --- a/core/src/service.rs +++ b/core/src/service.rs @@ -6,7 +6,7 @@ //! handling and lifetime. //! //! ADR: Output is provided through a channel. Compared to async streams, this simplifies the -//! implementation and does not couple the straem production code to the receiver. +//! implementation and does not couple the stream production code to the receiver. //! //! ADR: Asynchronous stopping of a conversation done by dropping the input channel. After that, //! more output may be supplied (say for example intermediate recognized text). diff --git a/external/openai-api-rs b/external/openai-api-rs index c706d6c..1a01cb7 160000 --- a/external/openai-api-rs +++ b/external/openai-api-rs @@ -1 +1 @@ -Subproject commit c706d6c99b4ec987e4d148b53d7ef441c23e8c15 +Subproject commit 1a01cb754bf9d5e62453345fbd482b6afa263436 diff --git a/filter-test/src/main.rs b/filter-test/src/main.rs index 71c40d8..1ec3c72 100644 --- a/filter-test/src/main.rs +++ b/filter-test/src/main.rs @@ -26,7 +26,7 @@ struct Args { inputs: Vec, /// Threshold for the speech gate (0.0 - 1.0) - /// Higher values (0.1-0.2) provide more aggressive noise reduction + /// Higher values `(0.1-0.2)` provide more aggressive noise reduction /// A value of 0.05 provides balanced noise reduction for most audio #[arg(short, long, default_value = "0.05")] threshold: f32, diff --git a/services/aristech/src/synthesize.rs b/services/aristech/src/synthesize.rs index e786bcd..2820c29 100644 --- a/services/aristech/src/synthesize.rs +++ b/services/aristech/src/synthesize.rs @@ -36,7 +36,7 @@ impl Service for AristechSynthesize { conversation.require_text_input_only()?; let output_format = conversation.require_single_audio_output()?; - // Resolve default voice if none is set + // Resolve to default voice if none is set // TODO: Add the possibility to determine this from a language parameter and the // `get_voices` function if no voice_id is provided. let voice = params.voice.unwrap_or_else(|| "anne_de_DE".to_string()); diff --git a/services/azure/src/synthesize.rs b/services/azure/src/synthesize.rs index d54e58c..3d56163 100644 --- a/services/azure/src/synthesize.rs +++ b/services/azure/src/synthesize.rs @@ -222,7 +222,7 @@ enum BillingScope { } fn voice_to_billing_scope(voice: &str) -> Result { - // The voice name typically follows a pattern like "en-US-JennyNeural" or "en-US-JennyMultilingualNeural" + // The voice name typically follows a pattern like `en-US-JennyNeural` or `en-US-JennyMultilingualNeural` match voice { v if v.ends_with("TurboMultilingualNeural") => Ok(BillingScope::TurboMultilingualNeural), v if v.ends_with("MultilingualNeuralHD") => Ok(BillingScope::MultilingualNeuralHD), diff --git a/services/elevenlabs/src/transcribe.rs b/services/elevenlabs/src/transcribe.rs index 91b8066..d0f8a9c 100644 --- a/services/elevenlabs/src/transcribe.rs +++ b/services/elevenlabs/src/transcribe.rs @@ -51,7 +51,7 @@ pub struct Params { pub api_key: String, /// Optional realtime model. Defaults to `scribe_v2_realtime` when omitted. pub model: Option, - /// Optional websocket endpoint override. + /// Optional WebSocket endpoint override. pub host: Option, /// Optional language hint in BCP 47 format (for example `en-US`). pub language: Option, diff --git a/src/protocol.rs b/src/protocol.rs index 6c5c251..3dbe8fa 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -103,7 +103,7 @@ pub enum ServerEvent { speaker: Option, }, /// A completed event is sent when the client request that triggered Audio or Text responses has - /// has been fully processed. + /// been fully processed. #[serde(rename_all = "camelCase")] RequestCompleted { id: ConversationId,