fix wooden fish draft recovery

This commit is contained in:
kdletters
2026-05-28 08:41:16 +08:00
parent 82f24ded1b
commit 41568099c4
3 changed files with 154 additions and 7 deletions

View File

@@ -269,12 +269,13 @@ fn create_wooden_fish_agent_session_tx(
.map(parse_config)
.transpose()?
.unwrap_or_else(|| default_config_from_input(&input));
let draft = input
let mut draft = input
.draft_json
.as_deref()
.map(parse_json)
.transpose()?
.unwrap_or_else(|| draft_from_config(&config, None, WOODEN_FISH_GENERATION_DRAFT));
draft.generation_status = WOODEN_FISH_GENERATION_GENERATING.to_string();
ctx.db
.wooden_fish_agent_session()
@@ -282,8 +283,8 @@ fn create_wooden_fish_agent_session_tx(
session_id: input.session_id.clone(),
owner_user_id: input.owner_user_id.clone(),
current_turn: 0,
progress_percent: 0,
stage: WOODEN_FISH_STAGE_COLLECTING.to_string(),
progress_percent: 1,
stage: WOODEN_FISH_STAGE_GENERATING.to_string(),
config_json: to_json_string(&config),
draft_json: to_json_string(&draft),
published_profile_id: String::new(),