fix: 修复 cargo check 编译错误
修复内容: - 添加缺失的 OutfitImageGenerationResponse 导入 - 为 ErrorCategory 和 ErrorSeverity 添加 Eq 和 Hash trait - 为 SimpleError 添加 Debug trait - 修复 ModelRepository::new 返回类型问题 - 移除未使用的变量 mut 修饰符 - 移除未使用的导入 编译状态: - cargo check 现在成功通过 - 只剩下一些无害的警告信息 - 所有核心功能编译正常
This commit is contained in:
parent
441d3f6cff
commit
192292b31e
|
|
@ -6,7 +6,7 @@ use tracing::{error, warn, info};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
|
|
||||||
/// 错误严重程度
|
/// 错误严重程度
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
||||||
pub enum ErrorSeverity {
|
pub enum ErrorSeverity {
|
||||||
Low, // 轻微错误,不影响主要功能
|
Low, // 轻微错误,不影响主要功能
|
||||||
Medium, // 中等错误,影响部分功能
|
Medium, // 中等错误,影响部分功能
|
||||||
|
|
@ -15,7 +15,7 @@ pub enum ErrorSeverity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 错误类别
|
/// 错误类别
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
||||||
pub enum ErrorCategory {
|
pub enum ErrorCategory {
|
||||||
Network, // 网络相关错误
|
Network, // 网络相关错误
|
||||||
Database, // 数据库相关错误
|
Database, // 数据库相关错误
|
||||||
|
|
@ -159,7 +159,7 @@ impl ErrorHandlingService {
|
||||||
let error_message = error.to_string();
|
let error_message = error.to_string();
|
||||||
let error_id = self.classify_error(&error_message);
|
let error_id = self.classify_error(&error_message);
|
||||||
|
|
||||||
let mut user_error = if let Some(template) = self.error_templates.get(&error_id) {
|
let user_error = if let Some(template) = self.error_templates.get(&error_id) {
|
||||||
let mut error = template.clone();
|
let mut error = template.clone();
|
||||||
error.timestamp = Utc::now();
|
error.timestamp = Utc::now();
|
||||||
if let Some(ctx) = context {
|
if let Some(ctx) = context {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ impl OutfitPhotoGenerationService {
|
||||||
cloud_upload_service: Arc<CloudUploadService>,
|
cloud_upload_service: Arc<CloudUploadService>,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let repository = OutfitPhotoGenerationRepository::new(database.clone())?;
|
let repository = OutfitPhotoGenerationRepository::new(database.clone())?;
|
||||||
let model_repository = ModelRepository::new(database)?;
|
let model_repository = ModelRepository::new(database);
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
repository,
|
repository,
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ use serde_json::Value;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use tracing::{info, warn, error};
|
use tracing::{info, warn};
|
||||||
|
|
||||||
/// 工作流元数据
|
/// 工作流元数据
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,7 @@ pub async fn handle_and_record_error(
|
||||||
let service = ErrorHandlingService::new();
|
let service = ErrorHandlingService::new();
|
||||||
|
|
||||||
// 创建一个简单的错误实现
|
// 创建一个简单的错误实现
|
||||||
|
#[derive(Debug)]
|
||||||
struct SimpleError(String);
|
struct SimpleError(String);
|
||||||
impl std::fmt::Display for SimpleError {
|
impl std::fmt::Display for SimpleError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
|
@ -156,6 +157,7 @@ pub async fn get_error_suggestions(
|
||||||
let service = ErrorHandlingService::new();
|
let service = ErrorHandlingService::new();
|
||||||
|
|
||||||
// 创建一个简单的错误实现
|
// 创建一个简单的错误实现
|
||||||
|
#[derive(Debug)]
|
||||||
struct SimpleError(String);
|
struct SimpleError(String);
|
||||||
impl std::fmt::Display for SimpleError {
|
impl std::fmt::Display for SimpleError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
|
@ -185,6 +187,7 @@ pub async fn check_error_retry_capability(
|
||||||
let service = ErrorHandlingService::new();
|
let service = ErrorHandlingService::new();
|
||||||
|
|
||||||
// 创建一个简单的错误实现
|
// 创建一个简单的错误实现
|
||||||
|
#[derive(Debug)]
|
||||||
struct SimpleError(String);
|
struct SimpleError(String);
|
||||||
impl std::fmt::Display for SimpleError {
|
impl std::fmt::Display for SimpleError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
|
@ -221,6 +224,7 @@ pub async fn get_error_help_info(
|
||||||
let service = ErrorHandlingService::new();
|
let service = ErrorHandlingService::new();
|
||||||
|
|
||||||
// 创建一个简单的错误实现
|
// 创建一个简单的错误实现
|
||||||
|
#[derive(Debug)]
|
||||||
struct SimpleError(String);
|
struct SimpleError(String);
|
||||||
impl std::fmt::Display for SimpleError {
|
impl std::fmt::Display for SimpleError {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use tauri::State;
|
use tauri::State;
|
||||||
use crate::app_state::AppState;
|
use crate::app_state::AppState;
|
||||||
use crate::data::models::outfit_image::{
|
use crate::data::models::outfit_image::{
|
||||||
OutfitImageRecord, OutfitImageGenerationRequest,
|
OutfitImageRecord, OutfitImageGenerationRequest, OutfitImageGenerationResponse,
|
||||||
OutfitImageStats, ProductImage
|
OutfitImageStats, ProductImage
|
||||||
};
|
};
|
||||||
use crate::data::repositories::outfit_image_repository::OutfitImageRepository;
|
use crate::data::repositories::outfit_image_repository::OutfitImageRepository;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue