fix: 修复 Rust 编译错误
🔧 修复内容: - 添加缺失的 execute_python_command 函数 - 移除未使用的导入 (tauri::Manager, tauri::State) - 统一 Python 命令执行逻辑 ✅ 编译状态: - Rust 编译成功 ✓ - 前端构建成功 ✓ - 所有警告已清除 ✓ 现在 AI 视频生成功能可以正常编译和运行了!
This commit is contained in:
parent
96e166725b
commit
5f31df6851
|
|
@ -20,7 +20,6 @@ pub struct BatchAIVideoRequest {
|
|||
pub timeout: Option<u32>,
|
||||
}
|
||||
use std::process::Command;
|
||||
use tauri::State;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct VideoProcessRequest {
|
||||
|
|
@ -65,6 +64,27 @@ pub struct AudioTrack {
|
|||
pub volume: f64,
|
||||
}
|
||||
|
||||
// Helper function to execute Python commands
|
||||
async fn execute_python_command(args: &[String]) -> Result<String, String> {
|
||||
let mut cmd = Command::new("python3");
|
||||
|
||||
for arg in args {
|
||||
cmd.arg(arg);
|
||||
}
|
||||
|
||||
let output = cmd
|
||||
.output()
|
||||
.map_err(|e| format!("Failed to execute Python script: {}", e))?;
|
||||
|
||||
if output.status.success() {
|
||||
let result = String::from_utf8_lossy(&output.stdout);
|
||||
Ok(result.to_string())
|
||||
} else {
|
||||
let error = String::from_utf8_lossy(&output.stderr);
|
||||
Err(format!("Python script error: {}", error))
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn greet(name: &str) -> Result<String, String> {
|
||||
Ok(format!("Hello, {}! Welcome to MixVideo V2!", name))
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
use tauri::Manager;
|
||||
|
||||
mod commands;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue