From 02df3552811bf6695f6bd2d66ee7d4cd5a76d745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Tue, 22 Sep 2026 13:24:43 +0800 Subject: [PATCH] =?UTF-8?q?3D=20=E6=8F=90=E4=BA=A4=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E6=94=B9=E6=88=90=E6=8C=89=20endpoint=20=E7=A9=B7=E5=B0=BD?= =?UTF-8?q?=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - src/services/image-editor/editorProjectClient.ts:新增 EDITOR_MODEL3D_ENDPOINT_API(Record)取代三元判断;原写法对非 image-to-model 的值一律回落 text-to-model,endpoint 联合扩容时会静默走错接口 验证:npx tsc -p tsconfig.typecheck-guardrails.json --noEmit --- src/services/image-editor/editorProjectClient.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/services/image-editor/editorProjectClient.ts b/src/services/image-editor/editorProjectClient.ts index 9682c53fb..9f463d45c 100644 --- a/src/services/image-editor/editorProjectClient.ts +++ b/src/services/image-editor/editorProjectClient.ts @@ -721,6 +721,12 @@ export type EditorGenerationModelPricing = { export type Model3dPricingEndpoint = 'text-to-model' | 'image-to-model'; +/** endpoint 到提交地址的穷尽映射:新增 endpoint 时这里会缺键并报编译错误。 */ +const EDITOR_MODEL3D_ENDPOINT_API: Record = { + 'text-to-model': EDITOR_MODEL3D_TEXT_TO_MODEL_API, + 'image-to-model': EDITOR_MODEL3D_IMAGE_TO_MODEL_API, +}; + export type Model3dAddOnPriceKey = | 'hdTexture' | 'ultraTexture' @@ -1740,9 +1746,7 @@ export async function submitModel3dGenerationRequest({ idempotencyKey: string; }) { return requestJson( - endpoint === 'image-to-model' - ? EDITOR_MODEL3D_IMAGE_TO_MODEL_API - : EDITOR_MODEL3D_TEXT_TO_MODEL_API, + EDITOR_MODEL3D_ENDPOINT_API[endpoint], { method: 'POST', headers: {