YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
gate OpenAI-compatible STT activation (#5570)
Ezra Ellette949e2d8829e8
diff --git a/.github/pr-assets/stt-after-endpoint-verification.png b/.github/pr-assets/stt-after-endpoint-verification.pngnew file mode 100644index 000000000..a341cfae3Binary files /dev/null and b/.github/pr-assets/stt-after-endpoint-verification.png differdiff --git a/.github/pr-assets/stt-before-endpoint-verification.png b/.github/pr-assets/stt-before-endpoint-verification.pngnew file mode 100644index 000000000..d990661d0Binary files /dev/null and b/.github/pr-assets/stt-before-endpoint-verification.png differdiff --git a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsxindex 98fbd821b..ca1d13980 100644--- a/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx+++ b/apps/screenpipe-app-tauri/components/settings/recording-settings.tsx@@ -196,6 +196,22 @@ const getAppIconUrl = (appName: string): string => {const FALLBACK_TRANSCRIPTION_ENGINE = "whisper-large-v3-turbo-quantized";+type OpenAICompatibleDraft = {+ endpoint: string;+ apiKey: string;+ model: string;+ headers?: Record<string, string>;+ rawAudio: boolean;+};++const getOpenAICompatibleDraft = (settings: Settings): OpenAICompatibleDraft => ({+ endpoint: settings.openaiCompatibleEndpoint || DEFAULT_OPENAI_COMPATIBLE_ENDPOINT,+ apiKey: settings.openaiCompatibleApiKey || "",+ model: settings.openaiCompatibleModel || "",+ headers: settings.openaiCompatibleHeaders || undefined,+ rawAudio: settings.openaiCompatibleRawAudio || false,+});+const TRANSCRIPTION_ENGINE_LABELS: Record<string, string> = {"screenpipe-cloud": "Screenpipe Cloud",deepgram: "Deepgram",@@ -1909,6 +1925,12 @@ export function RecordingSettings() {const [platformReady, setPlatformReady] = useState(false);const [showApiKey, setShowApiKey] = useState(false);const [showOpenAIApiKey, setShowOpenAIApiKey] = useState(false);+ const [isOpenAICompatibleSetupOpen, setIsOpenAICompatibleSetupOpen] = useState(false);+ const [openAICompatibleDraft, setOpenAICompatibleDraft] = useState<OpenAICompatibleDraft>(+ () => getOpenAICompatibleDraft(settings)+ );+ const [isTestingOpenAICompatible, setIsTestingOpenAICompatible] = useState(false);+ const [openAICompatibleTestError, setOpenAICompatibleTestError] = useState<string | null>(null);const [isRefreshingSubscription, setIsRefreshingSubscription] = useState(false);const { checkLogin } = useLoginDialog();const overlayData = useOverlayData();@@ -1923,11 +1945,28 @@ export function RecordingSettings() {setFilterText: setFilterTranscriptionModels,fetchOpenAIModels,} = useOpenAIModels({- engine: settings.audioTranscriptionEngine,- endpoint: settings.openaiCompatibleEndpoint || "",- apiKey: settings.openaiCompatibleApiKey || "",+ engine: isOpenAICompatibleSetupOpen || settings.audioTranscriptionEngine === "openai-compatible"+ ? "openai-compatible"+ : settings.audioTranscriptionEngine,+ endpoint: openAICompatibleDraft.endpoint,+ apiKey: openAICompatibleDraft.apiKey,});+ // Keep the draft in sync with persisted settings until the user starts a+ // verification attempt. Draft edits must not mark recording as restartable.+ useEffect(() => {+ if (!isOpenAICompatibleSetupOpen) {+ setOpenAICompatibleDraft(getOpenAICompatibleDraft(settings));+ }+ }, [+ isOpenAICompatibleSetupOpen,+ settings.openaiCompatibleApiKey,+ settings.openaiCompatibleEndpoint,+ settings.openaiCompatibleHeaders,+ settings.openaiCompatibleModel,+ settings.openaiCompatibleRawAudio,+ ]);+// Transcription diagnosticsconst {txTestStatus,@@ -2384,8 +2423,23 @@ export function RecordingSettings() {const handleAudioTranscriptionModelChange = async (value: string,- realtime = false+ realtime = false,+ endpointVerified = false) => {+ // Do not activate an OpenAI-compatible server optimistically. Its first+ // real transcription failure otherwise leaves audio recorded but absent+ // from search with no clear recovery path.+ if (+ value === "openai-compatible" &&+ settings.audioTranscriptionEngine !== value &&+ !endpointVerified+ ) {+ setOpenAICompatibleDraft(getOpenAICompatibleDraft(settings));+ setIsOpenAICompatibleSetupOpen(true);+ setOpenAICompatibleTestError(null);+ return;+ }+const isLoggedIn = checkLogin(settings.user);// Cloud transcription works on every plan (free tier allowance is// enforced server-side) — the only requirement is being logged in.@@ -2428,6 +2482,54 @@ export function RecordingSettings() {handleSettingsChange(newSettings, true);};+ const updateOpenAICompatibleDraft = (+ updates: Partial<OpenAICompatibleDraft>+ ) => {+ setOpenAICompatibleTestError(null);+ setIsOpenAICompatibleSetupOpen(true);+ setOpenAICompatibleDraft((current) => ({ ...current, ...updates }));+ };++ const handleTestAndEnableOpenAICompatible = async () => {+ setIsTestingOpenAICompatible(true);+ setOpenAICompatibleTestError(null);++ try {+ const result = await commands.testOpenaiCompatibleTranscription(+ openAICompatibleDraft.endpoint,+ openAICompatibleDraft.apiKey || null,+ openAICompatibleDraft.model,+ openAICompatibleDraft.headers || null,+ openAICompatibleDraft.rawAudio+ );+ if (result.status === "error") {+ throw new Error(result.error);+ }++ handleSettingsChange(+ {+ openaiCompatibleEndpoint: openAICompatibleDraft.endpoint,+ openaiCompatibleApiKey: openAICompatibleDraft.apiKey || undefined,+ openaiCompatibleModel: openAICompatibleDraft.model || undefined,+ openaiCompatibleHeaders: openAICompatibleDraft.headers,+ openaiCompatibleRawAudio: openAICompatibleDraft.rawAudio,+ },+ true+ );+ await handleAudioTranscriptionModelChange("openai-compatible", false, true);+ setIsOpenAICompatibleSetupOpen(false);+ toast({+ title: "OpenAI Compatible enabled",+ description: "The endpoint accepted a real transcription request.",+ });+ } catch (error) {+ const message = error instanceof Error ? error.message : String(error);+ setOpenAICompatibleTestError(message);+ } finally {+ setIsTestingOpenAICompatible(false);+ }+ };+const handleLanguageChange = (currentValue: Language | null) => {if (!currentValue) {@@ -2830,18 +2932,27 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre</Button></div>)}- {settings.audioTranscriptionEngine === "openai-compatible" && (+ {(settings.audioTranscriptionEngine === "openai-compatible" || isOpenAICompatibleSetupOpen) && (<div className="mt-2 ml-[26px] space-y-2">+ {isOpenAICompatibleSetupOpen && (+ <Alert className="border-amber-300 bg-amber-50 text-amber-950 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-100">+ <AlertCircle className="h-4 w-4" />+ <AlertTitle className="text-xs font-semibold">Endpoint verification required</AlertTitle>+ <AlertDescription className="text-xs">+ These edits are not saved or applied until this endpoint completes a test transcription. This prevents recordings that cannot be searched.+ </AlertDescription>+ </Alert>+ )}{/* API Endpoint Input */}<ValidatedInputid="openaiCompatibleEndpoint"label=""- value={settings.openaiCompatibleEndpoint || DEFAULT_OPENAI_COMPATIBLE_ENDPOINT}- onChange={(value: string) => handleSettingsChange({ openaiCompatibleEndpoint: value }, true)}- onBlur={() => fetchOpenAIModels(settings.openaiCompatibleEndpoint || DEFAULT_OPENAI_COMPATIBLE_ENDPOINT, settings.openaiCompatibleApiKey)}+ value={openAICompatibleDraft.endpoint}+ onChange={(value: string) => updateOpenAICompatibleDraft({ endpoint: value })}+ onBlur={() => fetchOpenAIModels(openAICompatibleDraft.endpoint, openAICompatibleDraft.apiKey)}onKeyDown={(e: React.KeyboardEvent) => {if (e.key === 'Enter') {- fetchOpenAIModels(settings.openaiCompatibleEndpoint || DEFAULT_OPENAI_COMPATIBLE_ENDPOINT, settings.openaiCompatibleApiKey);+ fetchOpenAIModels(openAICompatibleDraft.endpoint, openAICompatibleDraft.apiKey);}}}placeholder="API Endpoint (e.g., http://127.0.0.1:8080)"@@ -2854,8 +2965,8 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Screid="openaiCompatibleApiKey"label=""type={showOpenAIApiKey ? "text" : "password"}- value={settings.openaiCompatibleApiKey || ""}- onChange={(value: string) => handleSettingsChange({ openaiCompatibleApiKey: value }, true)}+ value={openAICompatibleDraft.apiKey}+ onChange={(value: string) => updateOpenAICompatibleDraft({ apiKey: value })}placeholder="API Key (optional)"className="pr-8 h-7 text-xs"/>@@ -2868,8 +2979,8 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre<div className="space-y-1.5"><div className="relative"><Input- value={settings.openaiCompatibleModel || ""}- onChange={(e) => handleSettingsChange({ openaiCompatibleModel: e.target.value }, true)}+ value={openAICompatibleDraft.model}+ onChange={(e) => updateOpenAICompatibleDraft({ model: e.target.value })}placeholder={isLoadingModels ? "Loading models..." : "Model name (e.g., whisper-large-v3-turbo)"}className="h-7 text-xs pr-8"/>@@ -2900,11 +3011,11 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scretype="button"className={cn("px-2 py-0.5 rounded text-xs border transition-colors",- settings.openaiCompatibleModel === model+ openAICompatibleDraft.model === model? "bg-foreground text-background border-foreground": "hover:bg-accent border-border")}- onClick={() => handleSettingsChange({ openaiCompatibleModel: model }, true)}+ onClick={() => updateOpenAICompatibleDraft({ model })}>{model}</button>@@ -2924,8 +3035,8 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre<label className="flex items-center gap-2 text-xs cursor-pointer"><inputtype="checkbox"- checked={settings.openaiCompatibleRawAudio || false}- onChange={(e) => handleSettingsChange({ openaiCompatibleRawAudio: e.target.checked }, true)}+ checked={openAICompatibleDraft.rawAudio}+ onChange={(e) => updateOpenAICompatibleDraft({ rawAudio: e.target.checked })}className="rounded border-border"/><span>send raw WAV audio (instead of MP3)</span>@@ -2935,17 +3046,17 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre<div className="space-y-1"><label className="text-xs text-muted-foreground">custom headers (JSON)</label><Input- defaultValue={settings.openaiCompatibleHeaders ? JSON.stringify(settings.openaiCompatibleHeaders) : ""}+ defaultValue={openAICompatibleDraft.headers ? JSON.stringify(openAICompatibleDraft.headers) : ""}onBlur={(e) => {const val = e.target.value.trim();if (!val) {- handleSettingsChange({ openaiCompatibleHeaders: undefined }, true);+ updateOpenAICompatibleDraft({ headers: undefined });return;}try {const parsed = JSON.parse(val);if (typeof parsed === "object" && !Array.isArray(parsed)) {- handleSettingsChange({ openaiCompatibleHeaders: parsed }, true);+ updateOpenAICompatibleDraft({ headers: parsed });}} catch {// Invalid JSON — don't save@@ -2956,6 +3067,31 @@ Your screen is a pipe. Everything you see, hear, and type flows through it. Scre/></div>+ <div className="flex flex-wrap items-center gap-2 border border-border bg-muted/20 p-2">+ <Button+ type="button"+ size="sm"+ className="h-7 text-xs"+ onClick={handleTestAndEnableOpenAICompatible}+ disabled={isTestingOpenAICompatible}+ >+ {isTestingOpenAICompatible ? (+ <Loader2 className="mr-1.5 h-3 w-3 animate-spin" />+ ) : (+ <Zap className="mr-1.5 h-3 w-3" />+ )}+ {isTestingOpenAICompatible ? "Testing endpoint..." : "Test and enable"}+ </Button>+ <span className="text-xs text-muted-foreground">+ Sends a short silent sample using the configured model and audio format.+ </span>+ </div>+ {openAICompatibleTestError && (+ <p className="text-xs text-destructive" role="alert">+ {openAICompatibleTestError}+ </p>+ )}+{/* Connection Test Panel */}<div className="border rounded-lg"><buttondiff --git a/apps/screenpipe-app-tauri/lib/utils/tauri.ts b/apps/screenpipe-app-tauri/lib/utils/tauri.tsindex d8be98c82..e37d9ebc8 100644--- a/apps/screenpipe-app-tauri/lib/utils/tauri.ts+++ b/apps/screenpipe-app-tauri/lib/utils/tauri.ts@@ -2442,6 +2442,20 @@ async suspendGlobalShortcuts() : Promise<Result<null, string>> {else return { status: "error", error: e as any };}},+/**+ * Verifies an OpenAI-compatible endpoint with the exact request path and+ * audio encoding used by the recording engine. A successful response is+ * required before the settings UI can activate this engine, so recordings+ * cannot silently accumulate without searchable audio transcripts.+ */+async testOpenaiCompatibleTranscription(endpoint: string, apiKey: string | null, model: string, headers: { [key in string]: string } | null, rawAudio: boolean) : Promise<Result<string, string>> {+ try {+ return { status: "ok", data: await TAURI_INVOKE("test_openai_compatible_transcription", { endpoint, apiKey, model, headers, rawAudio }) };+} catch (e) {+ if(e instanceof Error) throw e;+ else return { status: "error", error: e as any };+}+},/*** Tauri command: start voice training. Spawns a background task that polls* until audio is transcribed, then assigns the speaker. Returns immediately.diff --git a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs b/apps/screenpipe-app-tauri/src-tauri/src/recording.rsindex 9cf023899..c9ec7af06 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/recording.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/recording.rs@@ -15,6 +15,7 @@ use crate::server_core::ServerCore;use crate::store::{LocalPlanPolicy, SettingsStore};use screenpipe_engine::RecordingConfig;use serde::{Deserialize, Serialize};+use std::collections::HashMap;use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};use std::sync::Arc;use std::time::{Duration, Instant};@@ -71,6 +72,48 @@ fn build_config(app: &tauri::AppHandle) -> Result<RecordingConfig, String> {Ok(store.to_recording_config(data_dir))}+/// Verifies an OpenAI-compatible endpoint with the exact request path and+/// audio encoding used by the recording engine. A successful response is+/// required before the settings UI can activate this engine, so recordings+/// cannot silently accumulate without searchable audio transcripts.+#[tauri::command]+#[specta::specta]+pub async fn test_openai_compatible_transcription(+ endpoint: String,+ api_key: Option<String>,+ model: String,+ headers: Option<HashMap<String, String>>,+ raw_audio: bool,+) -> Result<String, String> {+ let endpoint = endpoint.trim();+ if endpoint.is_empty() {+ return Err("Enter an OpenAI-compatible endpoint first.".to_string());+ }++ let model = if model.trim().is_empty() {+ screenpipe_audio::DEFAULT_OPENAI_COMPATIBLE_MODEL+ } else {+ model.trim()+ };++ let test_audio = vec![0.0_f32; 16_000];+ screenpipe_audio::transcription::openai_compatible::batch::transcribe_with_openai_compatible(+ None,+ endpoint,+ api_key.as_deref(),+ model,+ &test_audio,+ "OpenAI-compatible settings test",+ 16_000,+ Vec::new(),+ &[],+ headers.as_ref(),+ raw_audio,+ )+ .await+ .map_err(|error| format!("Endpoint test failed: {error}"))+}+fn configured_local_api_port(app: &tauri::AppHandle) -> u16 {build_config(app).map(|config| config.port)diff --git a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rsindex 8d90e914c..be009e6bf 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/server_core.rs@@ -10,8 +10,9 @@use std::net::{IpAddr, Ipv4Addr, SocketAddr};use std::panic::AssertUnwindSafe;use std::path::PathBuf;+use std::sync::atomic::Ordering;use std::sync::Arc;-use std::time::Duration;+use std::time::{Duration, Instant};use futures::FutureExt;use screenpipe_audio::core::device::resolve_audio_devices_for_capture;@@ -84,6 +85,72 @@ pub struct ServerCore {const BIND_RETRY_ATTEMPTS: u32 = 20;const BIND_RETRY_DELAY: Duration = Duration::from_millis(500);const PORT_HOLDER_LOOKUP_TIMEOUT: Duration = Duration::from_secs(2);+const OPENAI_COMPATIBLE_FAILURE_POLL_INTERVAL: Duration = Duration::from_secs(15);+const OPENAI_COMPATIBLE_FAILURE_NOTIFICATION_COOLDOWN: Duration = Duration::from_secs(5 * 60);++fn should_notify_openai_compatible_failure(+ previous_error_count: u64,+ current_error_count: u64,+ previous_empty_count: u64,+ current_empty_count: u64,+ previous_completed_count: u64,+ current_completed_count: u64,+ last_notification: Option<Instant>,+ now: Instant,+) -> bool {+ let failed_request = current_error_count > previous_error_count;+ // VAD already filters for speech before this stage. A run of empty+ // responses with no successful transcript is therefore a strong signal+ // that the endpoint accepted the request but is not producing indexable+ // data, rather than normal silence.+ let repeated_empty_responses = current_empty_count.saturating_sub(previous_empty_count) >= 3+ && current_completed_count == previous_completed_count;++ (failed_request || repeated_empty_responses)+ && last_notification.is_none_or(|last| now.duration_since(last) >= OPENAI_COMPATIBLE_FAILURE_NOTIFICATION_COOLDOWN)+}++fn monitor_openai_compatible_transcription_failures(+ metrics: Arc<screenpipe_audio::metrics::AudioPipelineMetrics>,+) -> tokio::task::JoinHandle<()> {+ tokio::spawn(async move {+ let mut previous_error_count = metrics.transcription_errors.load(Ordering::Relaxed);+ let mut previous_empty_count = metrics.transcriptions_empty.load(Ordering::Relaxed);+ let mut previous_completed_count = metrics.transcriptions_completed.load(Ordering::Relaxed);+ let mut last_notification = None;++ loop {+ tokio::time::sleep(OPENAI_COMPATIBLE_FAILURE_POLL_INTERVAL).await;+ let current_error_count = metrics.transcription_errors.load(Ordering::Relaxed);+ let current_empty_count = metrics.transcriptions_empty.load(Ordering::Relaxed);+ let current_completed_count = metrics.transcriptions_completed.load(Ordering::Relaxed);+ let now = Instant::now();++ if should_notify_openai_compatible_failure(+ previous_error_count,+ current_error_count,+ previous_empty_count,+ current_empty_count,+ previous_completed_count,+ current_completed_count,+ last_notification,+ now,+ ) {+ crate::notifications::client::send_typed(+ "OpenAI Compatible transcription is failing",+ "Screenpipe is still recording audio, but the endpoint is failing or returning empty transcripts, so new audio may not be searchable. Check Settings and run Test and enable again.",+ "system",+ Some(20_000),+ );+ last_notification = Some(now);+ }++ previous_error_count = current_error_count;+ previous_empty_count = current_empty_count;+ previous_completed_count = current_completed_count;+ }+ })+}#[cfg(any(test, target_os = "macos", target_os = "linux"))]fn parse_lsof_port_holder(stdout: &str) -> Option<String> {@@ -512,6 +579,12 @@ impl ServerCore {let mut external_memory_sync_handle = None;let mut owned_tasks: Vec<tokio::task::JoinHandle<()>> = Vec::new();+ if config.audio_transcription_engine == AudioTranscriptionEngine::OpenAICompatible {+ owned_tasks.push(monitor_openai_compatible_transcription_failures(+ audio_manager.metrics.clone(),+ ));+ }+// Secret store — read-only keychain access on startup.// Never create a key automatically (that triggers a macOS modal).// Users opt in via onboarding or Settings > Privacy.@@ -1371,4 +1444,33 @@ mod tests {);assert_eq!(parse_tasklist_process_name(""), None);}++ #[test]+ fn openai_compatible_failure_notifications_are_rate_limited() {+ let now = Instant::now();+ assert!(should_notify_openai_compatible_failure(2, 3, 0, 0, 0, 0, None, now));+ assert!(!should_notify_openai_compatible_failure(3, 3, 0, 0, 0, 0, None, now));+ assert!(should_notify_openai_compatible_failure(3, 3, 1, 4, 10, 10, None, now));+ assert!(!should_notify_openai_compatible_failure(3, 3, 1, 4, 10, 11, None, now));+ assert!(!should_notify_openai_compatible_failure(+ 3,+ 4,+ 0,+ 0,+ 0,+ 0,+ Some(now),+ now + Duration::from_secs(1),+ ));+ assert!(should_notify_openai_compatible_failure(+ 3,+ 4,+ 0,+ 0,+ 0,+ 0,+ Some(now),+ now + OPENAI_COMPATIBLE_FAILURE_NOTIFICATION_COOLDOWN,+ ));+ }}diff --git a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs b/crates/screenpipe-audio/src/audio_manager/reconciliation.rsindex eb54ba81e..5bfaf33ed 100644--- a/crates/screenpipe-audio/src/audio_manager/reconciliation.rs+++ b/crates/screenpipe-audio/src/audio_manager/reconciliation.rs@@ -396,6 +396,9 @@ pub async fn reconcile_untranscribed(Ok(output) => output,Err(e) => {error!("reconciliation: transcription failed for batch: {}", e);+ if let Some(metrics) = &metrics {+ metrics.record_transcription_error();+ }// Bump attempts on every chunk in the batch. Once a chunk has// failed MAX_TRANSCRIPTION_ATTEMPTS times in a row the outcome// helper flips it to status='failed' and it stops being picked.diff --git a/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rs b/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rsindex e89f10c6b..7a14ac9f7 100644--- a/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rs+++ b/crates/screenpipe-audio/src/transcription/openai_compatible/batch.rs@@ -102,9 +102,7 @@ pub async fn transcribe_with_openai_compatible(form = form.text("prompt", prompt.clone()).text("context", prompt);}- let mut request = client- .post(format!("{}/v1/audio/transcriptions", endpoint))- .multipart(form);+ let mut request = client.post(transcription_url(endpoint)).multipart(form);if let Some(key) = api_key {if !key.is_empty() {@@ -147,6 +145,16 @@ pub async fn transcribe_with_openai_compatible(.into())}+/// Build the OpenAI-compatible transcription URL from a user-provided base+/// endpoint. Keeping this in the shared request path means the settings+/// verification request and production transcription use the exact same URL.+fn transcription_url(endpoint: &str) -> String {+ format!(+ "{}/v1/audio/transcriptions",+ endpoint.trim().trim_end_matches('/')+ )+}+/// Whether a transport-level error is transient (worth retrying) rather than/// deterministic. HTTP status errors don't reach here (they're `Ok(Response)`).fn openai_error_is_transient(err: &reqwest::Error) -> bool {@@ -345,6 +353,22 @@ mod tests {assert!(!transient_error_text("404 not found"));}+ #[test]+ fn transcription_url_accepts_endpoints_with_or_without_a_trailing_slash() {+ assert_eq!(+ transcription_url("http://127.0.0.1:8080"),+ "http://127.0.0.1:8080/v1/audio/transcriptions"+ );+ assert_eq!(+ transcription_url("http://127.0.0.1:8080/"),+ "http://127.0.0.1:8080/v1/audio/transcriptions"+ );+ assert_eq!(+ transcription_url(" http://127.0.0.1:8080/ "),+ "http://127.0.0.1:8080/v1/audio/transcriptions"+ );+ }+#[test]fn test_create_mp3_data() {let audio_data: Vec<f32> = vec![0.0, 0.5, 0.0, -0.5, 0.0];