Merge origin/master into hermes/hermes-4fd30995

This commit is contained in:
2026-05-15 03:41:50 +08:00
348 changed files with 31117 additions and 4591 deletions

View File

@@ -42,7 +42,9 @@ pub(super) fn map_puzzle_anchor_pack_response(
}
}
pub(super) fn map_puzzle_anchor_item_response(anchor: PuzzleAnchorItemRecord) -> PuzzleAnchorItemResponse {
pub(super) fn map_puzzle_anchor_item_response(
anchor: PuzzleAnchorItemRecord,
) -> PuzzleAnchorItemResponse {
PuzzleAnchorItemResponse {
key: anchor.key,
label: anchor.label,
@@ -51,7 +53,9 @@ pub(super) fn map_puzzle_anchor_item_response(anchor: PuzzleAnchorItemRecord) ->
}
}
pub(super) fn map_puzzle_result_draft_response(draft: PuzzleResultDraftRecord) -> PuzzleResultDraftResponse {
pub(super) fn map_puzzle_result_draft_response(
draft: PuzzleResultDraftRecord,
) -> PuzzleResultDraftResponse {
PuzzleResultDraftResponse {
work_title: draft.work_title,
work_description: draft.work_description,
@@ -79,7 +83,9 @@ pub(super) fn map_puzzle_result_draft_response(draft: PuzzleResultDraftRecord) -
}
}
pub(super) fn map_puzzle_form_draft_response(draft: PuzzleFormDraftRecord) -> PuzzleFormDraftResponse {
pub(super) fn map_puzzle_form_draft_response(
draft: PuzzleFormDraftRecord,
) -> PuzzleFormDraftResponse {
PuzzleFormDraftResponse {
work_title: draft.work_title,
work_description: draft.work_description,
@@ -87,7 +93,9 @@ pub(super) fn map_puzzle_form_draft_response(draft: PuzzleFormDraftRecord) -> Pu
}
}
pub(super) fn map_puzzle_draft_level_response(level: PuzzleDraftLevelRecord) -> PuzzleDraftLevelResponse {
pub(super) fn map_puzzle_draft_level_response(
level: PuzzleDraftLevelRecord,
) -> PuzzleDraftLevelResponse {
PuzzleDraftLevelResponse {
level_id: level.level_id,
level_name: level.level_name,
@@ -111,7 +119,9 @@ pub(super) fn map_puzzle_draft_level_response(level: PuzzleDraftLevelRecord) ->
}
}
pub(super) fn map_puzzle_audio_asset_record_response(asset: PuzzleAudioAssetRecord) -> CreationAudioAsset {
pub(super) fn map_puzzle_audio_asset_record_response(
asset: PuzzleAudioAssetRecord,
) -> CreationAudioAsset {
CreationAudioAsset {
task_id: asset.task_id,
provider: asset.provider,
@@ -157,7 +167,9 @@ pub(super) fn puzzle_audio_asset_response_module_json(asset: &Option<CreationAud
.unwrap_or(Value::Null)
}
pub(super) fn puzzle_audio_asset_record_module_json(asset: &Option<PuzzleAudioAssetRecord>) -> Value {
pub(super) fn puzzle_audio_asset_record_module_json(
asset: &Option<PuzzleAudioAssetRecord>,
) -> Value {
asset
.as_ref()
.map(|asset| {
@@ -415,6 +427,7 @@ pub(super) fn map_puzzle_runtime_level_response(
theme_tags: level.theme_tags,
cover_image_src: level.cover_image_src,
ui_background_image_src: level.ui_background_image_src,
ui_background_image_object_key: level.ui_background_image_object_key,
background_music: level
.background_music
.map(map_puzzle_audio_asset_record_response),
@@ -526,4 +539,3 @@ pub(super) fn build_puzzle_welcome_text(seed_text: &str) -> String {
"拼图创作信息已准备好。".to_string()
}

View File

@@ -64,7 +64,9 @@ pub(super) fn parse_puzzle_tags_from_text(text: &str) -> Vec<String> {
normalize_puzzle_tag_candidates(tags.iter().filter_map(Value::as_str))
}
pub(super) fn normalize_puzzle_tag_candidates<S>(candidates: impl IntoIterator<Item = S>) -> Vec<String>
pub(super) fn normalize_puzzle_tag_candidates<S>(
candidates: impl IntoIterator<Item = S>,
) -> Vec<String>
where
S: AsRef<str>,
{
@@ -108,7 +110,10 @@ pub(super) fn normalize_puzzle_tag(value: &str) -> String {
.collect::<String>()
}
pub(super) fn build_fallback_puzzle_tags(work_title: &str, work_description: &str) -> Vec<&'static str> {
pub(super) fn build_fallback_puzzle_tags(
work_title: &str,
work_description: &str,
) -> Vec<&'static str> {
let source = format!("{work_title} {work_description}");
let mut tags = Vec::new();
for (keyword, tag) in [
@@ -330,7 +335,11 @@ pub(super) fn ensure_non_empty(
Ok(())
}
pub(super) fn puzzle_bad_request(request_context: &RequestContext, provider: &str, message: &str) -> Response {
pub(super) fn puzzle_bad_request(
request_context: &RequestContext,
provider: &str,
message: &str,
) -> Response {
puzzle_error_response(
request_context,
provider,
@@ -515,4 +524,3 @@ pub(super) fn puzzle_sse_error_event_message(message: String) -> Event {
);
Event::default().event("error").data(payload)
}