Skip to content

Commit 5d37fe7

Browse files
author
Enols
committed
fix: make TrainingConfig.name optional to match frontend API
1 parent ed91cd5 commit 5d37fe7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • src-tauri/src/modules/yolo/commands

src-tauri/src/modules/yolo/commands/train.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ pub struct TrainingCompleteEvent {
5858

5959
#[derive(Debug, Serialize, Deserialize)]
6060
pub struct TrainingConfig {
61-
pub name: String,
61+
#[serde(default)]
62+
pub name: Option<String>,
6263
pub base_model: String,
6364
pub epochs: u32,
6465
pub batch_size: u32,
@@ -127,8 +128,9 @@ pub async fn training_start(
127128
config: TrainingConfig,
128129
) -> Result<CommandResponse<String>, String> {
129130
let (event_tx, mut event_rx) = tokio::sync::mpsc::unbounded_channel();
131+
let name = config.name.unwrap_or_else(|| "yolo_train".to_string());
130132
let request = TrainingRequest {
131-
name: config.name.clone(),
133+
name,
132134
base_model: config.base_model,
133135
epochs: config.epochs,
134136
batch_size: config.batch_size,

0 commit comments

Comments
 (0)