From bacfe4d5f83302a22a620e15c0d37787c11071a4 Mon Sep 17 00:00:00 2001 From: lyzno1 Date: Tue, 5 Aug 2025 20:23:55 +0800 Subject: [PATCH] fix(zh-hans): establish strong dependency between transfer_method and file parameters - Replace loose `oneOf` validation with strict conditional dependencies using `anyOf` - `transfer_method: "remote_url"` now requires `url` and prohibits `upload_file_id` - `transfer_method: "local_file"` now requires `upload_file_id` and prohibits `url` - Applied same fix pattern as English version to all Chinese OpenAPI files - Prevents invalid combinations like remote_url + upload_file_id Fixed files: - zh-hans/openapi_workflow.json (InputFileObjectWorkflowCn) - zh-hans/openapi_chatflow.json (InputFileObjectCn) - zh-hans/openapi_chat.json (BasicInputFileObjectCn) - zh-hans/openapi_completion.json (InputFileObject) --- zh-hans/openapi_chat.json | 25 +++++++++++++++++++++---- zh-hans/openapi_chatflow.json | 25 +++++++++++++++++++++---- zh-hans/openapi_completion.json | 25 +++++++++++++++++++++---- zh-hans/openapi_workflow.json | 25 +++++++++++++++++++++---- 4 files changed, 84 insertions(+), 16 deletions(-) diff --git a/zh-hans/openapi_chat.json b/zh-hans/openapi_chat.json index 605af5eb..d8aad4de 100644 --- a/zh-hans/openapi_chat.json +++ b/zh-hans/openapi_chat.json @@ -482,11 +482,28 @@ "required": ["type", "transfer_method"], "properties": { "type": { "type": "string", "enum": ["image"], "description": "文件类型,目前仅支持 'image'。" }, - "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式。" }, - "url": { "type": "string", "format": "url", "description": "图片地址 (当 transfer_method 为 remote_url 时)。" }, - "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID (当 transfer_method 为 local_file 时)。" } + "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式,remote_url 用于图片 URL / local_file 用于文件上传" }, + "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 remote_url 时)" }, + "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID,必须通过事先上传文件接口获得(当传递方式为 local_file 时)" } }, - "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ] + "anyOf": [ + { + "properties": { + "transfer_method": { "enum": ["remote_url"] }, + "url": { "type": "string", "format": "url" } + }, + "required": ["url"], + "not": { "required": ["upload_file_id"] } + }, + { + "properties": { + "transfer_method": { "enum": ["local_file"] }, + "upload_file_id": { "type": "string", "format":"uuid" } + }, + "required": ["upload_file_id"], + "not": { "required": ["url"] } + } + ] }, "ChatCompletionResponseCn": { "type": "object", "description": "阻塞模式下的完整 App 结果。", diff --git a/zh-hans/openapi_chatflow.json b/zh-hans/openapi_chatflow.json index b6b99753..dd6095e2 100644 --- a/zh-hans/openapi_chatflow.json +++ b/zh-hans/openapi_chatflow.json @@ -544,11 +544,28 @@ "required": ["type", "transfer_method"], "properties": { "type": { "type": "string", "enum": ["document", "image", "audio", "video", "custom"], "description": "文件类型。document: TXT,MD,PDF等; image: JPG,PNG等; audio: MP3,WAV等; video: MP4,MOV等; custom: 其他。" }, - "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式。" }, - "url": { "type": "string", "format": "url", "description": "图片地址 (当 transfer_method 为 remote_url 时)。" }, - "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID (当 transfer_method 为 local_file 时)。" } + "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式,remote_url 用于图片 URL / local_file 用于文件上传" }, + "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 remote_url 时)" }, + "upload_file_id": { "type": "string", "format":"uuid", "description": "上传文件 ID,必须通过事先上传文件接口获得(当传递方式为 local_file 时)" } }, - "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ] + "anyOf": [ + { + "properties": { + "transfer_method": { "enum": ["remote_url"] }, + "url": { "type": "string", "format": "url" } + }, + "required": ["url"], + "not": { "required": ["upload_file_id"] } + }, + { + "properties": { + "transfer_method": { "enum": ["local_file"] }, + "upload_file_id": { "type": "string", "format":"uuid" } + }, + "required": ["upload_file_id"], + "not": { "required": ["url"] } + } + ] }, "ChatCompletionResponseCn": { "type": "object", "description": "阻塞模式下的完整 App 结果。", diff --git a/zh-hans/openapi_completion.json b/zh-hans/openapi_completion.json index 23eaafc2..10c58cb1 100644 --- a/zh-hans/openapi_completion.json +++ b/zh-hans/openapi_completion.json @@ -447,11 +447,28 @@ "required": ["type", "transfer_method"], "properties": { "type": { "type": "string", "enum": ["image"], "description": "支持类型:图片 `image`。" }, - "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式:`remote_url` (图片地址) 或 `local_file` (上传文件)。" }, - "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 `remote_url` 时)。" }, - "upload_file_id": { "type": "string", "description": "上传文件 ID(当传递方式为 `local_file` 时,需通过文件上传 API 预先获取)。" } + "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式,remote_url 用于图片 URL / local_file 用于文件上传" }, + "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 remote_url 时)" }, + "upload_file_id": { "type": "string", "description": "上传文件 ID,必须通过事先上传文件接口获得(当传递方式为 local_file 时)" } }, - "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ] + "anyOf": [ + { + "properties": { + "transfer_method": { "enum": ["remote_url"] }, + "url": { "type": "string", "format": "url" } + }, + "required": ["url"], + "not": { "required": ["upload_file_id"] } + }, + { + "properties": { + "transfer_method": { "enum": ["local_file"] }, + "upload_file_id": { "type": "string" } + }, + "required": ["upload_file_id"], + "not": { "required": ["url"] } + } + ] }, "ChatCompletionResponse": { "type": "object", diff --git a/zh-hans/openapi_workflow.json b/zh-hans/openapi_workflow.json index 1708c580..a4ad6b9d 100644 --- a/zh-hans/openapi_workflow.json +++ b/zh-hans/openapi_workflow.json @@ -265,11 +265,28 @@ "required": ["type", "transfer_method"], "properties": { "type": { "type": "string", "enum": ["document", "image", "audio", "video", "custom"], "description": "文件类型。document: TXT,MD,PDF等; image: JPG,PNG等; audio: MP3,WAV等; video: MP4,MOV等; custom: 其他。" }, - "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式。" }, - "url": { "type": "string", "format": "url", "description": "图片地址 (当 transfer_method 为 remote_url 时)。" }, - "upload_file_id": { "type": "string", "format": "uuid", "description": "上传文件 ID (当 transfer_method 为 local_file 时)。" } + "transfer_method": { "type": "string", "enum": ["remote_url", "local_file"], "description": "传递方式,remote_url 用于图片 URL / local_file 用于文件上传" }, + "url": { "type": "string", "format": "url", "description": "图片地址(当传递方式为 remote_url 时)" }, + "upload_file_id": { "type": "string", "description": "上传文件 ID,必须通过事先上传文件接口获得(当传递方式为 local_file 时)" } }, - "oneOf": [ {"required": ["url"]}, {"required": ["upload_file_id"]} ] + "anyOf": [ + { + "properties": { + "transfer_method": { "enum": ["remote_url"] }, + "url": { "type": "string", "format": "url" } + }, + "required": ["url"], + "not": { "required": ["upload_file_id"] } + }, + { + "properties": { + "transfer_method": { "enum": ["local_file"] }, + "upload_file_id": { "type": "string" } + }, + "required": ["upload_file_id"], + "not": { "required": ["url"] } + } + ] }, "WorkflowCompletionResponseCn": { "type": "object", "description": "阻塞模式下的 workflow 执行结果。",