refactor(api): simplify actix_web imports and remove unused modules
- Removed unused imports (Scope, Arc, Mutex) from api/mod.rs - Updated config function signature to use ServiceConfig instead of Scope - Removed unused session_manager module from main.rs - Cleaned up documentation comments in models and queue_service modules - Simplified import statements across backend modules for better readability This refactoring removes unnecessary dependencies and cleans up the codebase by eliminating unused imports and redundant documentation while maintaining all functionality.
This commit is contained in:
@@ -3,10 +3,8 @@
|
|||||||
//! This module defines all HTTP endpoints for the AI generation system,
|
//! This module defines all HTTP endpoints for the AI generation system,
|
||||||
//! including model management, inference requests, and task status monitoring.
|
//! including model management, inference requests, and task status monitoring.
|
||||||
|
|
||||||
use actix_web::{web, HttpResponse, Result, Scope};
|
use actix_web::{web, HttpResponse, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AppState,
|
AppState,
|
||||||
@@ -158,11 +156,11 @@ pub async fn get_all_tasks(state: web::Data<AppState>) -> Result<HttpResponse> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration for API routes
|
/// Configuration for API routes
|
||||||
pub fn config(cfg: &mut Scope) {
|
pub fn config(cfg: &mut actix_web::web::ServiceConfig) {
|
||||||
cfg.route("/health", web::get().to(health_check))
|
cfg.route("/health", web::get().to(health_check))
|
||||||
.route("/system-info", web::get().to(get_system_info))
|
.route("/system-info", web::get().to(get_system_info))
|
||||||
.route("/models", web::get().to(get_models))
|
.route("/models", web::get().to(get_models))
|
||||||
.route("/infer", web::post().to(start_inference))
|
.route("/infer", web::post().to(start_inference))
|
||||||
.route("/tasks/{task_id}", web::get().to(get_task_status))
|
.route("/tasks/{task_id}", web::get().to(get_task_status))
|
||||||
.route("/tasks", web::get().to(get_all_tasks));
|
.route("/tasks", web::get().to(get_all_tasks));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//! This server provides a REST API and WebSocket endpoints for
|
//! This server provides a REST API and WebSocket endpoints for
|
||||||
//! managing image/video generation workflows on AMD GPUs.
|
//! managing image/video generation workflows on AMD GPUs.
|
||||||
|
|
||||||
use actix_web::{web, App, HttpServer, Result, middleware::Logger};
|
use actix_web::{web, App, HttpServer, middleware::Logger};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
@@ -12,7 +12,6 @@ pub mod api;
|
|||||||
pub mod models;
|
pub mod models;
|
||||||
pub mod queue_service;
|
pub mod queue_service;
|
||||||
pub mod rocminfo;
|
pub mod rocminfo;
|
||||||
pub mod session_manager;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct AppState {
|
pub struct AppState {
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
//! Model management for AI inference workflows
|
|
||||||
//!
|
|
||||||
//! This module handles loading, caching, and managing different types of
|
|
||||||
//! machine learning models needed for image/video generation.
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
|
||||||
use tokio::sync::Mutex;
|
|
||||||
|
|
||||||
|
/// Model management for AI inference workflows
|
||||||
|
///
|
||||||
|
/// This module handles loading, caching, and managing different types of
|
||||||
|
/// machine learning models needed for image/video generation.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct ModelInfo {
|
pub struct ModelInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|||||||
@@ -1,15 +1,12 @@
|
|||||||
//! Task queue service for managing concurrent AI inference tasks
|
|
||||||
//!
|
|
||||||
//! This module provides a thread-safe task queue system using Tokio
|
|
||||||
//! and Rayon for parallel processing on AMD GPUs.
|
|
||||||
|
|
||||||
use chrono::{DateTime, Utc};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tokio::sync::{Mutex, Notify};
|
use tokio::sync::{Mutex, Notify};
|
||||||
use uuid::Uuid;
|
|
||||||
|
|
||||||
|
/// Task queue service for managing concurrent AI inference tasks
|
||||||
|
///
|
||||||
|
/// This module provides a thread-safe task queue system using Tokio
|
||||||
|
/// and Rayon for parallel processing on AMD GPUs.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
||||||
pub struct Task {
|
pub struct Task {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user