feat: Forward user settings to Whisper API
Include per-user hotwords and initial prompts in the multipart form data sent to the Whisper API. The language parameter is now dynamically set based on user configuration, defaulting to "de" if not specified.
This commit is contained in:
@@ -5,6 +5,7 @@ use doctate_server::transcribe;
|
||||
use doctate_server::transcribe::ffmpeg::remux_faststart;
|
||||
use doctate_server::transcribe::ollama::{generate_oneliner, OllamaError};
|
||||
use doctate_server::transcribe::recovery::scan_and_enqueue;
|
||||
use doctate_server::config::WhisperUserSettings;
|
||||
use doctate_server::transcribe::whisper::{transcribe, WhisperError};
|
||||
use serde_json::json;
|
||||
use wiremock::matchers::{body_partial_json, method, path, query_param};
|
||||
@@ -67,9 +68,15 @@ async fn whisper_client_posts_multipart_and_returns_text() {
|
||||
.await;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
let text = transcribe(&client, &server.uri(), &fixture("sample.m4a"), Duration::from_secs(10))
|
||||
.await
|
||||
.expect("transcribe failed");
|
||||
let text = transcribe(
|
||||
&client,
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_secs(10),
|
||||
&WhisperUserSettings::default(),
|
||||
)
|
||||
.await
|
||||
.expect("transcribe failed");
|
||||
|
||||
assert_eq!(text, expected);
|
||||
}
|
||||
@@ -85,9 +92,15 @@ async fn whisper_client_returns_status_error_on_500() {
|
||||
.await;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
let err = transcribe(&client, &server.uri(), &fixture("sample.m4a"), Duration::from_secs(10))
|
||||
.await
|
||||
.expect_err("expected error");
|
||||
let err = transcribe(
|
||||
&client,
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_secs(10),
|
||||
&WhisperUserSettings::default(),
|
||||
)
|
||||
.await
|
||||
.expect_err("expected error");
|
||||
|
||||
match err {
|
||||
WhisperError::Status { status, body } => {
|
||||
@@ -114,6 +127,7 @@ async fn whisper_client_times_out() {
|
||||
&server.uri(),
|
||||
&fixture("sample.m4a"),
|
||||
Duration::from_millis(100),
|
||||
&WhisperUserSettings::default(),
|
||||
)
|
||||
.await
|
||||
.expect_err("expected timeout");
|
||||
|
||||
Reference in New Issue
Block a user