{"record":{"id":"d3d89d7f95349e1f","repo":"linshenkx/prompt-optimizer","slug":"unsupported-test-type","errorCode":"UNSUPPORTED_TEST_TYPE","errorMessage":"UNSUPPORTED_TEST_TYPE","messagePattern":"UNSUPPORTED_TEST_TYPE","errorType":"error_code","errorClass":"ImageError","httpStatus":null,"severity":"warning","filePath":"packages/core/src/services/image/adapters/modelscope.ts","lineNumber":108,"sourceCode":"        labelKey: 'image.params.count.label',\n        descriptionKey: 'image.params.count.description',\n        type: 'integer',\n        defaultValue: 1,\n        minValue: 1,\n        maxValue: 4\n      }\n    ]\n  }\n\n  protected getTestImageRequest(testType: 'text2image' | 'image2image'): Omit<ImageRequest, 'configId'> {\n    if (testType === 'text2image') {\n      return {\n        prompt: '一朵简单的红色花朵',\n        count: 1\n      }\n    }\n\n    throw new ImageError(IMAGE_ERROR_CODES.UNSUPPORTED_TEST_TYPE, undefined, { testType })\n  }\n\n  protected getParameterDefinitions(_modelId: string): readonly ImageParameterDefinition[] {\n    return this.getDefaultParameterDefinitions()\n  }\n\n  protected getDefaultParameterValues(_modelId: string): Record<string, unknown> {\n    return {\n      size: '1024x1024',\n      n: 1\n    }\n  }\n\n  protected async doGenerate(request: ImageRequest, config: ImageModelConfig): Promise<ImageResult> {\n    // ModelScope 适配器仅支持文生图\n    if (request.inputImage) {\n      throw new ImageError(IMAGE_ERROR_CODES.MODEL_NOT_SUPPORT_IMAGE2IMAGE, undefined, { modelName: config.modelId })\n    }","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/image/adapters/modelscope.ts#L90-L126","documentation":"The ModelScope adapter's getTestImageRequest only supports specific test types (e.g. simple t2i prompts). When asked for a test request of an unrecognized testType, it throws UNSUPPORTED_TEST_TYPE with the offending testType in metadata.","triggerScenarios":"Invoking the adapter's model-test feature with a testType other than the supported values — e.g. a UI-driven 'image2image' or 'edit' connectivity test on a ModelScope image model.","commonSituations":"A generic test-runner UI that enumerates all test types across adapters and passes unsupported ones to ModelScope; new test types added elsewhere but not implemented here.","solutions":["Pass one of the supported test types (text-to-image) for ModelScope models","Guard the test call with a capability check before requesting the test","File an adapter feature request if i2i testing is needed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['text2image' /* adapter's supported types */])\nif (!SUPPORTED.has(testType)) skipTest(modelScopeModel)","typeGuard":"function isSupportedTestType(t: string): boolean { return ['text2image'].includes(t) }","tryCatchPattern":"if (!isSupportedTestType(testType)) return { skipped: true }\nawait adapter.getTestImageRequest(testType)","preventionTips":["Gate test types per provider in the UI","Treat UNSUPPORTED_TEST_TYPE as skip, not failure"],"tags":["modelscope","test","unsupported-operation"],"backgroundTag":"unsupported-operation-parameter","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}