feat: Add transcription worker and state management
Introduce an `AppState` struct to hold shared application state, including configuration and the transcription sender. Modify `create_router` and `create_router_with_state` to use `AppState`. Update `main.rs` to initialize the transcription worker and pass the `AppState` to the router. Implement the transcription worker logic in `server/src/transcribe/worker.rs`, handling job queues, FFmpeg remuxing, and Whisper transcription. Update `server/src/auth.rs` to use `Arc<Config>` from the shared state. Modify `server/src/routes/upload.rs` to enqueue transcription jobs and handle potential errors. Add `TranscribeJob` and channel types in `server/src/transcribe/mod.rs`.
This commit is contained in:
@@ -3,14 +3,12 @@ mod health;
|
||||
mod upload;
|
||||
mod web;
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use axum::routing::{get, post};
|
||||
use axum::Router;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::AppState;
|
||||
|
||||
pub fn api_router() -> Router<Arc<Config>> {
|
||||
pub fn api_router() -> Router<AppState> {
|
||||
Router::new()
|
||||
.route("/api/health", get(health::handle_health))
|
||||
.route("/api/debug/whoami", get(debug::handle_whoami))
|
||||
|
||||
Reference in New Issue
Block a user