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: {