diff --git a/crates/edgen_server/src/lib.rs b/crates/edgen_server/src/lib.rs index 9590ce2..6af0f27 100644 --- a/crates/edgen_server/src/lib.rs +++ b/crates/edgen_server/src/lib.rs @@ -168,6 +168,26 @@ async fn start_server(args: &cli::Serve) -> EdgenResult { } async fn run_server(args: &cli::Serve) -> bool { + status::set_chat_completions_active_model( + &SETTINGS + .read() + .await + .read() + .await + .chat_completions_model_name, + ) + .await; + + status::set_audio_transcriptions_active_model( + &SETTINGS + .read() + .await + .read() + .await + .audio_transcriptions_model_name, + ) + .await; + let http_app = Router::new() // -- AI endpoints ----------------------------------------------------- // ---- Chat ----------------------------------------------------------- @@ -275,6 +295,26 @@ async fn run_server(args: &cli::Serve) -> bool { reset_channels.clear(); block_on(crate::llm::reset_environment()); block_on(crate::whisper::reset_environment()); + block_on(async { + status::set_chat_completions_active_model( + &SETTINGS + .read() + .await + .read() + .await + .chat_completions_model_name, + ) + .await; + status::set_audio_transcriptions_active_model( + &SETTINGS + .read() + .await + .read() + .await + .audio_transcriptions_model_name, + ) + .await; + }); }); loop { diff --git a/crates/edgen_server/src/status.rs b/crates/edgen_server/src/status.rs index d53e85b..528bbce 100644 --- a/crates/edgen_server/src/status.rs +++ b/crates/edgen_server/src/status.rs @@ -300,14 +300,13 @@ async fn observe_progress( let mut timestamp = Instant::now(); while m.is_ok() { let s = m.unwrap().len() as u64; - let t = size; - let p = (s * 100) / t; + let p = (s * 100) / size; - if size > last_size { - last_size = size; + if s > last_size { + last_size = s; timestamp = Instant::now(); - } else if Instant::now().duration_since(timestamp) > Duration::from_secs(60) { - warn!("progress observer: no download progress in a minute. Giving up"); + } else if Instant::now().duration_since(timestamp) > Duration::from_secs(180) { + warn!("progress observer: no download progress in three minutes. Giving up"); return; }; diff --git a/docs/src/app/api-reference/audio/page.mdx b/docs/src/app/api-reference/audio/page.mdx index d7a0cae..01c9a72 100644 --- a/docs/src/app/api-reference/audio/page.mdx +++ b/docs/src/app/api-reference/audio/page.mdx @@ -82,3 +82,50 @@ Discover how to convert audio to text or text to audio. OpenAI compliant. {{ cla + +--- + +## Transcription status {{ tag: 'GET', label: 'http://localhost:33322/v1/audio/transcriptions/status' }} + + + + + Shows the current status of the audio transcriptions endpoint (e.g. downloads) + + + + + + + ```bash {{ title: 'cURL' }} + curl http://localhost:33322/v1/audio/transcriptions/status \ + -H "Authorization: Bearer no-key-required" + ``` + + ```python + from edgen import Edgen + client = Edgen() + + status = client.audio.transcriptions.status.create() + print(status) + ``` + + ```ts + import Edgen from "edgen"; + + const client = new Edgen(); + + async function main() { + const status = await client.audio.transcriptions.status.create({}); + console.log(status.text); + } + main(); + + ``` + + + ```json {{ title: 'Response' }} + {"active_model":"neural-chat-7b-v3-3.Q4_K_M.gguf","last_activity":"download","last_activity_result":"success","completions_ongoing":false,"download_ongoing":false,"download_progress":100,"last_errors":["Custom { kind: PermissionDenied, error: \"verboten\" }]} + ``` + +