Refactor: Remove unused Whisper variants
This commit removes the `whisper_variant` and `whisper_hotwords_variant` fields from the `run_id` generation and the `print_meta_summary` function. These variants are no longer used as the project is shifting focus to LLM-based generation. The `run_full_case.rs` example has also been updated to reflect this change.
This commit is contained in:
@@ -33,7 +33,7 @@ pub fn test_user(slug: &str) -> User {
|
||||
api_key: format!("key-{slug}"),
|
||||
web_password: hash_password(TEST_PASSWORD),
|
||||
role: "doctor".into(),
|
||||
whisper: Default::default(),
|
||||
language: None,
|
||||
retention: Default::default(),
|
||||
window_hours: 72,
|
||||
preview_lines: 2,
|
||||
|
||||
@@ -4,7 +4,6 @@ use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use doctate_server::config::WhisperUserSettings;
|
||||
use doctate_server::transcribe;
|
||||
use doctate_server::transcribe::ffmpeg::remux_faststart;
|
||||
use doctate_server::transcribe::ollama::{OllamaError, generate_oneliner};
|
||||
@@ -79,7 +78,7 @@ async fn whisper_client_posts_multipart_and_returns_text() {
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_secs(10),
|
||||
&WhisperUserSettings::default(),
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect("transcribe failed");
|
||||
@@ -103,7 +102,7 @@ async fn whisper_client_returns_status_error_on_500() {
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_secs(10),
|
||||
&WhisperUserSettings::default(),
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect_err("expected error");
|
||||
@@ -133,7 +132,7 @@ async fn whisper_client_times_out() {
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_millis(100),
|
||||
&WhisperUserSettings::default(),
|
||||
None,
|
||||
)
|
||||
.await
|
||||
.expect_err("expected timeout");
|
||||
@@ -145,11 +144,9 @@ async fn whisper_client_times_out() {
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn whisper_client_forwards_hotwords_and_prompt_when_set() {
|
||||
async fn whisper_client_forwards_explicit_language() {
|
||||
let server = MockServer::start().await;
|
||||
|
||||
// Accept any POST; inspect captured body below. language query param is
|
||||
// still matched strictly to verify override from settings.
|
||||
Mock::given(method("POST"))
|
||||
.and(path("/asr"))
|
||||
.and(query_param("language", "en"))
|
||||
@@ -159,71 +156,15 @@ async fn whisper_client_forwards_hotwords_and_prompt_when_set() {
|
||||
.await;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
let settings = WhisperUserSettings {
|
||||
language: Some("en".into()),
|
||||
hotwords: Some("HOCM Valsalva".into()),
|
||||
initial_prompt: Some("Kardiologie".into()),
|
||||
};
|
||||
transcribe(
|
||||
&client,
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_secs(10),
|
||||
&settings,
|
||||
Some("en"),
|
||||
)
|
||||
.await
|
||||
.expect("transcribe failed");
|
||||
|
||||
let received = server.received_requests().await.unwrap();
|
||||
let body = String::from_utf8_lossy(&received[0].body);
|
||||
assert!(body.contains("name=\"hotwords\""), "hotwords part missing");
|
||||
assert!(
|
||||
body.contains("HOCM Valsalva"),
|
||||
"hotwords value missing: {body}"
|
||||
);
|
||||
assert!(
|
||||
body.contains("name=\"initial_prompt\""),
|
||||
"initial_prompt part missing"
|
||||
);
|
||||
assert!(body.contains("Kardiologie"), "initial_prompt value missing");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn whisper_client_omits_empty_optional_fields() {
|
||||
let server = MockServer::start().await;
|
||||
|
||||
// Default settings = all None → only `audio_file` part, language defaults
|
||||
// to `de`. Assert that neither optional field appears in the body.
|
||||
Mock::given(method("POST"))
|
||||
.and(path("/asr"))
|
||||
.and(query_param("language", "de"))
|
||||
.respond_with(ResponseTemplate::new(200).set_body_string("ok"))
|
||||
.expect(1)
|
||||
.mount(&server)
|
||||
.await;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
transcribe(
|
||||
&client,
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_secs(10),
|
||||
&WhisperUserSettings::default(),
|
||||
)
|
||||
.await
|
||||
.expect("transcribe failed");
|
||||
|
||||
// Inspect the captured request to confirm absence of the optional parts.
|
||||
let received = server.received_requests().await.unwrap();
|
||||
let body = String::from_utf8_lossy(&received[0].body);
|
||||
assert!(
|
||||
!body.contains("name=\"hotwords\""),
|
||||
"hotwords part leaked: {body}"
|
||||
);
|
||||
assert!(
|
||||
!body.contains("name=\"initial_prompt\""),
|
||||
"initial_prompt part leaked: {body}"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user