Merge branch 'master' into codex/frontend-error-dialogs

# Conflicts:
#	.hermes/shared-memory/decision-log.md
#	server-rs/crates/api-server/src/generated_asset_sheets.rs
This commit is contained in:
kdletters
2026-05-26 22:10:41 +08:00
175 changed files with 4760 additions and 465 deletions

View File

@@ -2154,51 +2154,54 @@ fn advance_puzzle_next_level_tx(
let same_work_next_profile =
selected_profile_level_after_runtime_level(&current_profile, current_level)
.map(|level| profile_for_single_level(&current_profile, &level));
let candidates = if same_work_next_profile.is_none() {
let should_select_similar_work = input.prefer_similar_work || same_work_next_profile.is_none();
let candidates = if should_select_similar_work {
list_published_puzzle_profiles(ctx)?
} else {
Vec::new()
};
let similar_work_next_profile = if same_work_next_profile.is_none() {
let similar_work_next_profile = if should_select_similar_work {
let selected_candidates = select_next_profiles(
&current_profile,
&current_run.played_profile_ids,
&candidates,
3,
);
Some(
if let Some(target_profile_id) = input.target_profile_id.as_ref().and_then(|value| {
let trimmed = value.trim();
(!trimmed.is_empty()).then(|| trimmed.to_string())
}) {
if let Some(target_profile_id) = input.target_profile_id.as_ref().and_then(|value| {
let trimmed = value.trim();
(!trimmed.is_empty()).then(|| trimmed.to_string())
}) {
Some(
selected_candidates
.into_iter()
.find(|candidate| candidate.profile_id == target_profile_id)
.cloned()
.ok_or_else(|| "目标拼图作品不在当前下一关候选中".to_string())?
} else {
selected_candidates
.into_iter()
.next()
.cloned()
.ok_or_else(|| "没有可用的下一关候选".to_string())?
},
)
.ok_or_else(|| "目标拼图作品不在当前下一关候选中".to_string())?,
)
} else {
selected_candidates.into_iter().next().cloned()
}
} else {
None
};
let next_profile = same_work_next_profile
let similar_work_profiles = similar_work_next_profile
.as_ref()
.or(similar_work_next_profile.as_ref())
.into_iter()
.collect::<Vec<_>>();
let next_profile = module_puzzle::select_runtime_next_profile(
same_work_next_profile.as_ref(),
&similar_work_profiles,
input.prefer_similar_work,
)
.ok_or_else(|| "没有可用的下一关候选".to_string())?;
let mut next_run = if same_work_next_profile.is_some() {
module_puzzle::advance_next_level_at(
let mut next_run = if similar_work_next_profile.is_some() {
module_puzzle::advance_to_new_work_first_level_at(
&current_run,
next_profile,
micros_to_millis(input.advanced_at_micros),
)
} else {
module_puzzle::advance_to_new_work_first_level_at(
module_puzzle::advance_next_level_at(
&current_run,
next_profile,
micros_to_millis(input.advanced_at_micros),