3D 提交地址改成按 endpoint 穷尽映射
- src/services/image-editor/editorProjectClient.ts:新增 EDITOR_MODEL3D_ENDPOINT_API(Record<Model3dPricingEndpoint, string>)取代三元判断;原写法对非 image-to-model 的值一律回落 text-to-model,endpoint 联合扩容时会静默走错接口 验证:npx tsc -p tsconfig.typecheck-guardrails.json --noEmit
This commit is contained in:
@@ -721,6 +721,12 @@ export type EditorGenerationModelPricing = {
|
||||
|
||||
export type Model3dPricingEndpoint = 'text-to-model' | 'image-to-model';
|
||||
|
||||
/** endpoint 到提交地址的穷尽映射:新增 endpoint 时这里会缺键并报编译错误。 */
|
||||
const EDITOR_MODEL3D_ENDPOINT_API: Record<Model3dPricingEndpoint, string> = {
|
||||
'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<Model3dGenerationSubmissionResponse>(
|
||||
endpoint === 'image-to-model'
|
||||
? EDITOR_MODEL3D_IMAGE_TO_MODEL_API
|
||||
: EDITOR_MODEL3D_TEXT_TO_MODEL_API,
|
||||
EDITOR_MODEL3D_ENDPOINT_API[endpoint],
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user