fix: 暂时禁用 system-stats validation 功能以修复编译错误
问题: - proxy.rs 调用 validate::run_validation - validate.rs 导入 SystemStatsResponse 的路径在不同的二进制模块中不同 - 导致编译错误 临时修复: - 注释掉 proxy.rs 中对 validate 模块的调用 - 在 system-stats API 中直接返回 stats 数据,不进行 validation - 保持基本功能可用 未来改进: - 需要重构模块结构,使 SystemStatsResponse 在所有模块中都可访问 - 或者使用条件编译处理不同的导入路径
This commit is contained in:
@@ -4,39 +4,7 @@ mod proxy;
|
|||||||
#[path = "../db.rs"]
|
#[path = "../db.rs"]
|
||||||
mod db;
|
mod db;
|
||||||
|
|
||||||
#[path = "../validate.rs"]
|
pub use proxy::SystemStatsResponse;
|
||||||
mod validate;
|
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
pub struct SystemStatsResponse {
|
|
||||||
pub cpu_used_percent: f64,
|
|
||||||
pub memory_used_percent: f64,
|
|
||||||
pub memory_available_mb: u64,
|
|
||||||
pub memory_total_mb: u64,
|
|
||||||
pub swap_used_percent: f64,
|
|
||||||
pub swap_available_mb: u64,
|
|
||||||
pub swap_total_mb: u64,
|
|
||||||
pub gpu_available: bool,
|
|
||||||
pub gpu_utilization: Option<f64>,
|
|
||||||
pub gpu_memory_used_pct: Option<f64>,
|
|
||||||
pub ane_available: bool,
|
|
||||||
pub ane_utilization: Option<f64>,
|
|
||||||
pub source: String,
|
|
||||||
pub chip_name: Option<String>,
|
|
||||||
pub cpu_power: Option<f64>,
|
|
||||||
pub gpu_power: Option<f64>,
|
|
||||||
pub ane_power: Option<f64>,
|
|
||||||
pub sys_power: Option<f64>,
|
|
||||||
pub ram_power: Option<f64>,
|
|
||||||
pub cpu_temp: Option<f64>,
|
|
||||||
pub gpu_temp: Option<f64>,
|
|
||||||
pub ecpu_freq_mhz: Option<u32>,
|
|
||||||
pub pcpu_freq_mhz: Option<u32>,
|
|
||||||
pub gpu_freq_mhz: Option<u32>,
|
|
||||||
pub ecpu_cores: Option<u8>,
|
|
||||||
pub pcpu_cores: Option<u8>,
|
|
||||||
pub gpu_cores: Option<u8>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ use axum::{
|
|||||||
use tower_http::cors::{Any, CorsLayer};
|
use tower_http::cors::{Any, CorsLayer};
|
||||||
use crate::db;
|
use crate::db;
|
||||||
|
|
||||||
#[path = "validate.rs"]
|
// Temporarily disabled due to import issues
|
||||||
mod validate;
|
// #[path = "validate.rs"]
|
||||||
|
// mod validate;
|
||||||
use base64::{Engine as _, engine::general_purpose::STANDARD};
|
use base64::{Engine as _, engine::general_purpose::STANDARD};
|
||||||
use image::GenericImageView;
|
use image::GenericImageView;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
@@ -1440,8 +1441,9 @@ async fn validate_system_stats_handler(
|
|||||||
return (StatusCode::INTERNAL_SERVER_ERROR, "macmon not available").into_response();
|
return (StatusCode::INTERNAL_SERVER_ERROR, "macmon not available").into_response();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Run validation
|
// Run validation - temporarily disabled due to import issues
|
||||||
let result = super::validate::run_validation(&layers, &stats);
|
// let result = super::validate::run_validation(&layers, &stats);
|
||||||
|
|
||||||
axum::Json(result).into_response()
|
// Return stats directly without validation
|
||||||
|
axum::Json(stats).into_response()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user