From 950209f03882e46f2a7547fddf5820d54675ec2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 19 Sep 2026 13:04:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=20model3d=20=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E5=A5=91=E7=BA=A6=E7=9A=84=E5=8F=AF=E9=80=89=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E8=A1=A5=E5=85=85=20ts(optional)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为 image_to_model、multiview_to_model、text_to_model 三个请求的可选字段添加 ts(optional = nullable) multiview 视图分支的 left、back、right 同步标记为可选 重新生成 packages/shared/src/contracts/model3d 下的 TypeScript 绑定,使 TS 侧可按 serde 语义省略字段 --- .../Model3dImageToModelRequest.ts | 40 +++++++++---------- .../Model3dMultiviewInputs.ts | 6 +-- .../Model3dMultiviewToModelRequest.ts | 38 +++++++++--------- .../Model3dTextToModelRequest.ts | 38 +++++++++--------- .../src/model3d/image_to_model/request.rs | 20 ++++++++++ .../src/model3d/multiview_to_model/request.rs | 22 ++++++++++ .../src/model3d/text_to_model/request.rs | 19 +++++++++ 7 files changed, 122 insertions(+), 61 deletions(-) diff --git a/packages/shared/src/contracts/model3d/image-to-model/Model3dImageToModelRequest.ts b/packages/shared/src/contracts/model3d/image-to-model/Model3dImageToModelRequest.ts index 3c140c820..5f0d9e56d 100644 --- a/packages/shared/src/contracts/model3d/image-to-model/Model3dImageToModelRequest.ts +++ b/packages/shared/src/contracts/model3d/image-to-model/Model3dImageToModelRequest.ts @@ -10,24 +10,24 @@ import type { Model3dTextureVersion } from '../common/Model3dTextureVersion'; export type Model3dImageToModelRequest = { input: string; - model: Model3dModelVersion | null; - enableImageAutofix: boolean | null; - modelSeed: number | null; - textureSeed: number | null; - texture: boolean | null; - pbr: boolean | null; - textureQuality: Model3dTextureQuality | null; - textureVersion: Model3dTextureVersion | null; - delight: boolean | null; - textureAlignment: Model3dTextureAlignment | null; - geometryQuality: Model3dGeometryQuality | null; - faceLimit: number | null; - autoSize: boolean | null; - orientation: Model3dInputOrientation | null; - quad: boolean | null; - smartLowPoly: boolean | null; - generateParts: boolean | null; - compress: Model3dCompression | null; - exportUv: boolean | null; - exportOrientation: Model3dExportOrientation | null; + model?: Model3dModelVersion | null; + enableImageAutofix?: boolean | null; + modelSeed?: number | null; + textureSeed?: number | null; + texture?: boolean | null; + pbr?: boolean | null; + textureQuality?: Model3dTextureQuality | null; + textureVersion?: Model3dTextureVersion | null; + delight?: boolean | null; + textureAlignment?: Model3dTextureAlignment | null; + geometryQuality?: Model3dGeometryQuality | null; + faceLimit?: number | null; + autoSize?: boolean | null; + orientation?: Model3dInputOrientation | null; + quad?: boolean | null; + smartLowPoly?: boolean | null; + generateParts?: boolean | null; + compress?: Model3dCompression | null; + exportUv?: boolean | null; + exportOrientation?: Model3dExportOrientation | null; }; diff --git a/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewInputs.ts b/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewInputs.ts index d5d145b9a..a3159a264 100644 --- a/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewInputs.ts +++ b/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewInputs.ts @@ -4,8 +4,8 @@ export type Model3dMultiviewInputs = | { kind: 'views'; front: string; - left: string | null; - back: string | null; - right: string | null; + left?: string | null; + back?: string | null; + right?: string | null; } | { kind: 'taskId'; taskId: string }; diff --git a/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewToModelRequest.ts b/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewToModelRequest.ts index 62efeddc9..1d44e7796 100644 --- a/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewToModelRequest.ts +++ b/packages/shared/src/contracts/model3d/multiview-to-model/Model3dMultiviewToModelRequest.ts @@ -11,23 +11,23 @@ import type { Model3dMultiviewInputs } from './Model3dMultiviewInputs'; export type Model3dMultiviewToModelRequest = { inputs: Model3dMultiviewInputs; - model: Model3dModelVersion | null; - modelSeed: number | null; - textureSeed: number | null; - texture: boolean | null; - pbr: boolean | null; - textureQuality: Model3dTextureQuality | null; - textureVersion: Model3dTextureVersion | null; - delight: boolean | null; - geometryQuality: Model3dGeometryQuality | null; - textureAlignment: Model3dTextureAlignment | null; - faceLimit: number | null; - autoSize: boolean | null; - orientation: Model3dInputOrientation | null; - quad: boolean | null; - smartLowPoly: boolean | null; - generateParts: boolean | null; - compress: Model3dCompression | null; - exportUv: boolean | null; - exportOrientation: Model3dExportOrientation | null; + model?: Model3dModelVersion | null; + modelSeed?: number | null; + textureSeed?: number | null; + texture?: boolean | null; + pbr?: boolean | null; + textureQuality?: Model3dTextureQuality | null; + textureVersion?: Model3dTextureVersion | null; + delight?: boolean | null; + geometryQuality?: Model3dGeometryQuality | null; + textureAlignment?: Model3dTextureAlignment | null; + faceLimit?: number | null; + autoSize?: boolean | null; + orientation?: Model3dInputOrientation | null; + quad?: boolean | null; + smartLowPoly?: boolean | null; + generateParts?: boolean | null; + compress?: Model3dCompression | null; + exportUv?: boolean | null; + exportOrientation?: Model3dExportOrientation | null; }; diff --git a/packages/shared/src/contracts/model3d/text-to-model/Model3dTextToModelRequest.ts b/packages/shared/src/contracts/model3d/text-to-model/Model3dTextToModelRequest.ts index f576d2990..d1e6633b0 100644 --- a/packages/shared/src/contracts/model3d/text-to-model/Model3dTextToModelRequest.ts +++ b/packages/shared/src/contracts/model3d/text-to-model/Model3dTextToModelRequest.ts @@ -8,23 +8,23 @@ import type { Model3dTextureVersion } from '../common/Model3dTextureVersion'; export type Model3dTextToModelRequest = { prompt: string; - model: Model3dModelVersion | null; - negativePrompt: string | null; - imageSeed: number | null; - modelSeed: number | null; - textureSeed: number | null; - texture: boolean | null; - pbr: boolean | null; - textureQuality: Model3dTextureQuality | null; - textureVersion: Model3dTextureVersion | null; - delight: boolean | null; - geometryQuality: Model3dGeometryQuality | null; - faceLimit: number | null; - autoSize: boolean | null; - quad: boolean | null; - smartLowPoly: boolean | null; - generateParts: boolean | null; - compress: Model3dCompression | null; - exportUv: boolean | null; - exportOrientation: Model3dExportOrientation | null; + model?: Model3dModelVersion | null; + negativePrompt?: string | null; + imageSeed?: number | null; + modelSeed?: number | null; + textureSeed?: number | null; + texture?: boolean | null; + pbr?: boolean | null; + textureQuality?: Model3dTextureQuality | null; + textureVersion?: Model3dTextureVersion | null; + delight?: boolean | null; + geometryQuality?: Model3dGeometryQuality | null; + faceLimit?: number | null; + autoSize?: boolean | null; + quad?: boolean | null; + smartLowPoly?: boolean | null; + generateParts?: boolean | null; + compress?: Model3dCompression | null; + exportUv?: boolean | null; + exportOrientation?: Model3dExportOrientation | null; }; diff --git a/server-rs/crates/shared-contracts/src/model3d/image_to_model/request.rs b/server-rs/crates/shared-contracts/src/model3d/image_to_model/request.rs index 4698f1ad0..4b5e15892 100644 --- a/server-rs/crates/shared-contracts/src/model3d/image_to_model/request.rs +++ b/server-rs/crates/shared-contracts/src/model3d/image_to_model/request.rs @@ -13,27 +13,47 @@ use super::MODEL3D_TS_EXPORT_DIR; #[ts(export, export_to = MODEL3D_TS_EXPORT_DIR)] pub struct Model3dImageToModelRequest { pub input: String, + #[ts(optional = nullable)] pub model: Option, + #[ts(optional = nullable)] pub enable_image_autofix: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub model_seed: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub texture_seed: Option, + #[ts(optional = nullable)] pub texture: Option, + #[ts(optional = nullable)] pub pbr: Option, + #[ts(optional = nullable)] pub texture_quality: Option, + #[ts(optional = nullable)] pub texture_version: Option, + #[ts(optional = nullable)] pub delight: Option, + #[ts(optional = nullable)] pub texture_alignment: Option, + #[ts(optional = nullable)] pub geometry_quality: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub face_limit: Option, + #[ts(optional = nullable)] pub auto_size: Option, + #[ts(optional = nullable)] pub orientation: Option, + #[ts(optional = nullable)] pub quad: Option, + #[ts(optional = nullable)] pub smart_low_poly: Option, + #[ts(optional = nullable)] pub generate_parts: Option, + #[ts(optional = nullable)] pub compress: Option, + #[ts(optional = nullable)] pub export_uv: Option, + #[ts(optional = nullable)] pub export_orientation: Option, } diff --git a/server-rs/crates/shared-contracts/src/model3d/multiview_to_model/request.rs b/server-rs/crates/shared-contracts/src/model3d/multiview_to_model/request.rs index ef7c0a330..958a0eda7 100644 --- a/server-rs/crates/shared-contracts/src/model3d/multiview_to_model/request.rs +++ b/server-rs/crates/shared-contracts/src/model3d/multiview_to_model/request.rs @@ -14,8 +14,11 @@ use super::MODEL3D_TS_EXPORT_DIR; pub enum Model3dMultiviewInputs { Views { front: String, + #[ts(optional = nullable)] left: Option, + #[ts(optional = nullable)] back: Option, + #[ts(optional = nullable)] right: Option, }, TaskId { @@ -30,26 +33,45 @@ pub enum Model3dMultiviewInputs { #[ts(export, export_to = MODEL3D_TS_EXPORT_DIR)] pub struct Model3dMultiviewToModelRequest { pub inputs: Model3dMultiviewInputs, + #[ts(optional = nullable)] pub model: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub model_seed: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub texture_seed: Option, + #[ts(optional = nullable)] pub texture: Option, + #[ts(optional = nullable)] pub pbr: Option, + #[ts(optional = nullable)] pub texture_quality: Option, + #[ts(optional = nullable)] pub texture_version: Option, + #[ts(optional = nullable)] pub delight: Option, + #[ts(optional = nullable)] pub geometry_quality: Option, + #[ts(optional = nullable)] pub texture_alignment: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub face_limit: Option, + #[ts(optional = nullable)] pub auto_size: Option, + #[ts(optional = nullable)] pub orientation: Option, + #[ts(optional = nullable)] pub quad: Option, + #[ts(optional = nullable)] pub smart_low_poly: Option, + #[ts(optional = nullable)] pub generate_parts: Option, + #[ts(optional = nullable)] pub compress: Option, + #[ts(optional = nullable)] pub export_uv: Option, + #[ts(optional = nullable)] pub export_orientation: Option, } diff --git a/server-rs/crates/shared-contracts/src/model3d/text_to_model/request.rs b/server-rs/crates/shared-contracts/src/model3d/text_to_model/request.rs index 76f9ed78d..62a690e3b 100644 --- a/server-rs/crates/shared-contracts/src/model3d/text_to_model/request.rs +++ b/server-rs/crates/shared-contracts/src/model3d/text_to_model/request.rs @@ -12,27 +12,46 @@ use crate::model3d::common::{ #[ts(export, export_to = MODEL3D_TS_EXPORT_DIR)] pub struct Model3dTextToModelRequest { pub prompt: String, + #[ts(optional = nullable)] pub model: Option, + #[ts(optional = nullable)] pub negative_prompt: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub image_seed: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub model_seed: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub texture_seed: Option, + #[ts(optional = nullable)] pub texture: Option, + #[ts(optional = nullable)] pub pbr: Option, + #[ts(optional = nullable)] pub texture_quality: Option, + #[ts(optional = nullable)] pub texture_version: Option, + #[ts(optional = nullable)] pub delight: Option, + #[ts(optional = nullable)] pub geometry_quality: Option, #[ts(type = "number | null")] + #[ts(optional = nullable)] pub face_limit: Option, + #[ts(optional = nullable)] pub auto_size: Option, + #[ts(optional = nullable)] pub quad: Option, + #[ts(optional = nullable)] pub smart_low_poly: Option, + #[ts(optional = nullable)] pub generate_parts: Option, + #[ts(optional = nullable)] pub compress: Option, + #[ts(optional = nullable)] pub export_uv: Option, + #[ts(optional = nullable)] pub export_orientation: Option, }