Merge origin/master into hermes/hermes-4fd30995
This commit is contained in:
@@ -427,27 +427,28 @@ async fn persist_big_fish_formal_asset(
|
||||
})?;
|
||||
let http_client = reqwest::Client::new();
|
||||
let image_format = normalize_generated_image_asset_mime(downloaded.mime_type.as_str());
|
||||
let prepared = GeneratedImageAssetAdapter::prepare_put_object(GeneratedImageAssetPersistInput {
|
||||
prefix: LegacyAssetPrefix::BigFishAssets,
|
||||
path_segments: context.path_segments.clone(),
|
||||
file_stem: "image".to_string(),
|
||||
image: GeneratedImageAssetDataUrl {
|
||||
format: image_format,
|
||||
bytes: downloaded.bytes,
|
||||
},
|
||||
access: OssObjectAccess::Private,
|
||||
metadata: GeneratedImageAssetAdapterMetadata {
|
||||
asset_kind: Some(context.asset_object_kind.clone()),
|
||||
owner_user_id: Some(owner_user_id.to_string()),
|
||||
entity_kind: Some(BIG_FISH_ENTITY_KIND.to_string()),
|
||||
entity_id: Some(context.entity_id.clone()),
|
||||
slot: Some(context.binding_slot.clone()),
|
||||
provider: Some("dashscope".to_string()),
|
||||
task_id: Some(generated.task_id.clone()),
|
||||
},
|
||||
extra_metadata: BTreeMap::new(),
|
||||
})
|
||||
.map_err(map_big_fish_generated_image_asset_error)?;
|
||||
let prepared =
|
||||
GeneratedImageAssetAdapter::prepare_put_object(GeneratedImageAssetPersistInput {
|
||||
prefix: LegacyAssetPrefix::BigFishAssets,
|
||||
path_segments: context.path_segments.clone(),
|
||||
file_stem: "image".to_string(),
|
||||
image: GeneratedImageAssetDataUrl {
|
||||
format: image_format,
|
||||
bytes: downloaded.bytes,
|
||||
},
|
||||
access: OssObjectAccess::Private,
|
||||
metadata: GeneratedImageAssetAdapterMetadata {
|
||||
asset_kind: Some(context.asset_object_kind.clone()),
|
||||
owner_user_id: Some(owner_user_id.to_string()),
|
||||
entity_kind: Some(BIG_FISH_ENTITY_KIND.to_string()),
|
||||
entity_id: Some(context.entity_id.clone()),
|
||||
slot: Some(context.binding_slot.clone()),
|
||||
provider: Some("dashscope".to_string()),
|
||||
task_id: Some(generated.task_id.clone()),
|
||||
},
|
||||
extra_metadata: BTreeMap::new(),
|
||||
})
|
||||
.map_err(map_big_fish_generated_image_asset_error)?;
|
||||
let persisted_mime_type = prepared.format.mime_type.clone();
|
||||
let put_result = oss_client
|
||||
.put_object(&http_client, prepared.request)
|
||||
@@ -582,7 +583,6 @@ fn normalize_big_fish_downloaded_image_mime_type(content_type: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn map_big_fish_dashscope_request_error(message: String) -> AppError {
|
||||
AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
|
||||
"provider": "dashscope",
|
||||
@@ -642,4 +642,3 @@ fn build_big_fish_level_part(level: Option<u32>) -> String {
|
||||
.map(|value| format!("level-{value}"))
|
||||
.unwrap_or_else(|| "stage".to_string())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::*;
|
||||
|
||||
pub(super) fn map_big_fish_session_response(session: BigFishSessionRecord) -> BigFishSessionSnapshotResponse {
|
||||
pub(super) fn map_big_fish_session_response(
|
||||
session: BigFishSessionRecord,
|
||||
) -> BigFishSessionSnapshotResponse {
|
||||
BigFishSessionSnapshotResponse {
|
||||
session_id: session.session_id,
|
||||
current_turn: session.current_turn,
|
||||
@@ -36,7 +38,9 @@ pub(super) fn map_big_fish_anchor_pack_response(
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn map_big_fish_anchor_item_response(anchor: BigFishAnchorItemRecord) -> BigFishAnchorItemResponse {
|
||||
pub(super) fn map_big_fish_anchor_item_response(
|
||||
anchor: BigFishAnchorItemRecord,
|
||||
) -> BigFishAnchorItemResponse {
|
||||
BigFishAnchorItemResponse {
|
||||
key: anchor.key,
|
||||
label: anchor.label,
|
||||
@@ -45,7 +49,9 @@ pub(super) fn map_big_fish_anchor_item_response(anchor: BigFishAnchorItemRecord)
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn map_big_fish_draft_response(draft: BigFishGameDraftRecord) -> BigFishGameDraftResponse {
|
||||
pub(super) fn map_big_fish_draft_response(
|
||||
draft: BigFishGameDraftRecord,
|
||||
) -> BigFishGameDraftResponse {
|
||||
BigFishGameDraftResponse {
|
||||
title: draft.title,
|
||||
subtitle: draft.subtitle,
|
||||
@@ -114,7 +120,9 @@ pub(super) fn map_big_fish_runtime_params_response(
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn map_big_fish_asset_slot_response(slot: BigFishAssetSlotRecord) -> BigFishAssetSlotResponse {
|
||||
pub(super) fn map_big_fish_asset_slot_response(
|
||||
slot: BigFishAssetSlotRecord,
|
||||
) -> BigFishAssetSlotResponse {
|
||||
BigFishAssetSlotResponse {
|
||||
slot_id: slot.slot_id,
|
||||
asset_kind: slot.asset_kind,
|
||||
@@ -140,7 +148,9 @@ pub(super) fn map_big_fish_asset_coverage_response(
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn map_big_fish_run_response(run: BigFishRuntimeRunRecord) -> BigFishRuntimeSnapshotResponse {
|
||||
pub(super) fn map_big_fish_run_response(
|
||||
run: BigFishRuntimeRunRecord,
|
||||
) -> BigFishRuntimeSnapshotResponse {
|
||||
BigFishRuntimeSnapshotResponse {
|
||||
run_id: run.run_id,
|
||||
session_id: run.session_id,
|
||||
@@ -178,7 +188,9 @@ pub(super) fn map_big_fish_runtime_entity_response(
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn map_big_fish_vector2_response(vector: BigFishVector2Record) -> BigFishVector2Response {
|
||||
pub(super) fn map_big_fish_vector2_response(
|
||||
vector: BigFishVector2Record,
|
||||
) -> BigFishVector2Response {
|
||||
BigFishVector2Response {
|
||||
x: vector.x,
|
||||
y: vector.y,
|
||||
@@ -317,5 +329,3 @@ pub(super) fn build_big_fish_welcome_text(seed_text: &str) -> String {
|
||||
}
|
||||
"我已经收到你的玩法起点,会先把它整理成锚点并准备结果页草稿。".to_string()
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user