把画布占位载荷移出受feature门控的assets模块
- 新增 shared-contracts::editor_canvas,承载画布占位与回填载荷并接入 ts-rs 生成 - assets 模块改为内部引用该类型,不再自带定义 - api-server 七处引用改到新模块路径
This commit is contained in:
@@ -3654,7 +3654,7 @@ fn prepare_editor_video_result(
|
||||
}
|
||||
|
||||
fn build_editor_character_animation_canvas_placement_item(
|
||||
completion: &shared_contracts::assets::EditorCanvasGenerationCompletionPayload,
|
||||
completion: &shared_contracts::editor_canvas::EditorCanvasGenerationCompletionPayload,
|
||||
resource_id: &str,
|
||||
width: u32,
|
||||
height: u32,
|
||||
|
||||
@@ -8,15 +8,15 @@ use platform_oss::{
|
||||
LegacyAssetPrefix, OssObjectAccess, OssPutObjectRequest, OssSignedGetObjectUrlRequest,
|
||||
};
|
||||
use serde_json::{Value, json};
|
||||
use shared_contracts::assets::{
|
||||
EditorCanvasGenerationCompletionPayload, EditorCanvasGenerationPlaceholderPayload,
|
||||
};
|
||||
use shared_contracts::editor_agent::{
|
||||
EDITOR_AGENT_ATTACHMENT_LABEL_MAX_CODE_POINTS, EDITOR_AGENT_MESSAGES_DOCUMENT_VERSION,
|
||||
EditorAgentAttachmentRef, EditorAgentAttachmentSource, EditorAgentConversationDetail,
|
||||
EditorAgentConversationMessagesDocument, EditorAgentConversationSummary,
|
||||
EditorAgentGeneratedImage, EditorAgentMessage,
|
||||
};
|
||||
use shared_contracts::editor_canvas::{
|
||||
EditorCanvasGenerationCompletionPayload, EditorCanvasGenerationPlaceholderPayload,
|
||||
};
|
||||
use shared_kernel::normalize_required_string;
|
||||
use spacetime_client::{
|
||||
EditorAgentConversationRecord, EditorAssetLibraryRecord, EditorAssetRecord,
|
||||
|
||||
@@ -28,10 +28,10 @@ use serde_json::{Value, json};
|
||||
use sha2::{Digest as _, Sha256};
|
||||
#[cfg(test)]
|
||||
use shared_contracts::assets::EditorAudioGenerateResponse;
|
||||
use shared_contracts::assets::{
|
||||
EDITOR_ASSET_LABEL_MAX_CHARS,
|
||||
use shared_contracts::assets::{EDITOR_ASSET_LABEL_MAX_CHARS, EditorSceneGenerateRequest};
|
||||
use shared_contracts::editor_canvas::{
|
||||
EditorCanvasGenerationCompletionPayload as EditorCanvasGenerationCompletionRequest,
|
||||
EditorCanvasGenerationPlaceholderPayload, EditorSceneGenerateRequest,
|
||||
EditorCanvasGenerationPlaceholderPayload,
|
||||
};
|
||||
use shared_contracts::editor_generation::editor_generation_request_fingerprint;
|
||||
use shared_contracts::editor_generation::{
|
||||
|
||||
@@ -22,7 +22,7 @@ use platform_oss::{LegacyAssetPrefix, OssHeadObjectRequest, OssObjectAccess};
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer, de};
|
||||
use serde_json::{Value, json};
|
||||
use sha2::{Digest as _, Sha256};
|
||||
use shared_contracts::assets::EditorCanvasGenerationCompletionPayload;
|
||||
use shared_contracts::editor_canvas::EditorCanvasGenerationCompletionPayload;
|
||||
use shared_contracts::editor_generation::editor_generation_stable_asset_object_id;
|
||||
use shared_kernel::build_prefixed_uuid_id;
|
||||
use spacetime_client::editor_project::{
|
||||
|
||||
@@ -7,7 +7,7 @@ use axum::{
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
use shared_contracts::assets::EditorCanvasGenerationCompletionPayload;
|
||||
use shared_contracts::editor_canvas::EditorCanvasGenerationCompletionPayload;
|
||||
use shared_contracts::external_generation::{
|
||||
ExternalEditorGenerationJobResponse, ExternalEditorGenerationSubmissionResponse,
|
||||
ExternalGenerationJobStatus,
|
||||
|
||||
@@ -1187,7 +1187,8 @@ struct LegacyEditorImageEditWorkerPayload {
|
||||
asset_label: Option<String>,
|
||||
source_resource_id: Option<String>,
|
||||
target_layer_id: Option<String>,
|
||||
canvas_completion: Option<shared_contracts::assets::EditorCanvasGenerationCompletionPayload>,
|
||||
canvas_completion:
|
||||
Option<shared_contracts::editor_canvas::EditorCanvasGenerationCompletionPayload>,
|
||||
}
|
||||
|
||||
fn parse_editor_image_edit_worker_payload(
|
||||
|
||||
@@ -11,6 +11,7 @@ use platform_oss::LegacyAssetPrefix;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use shared_contracts::assets;
|
||||
use shared_contracts::editor_canvas;
|
||||
use shared_contracts::editor_generation::{
|
||||
editor_generation_request_fingerprint, editor_generation_stable_asset_binding_id,
|
||||
editor_generation_stable_asset_object_id,
|
||||
@@ -460,7 +461,7 @@ struct ProductionSoundEffectWorkerStages<'a> {
|
||||
operation_id: &'a str,
|
||||
target: AudioAssetBindingTarget,
|
||||
project_id: Option<String>,
|
||||
canvas_completion: Option<assets::EditorCanvasGenerationCompletionPayload>,
|
||||
canvas_completion: Option<editor_canvas::EditorCanvasGenerationCompletionPayload>,
|
||||
asset_folder_id: Option<String>,
|
||||
asset_label: Option<String>,
|
||||
normalized: &'a NormalizedEditorSoundEffectRequest,
|
||||
@@ -1171,7 +1172,7 @@ struct PreparedEditorAudioGenerationInput {
|
||||
prompt: String,
|
||||
model: String,
|
||||
generation_inputs: Option<Value>,
|
||||
canvas_completion: Option<assets::EditorCanvasGenerationCompletionPayload>,
|
||||
canvas_completion: Option<editor_canvas::EditorCanvasGenerationCompletionPayload>,
|
||||
price_mud_points: u32,
|
||||
generated: PreparedGeneratedEditorAudio,
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ use std::collections::BTreeMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::editor_canvas::EditorCanvasGenerationCompletionPayload;
|
||||
use crate::external_generation::ExternalGenerationJobStatusRecord;
|
||||
|
||||
pub const EDITOR_ASSET_LABEL_MAX_CHARS: usize = 80;
|
||||
@@ -472,26 +473,6 @@ pub struct EditorVideoGenerateResponse {
|
||||
pub queue_state: Option<ExternalGenerationJobStatusRecord>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EditorCanvasGenerationPlaceholderPayload {
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
pub width: f64,
|
||||
pub height: f64,
|
||||
pub original_width: f64,
|
||||
pub original_height: f64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EditorCanvasGenerationCompletionPayload {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub dialog_id: Option<String>,
|
||||
pub title: String,
|
||||
pub placeholder: EditorCanvasGenerationPlaceholderPayload,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct EditorIconSpritesheetGenerateRequest {
|
||||
@@ -1106,6 +1087,7 @@ pub struct AssetBindingPayload {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::editor_canvas::EditorCanvasGenerationPlaceholderPayload;
|
||||
use serde_json::json;
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
//! 图片画布占位框与生成完成回填载荷。
|
||||
//!
|
||||
//! 这些类型是纯 DTO,不依赖 OSS 契约,因此不放在受 `oss-contracts` feature
|
||||
//! 门控的 `assets` 模块里:3D 生成等不带该 feature 的构建也需要引用它们。
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub(crate) const EDITOR_CANVAS_TS_EXPORT_DIR: &str = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../../packages/shared/src/contracts/editor-canvas/"
|
||||
);
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[derive(ts_rs::TS)]
|
||||
#[ts(export, export_to = EDITOR_CANVAS_TS_EXPORT_DIR)]
|
||||
pub struct EditorCanvasGenerationPlaceholderPayload {
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
pub width: f64,
|
||||
pub height: f64,
|
||||
pub original_width: f64,
|
||||
pub original_height: f64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[derive(ts_rs::TS)]
|
||||
#[ts(export, export_to = EDITOR_CANVAS_TS_EXPORT_DIR)]
|
||||
pub struct EditorCanvasGenerationCompletionPayload {
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional = nullable)]
|
||||
pub dialog_id: Option<String>,
|
||||
pub title: String,
|
||||
pub placeholder: EditorCanvasGenerationPlaceholderPayload,
|
||||
}
|
||||
@@ -19,6 +19,7 @@ pub mod creation_entry_config;
|
||||
#[cfg(any())]
|
||||
pub mod creative_agent;
|
||||
pub mod editor_agent;
|
||||
pub mod editor_canvas;
|
||||
pub mod editor_generation;
|
||||
pub mod error_reports;
|
||||
pub use editor_generation::{
|
||||
|
||||
Reference in New Issue
Block a user