From 3e87f915d54434e9b4fa2e906364541d61d1f364 Mon Sep 17 00:00:00 2001 From: ZeroZ_JQ Date: Thu, 24 Apr 2025 13:01:08 +0800 Subject: [PATCH] feat: add documentation for remote file upload feature across multiple languages --- .../develop/template/template.en.mdx | 70 ++++++++++++++++++ .../develop/template/template.ja.mdx | 70 ++++++++++++++++++ .../develop/template/template.zh.mdx | 69 ++++++++++++++++++ .../template/template_advanced_chat.en.mdx | 70 ++++++++++++++++++ .../template/template_advanced_chat.ja.mdx | 68 ++++++++++++++++++ .../template/template_advanced_chat.zh.mdx | 69 ++++++++++++++++++ .../develop/template/template_chat.en.mdx | 71 +++++++++++++++++++ .../develop/template/template_chat.ja.mdx | 70 ++++++++++++++++++ .../develop/template/template_chat.zh.mdx | 69 ++++++++++++++++++ .../develop/template/template_workflow.en.mdx | 69 ++++++++++++++++++ .../develop/template/template_workflow.ja.mdx | 70 ++++++++++++++++++ .../develop/template/template_workflow.zh.mdx | 71 +++++++++++++++++++ 12 files changed, 836 insertions(+) diff --git a/web/app/components/develop/template/template.en.mdx b/web/app/components/develop/template/template.en.mdx index 75f044f780..6f2197f65e 100755 --- a/web/app/components/develop/template/template.en.mdx +++ b/web/app/components/develop/template/template.en.mdx @@ -275,6 +275,76 @@ The text generation application offers non-session support and is ideal for tran + +--- + + + + + Upload a remote file via URL for use when sending messages, enabling multimodal understanding. + Uploaded files are for use by the current end-user only. + + ### Request Body + + + The URL address of the remote file. + + + + ### Response + After a successful upload, the server will return the file's ID and related information. + - `id` (uuid) ID + - `name` (string) File name + - `size` (int) File size (bytes) + - `extension` (string) File extension + - `mime_type` (string) File mime-type + - `created_by` (uuid) End-user ID + - `created_at` (timestamp) Creation timestamp + - `url` (string) The signed access URL of the file + + ### Errors + - 400, `remote_file_upload_error`, Remote file upload failed, including the following cases: + - Request timeout + - Network error + - Empty file content + - File processing failure + - 400, `file_too_large`, The file is too large + - 400, `unsupported_file_type`, Unsupported extension + - 503, `s3_connection_failed`, Unable to connect to S3 service + - 503, `s3_permission_denied`, No permission to upload files to S3 + - 503, `s3_file_too_large`, File exceeds S3 size limit + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + --- + +--- + + + + + URLを使用してリモートファイルをアップロードし、メッセージ送信時に使用することで、マルチモーダルな理解を可能にします。 + アップロードされたファイルは、現在のエンドユーザーのみが使用できます。 + + ### リクエストボディ + + + リモートファイルのURLアドレス。 + + + + ### レスポンス + アップロードが成功すると、サーバーはファイルのIDと関連情報を返します。 + - `id` (uuid) ID + - `name` (string) ファイル名 + - `size` (int) ファイルサイズ(バイト) + - `extension` (string) ファイル拡張子 + - `mime_type` (string) ファイルのMIMEタイプ + - `created_by` (uuid) エンドユーザーID + - `created_at` (timestamp) 作成タイムスタンプ + - `url` (string) ファイルの署名付きアクセスURL + + ### エラー + - 400, `remote_file_upload_error`, リモートファイルのアップロードに失敗しました。以下の場合が含まれます: + - リクエストタイムアウト + - ネットワークエラー + - 空のファイル内容 + - ファイル処理の失敗 + - 400, `file_too_large`, ファイルが大きすぎます + - 400, `unsupported_file_type`, サポートされていない拡張子です + - 503, `s3_connection_failed`, S3サービスに接続できません + - 503, `s3_permission_denied`, S3へのファイルアップロード権限がありません + - 503, `s3_file_too_large`, ファイルがS3のサイズ制限を超えています + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + --- + +--- + + + + 通过URL上传远程文件并在发送消息时使用,可实现多模态理解。 + 上传的文件仅供当前终端用户使用。 + + ### Request Body + + + 远程文件的URL地址。 + + + + ### Response + 成功上传后,服务器会返回文件的 ID 和相关信息。 + - `id` (uuid) ID + - `name` (string) 文件名 + - `size` (int) 文件大小(byte) + - `extension` (string) 文件后缀 + - `mime_type` (string) 文件 mime-type + - `created_by` (uuid) 上传人 ID + - `created_at` (timestamp) 上传时间 + - `url` (string) 文件的签名访问URL + + ### Errors + - 400,`remote_file_upload_error`,远程文件上传失败,包括以下情况: + - 请求超时 + - 网络错误 + - 空文件内容 + - 文件处理失败 + - 400,`file_too_large`,文件太大 + - 400,`unsupported_file_type`,不支持的扩展名 + - 503,`s3_connection_failed`,无法连接到 S3 服务 + - 503,`s3_permission_denied`,无权限上传文件到 S3 + - 503,`s3_file_too_large`,文件超出 S3 大小限制 + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + --- + +--- + + + + + Upload a remote file via URL for use when sending messages, enabling multimodal understanding. + Uploaded files are for use by the current end-user only. + + ### Request Body + + + The URL address of the remote file. + + + + ### Response + After a successful upload, the server will return the file's ID and related information. + - `id` (uuid) ID + - `name` (string) File name + - `size` (int) File size (bytes) + - `extension` (string) File extension + - `mime_type` (string) File mime-type + - `created_by` (uuid) End-user ID + - `created_at` (timestamp) Creation timestamp + - `url` (string) The signed access URL of the file + + ### Errors + - 400, `remote_file_upload_error`, Remote file upload failed, including the following cases: + - Request timeout + - Network error + - Empty file content + - File processing failure + - 400, `file_too_large`, The file is too large + - 400, `unsupported_file_type`, Unsupported extension + - 503, `s3_connection_failed`, Unable to connect to S3 service + - 503, `s3_permission_denied`, No permission to upload files to S3 + - 503, `s3_file_too_large`, File exceeds S3 size limit + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13", + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + --- --- + + + + URLを使用してリモートファイルをアップロードし、メッセージ送信時に使用することで、マルチモーダルな理解を可能にします。 + アップロードされたファイルは、現在のエンドユーザーのみが使用できます。 + + ### リクエストボディ + + + リモートファイルのURLアドレス。 + + + + ### レスポンス + アップロードが成功すると、サーバーはファイルのIDと関連情報を返します。 + - `id` (uuid) ID + - `name` (string) ファイル名 + - `size` (int) ファイルサイズ(バイト) + - `extension` (string) ファイル拡張子 + - `mime_type` (string) ファイルのMIMEタイプ + - `created_by` (uuid) エンドユーザーID + - `created_at` (timestamp) 作成タイムスタンプ + - `url` (string) ファイルの署名付きアクセスURL + + ### エラー + - 400, `remote_file_upload_error`, リモートファイルのアップロードに失敗しました。以下の場合が含まれます: + - リクエストタイムアウト + - ネットワークエラー + - 空のファイル内容 + - ファイル処理の失敗 + - 400, `file_too_large`, ファイルが大きすぎます + - 400, `unsupported_file_type`, サポートされていない拡張子です + - 503, `s3_connection_failed`, S3サービスに接続できません + - 503, `s3_permission_denied`, S3へのファイルアップロード権限がありません + - 503, `s3_file_too_large`, ファイルがS3のサイズ制限を超えています + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + +--- + +--- + + + + + 通过 URL 上传远程文件,用于发送消息时使用,可实现多模态理解。 + 上传的文件仅供当前终端用户使用。 + + ### Request Body + + + 远程文件的 URL 地址。 + + + + ### Response + 成功上传后,服务器会返回文件的 ID 和相关信息。 + - `id` (uuid) ID + - `name` (string) 文件名 + - `size` (int) 文件大小(byte) + - `extension` (string) 文件后缀 + - `mime_type` (string) 文件 mime-type + - `created_by` (uuid) 上传人 ID + - `created_at` (timestamp) 上传时间 + - `url` (string) 文件的签名访问 URL + + ### Errors + - 400, `remote_file_upload_error`, 远程文件上传失败,包括以下情况: + - 请求超时 + - 网络错误 + - 空文件内容 + - 文件处理失败 + - 400, `file_too_large`, 文件太大 + - 400, `unsupported_file_type`, 不支持的扩展名 + - 503, `s3_connection_failed`, 无法连接到 S3 服务 + - 503, `s3_permission_denied`, 无权限上传文件到 S3 + - 503, `s3_file_too_large`, 文件超出 S3 大小限制 + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + --- + +--- + + + + + Upload a remote file via URL for use when sending messages, enabling multimodal understanding. + Uploaded files are for use by the current end-user only. + + ### Request Body + + + The URL address of the remote file. + + + + ### Response + After a successful upload, the server will return the file's ID and related information. + - `id` (uuid) ID + - `name` (string) File name + - `size` (int) File size (bytes) + - `extension` (string) File extension + - `mime_type` (string) File mime-type + - `created_by` (uuid) End-user ID + - `created_at` (timestamp) Creation timestamp + - `url` (string) The signed access URL of the file + + ### Errors + - 400, `remote_file_upload_error`, Remote file upload failed, including the following cases: + - Request timeout + - Network error + - Empty file content + - File processing failure + - 400, `file_too_large`, The file is too large + - 400, `unsupported_file_type`, Unsupported extension + - 503, `s3_connection_failed`, Unable to connect to S3 service + - 503, `s3_permission_denied`, No permission to upload files to S3 + - 503, `s3_file_too_large`, File exceeds S3 size limit + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + + --- --- + + + + URLを使用してリモートファイルをアップロードし、メッセージ送信時に使用することで、マルチモーダルな理解を可能にします。 + アップロードされたファイルは、現在のエンドユーザーのみが使用できます。 + + ### リクエストボディ + + + リモートファイルのURLアドレス。 + + + + ### レスポンス + アップロードが成功すると、サーバーはファイルのIDと関連情報を返します。 + - `id` (uuid) ID + - `name` (string) ファイル名 + - `size` (int) ファイルサイズ(バイト) + - `extension` (string) ファイル拡張子 + - `mime_type` (string) ファイルのMIMEタイプ + - `created_by` (uuid) エンドユーザーID + - `created_at` (timestamp) 作成タイムスタンプ + - `url` (string) ファイルの署名付きアクセスURL + + ### エラー + - 400, `remote_file_upload_error`, リモートファイルのアップロードに失敗しました。以下の場合が含まれます: + - リクエストタイムアウト + - ネットワークエラー + - 空のファイル内容 + - ファイル処理の失敗 + - 400, `file_too_large`, ファイルが大きすぎます + - 400, `unsupported_file_type`, サポートされていない拡張子です + - 503, `s3_connection_failed`, S3サービスに接続できません + - 503, `s3_permission_denied`, S3へのファイルアップロード権限がありません + - 503, `s3_file_too_large`, ファイルがS3のサイズ制限を超えています + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + +--- + + diff --git a/web/app/components/develop/template/template_chat.zh.mdx b/web/app/components/develop/template/template_chat.zh.mdx index e6f49a56d9..d19277ad9d 100644 --- a/web/app/components/develop/template/template_chat.zh.mdx +++ b/web/app/components/develop/template/template_chat.zh.mdx @@ -358,6 +358,75 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx' +--- + + + + + 通过 URL 上传远程文件,用于发送消息时使用,可实现多模态理解。 + 上传的文件仅供当前终端用户使用。 + + ### Request Body + + + 远程文件的 URL 地址。 + + + + ### Response + 成功上传后,服务器会返回文件的 ID 和相关信息。 + - `id` (uuid) ID + - `name` (string) 文件名 + - `size` (int) 文件大小(byte) + - `extension` (string) 文件后缀 + - `mime_type` (string) 文件 mime-type + - `created_by` (uuid) 上传人 ID + - `created_at` (timestamp) 上传时间 + - `url` (string) 文件的签名访问 URL + + ### Errors + - 400, `remote_file_upload_error`, 远程文件上传失败,包括以下情况: + - 请求超时 + - 网络错误 + - 空文件内容 + - 文件处理失败 + - 400, `file_too_large`, 文件太大 + - 400, `unsupported_file_type`, 不支持的扩展名 + - 503, `s3_connection_failed`, 无法连接到 S3 服务 + - 503, `s3_permission_denied`, 无权限上传文件到 S3 + - 503, `s3_file_too_large`, 文件超出 S3 大小限制 + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + --- + + + Upload a remote file via URL for use when sending messages, enabling multimodal understanding. + Uploaded files are for use by the current end-user only. + + ### Request Body + + + The URL address of the remote file. + + + + ### Response + After a successful upload, the server will return the file's ID and related information. + - `id` (uuid) ID + - `name` (string) File name + - `size` (int) File size (bytes) + - `extension` (string) File extension + - `mime_type` (string) File mime-type + - `created_by` (uuid) End-user ID + - `created_at` (timestamp) Creation timestamp + - `url` (string) The signed access URL of the file + + ### Errors + - 400, `remote_file_upload_error`, Remote file upload failed, including the following cases: + - Request timeout + - Network error + - Empty file content + - File processing failure + - 400, `file_too_large`, The file is too large + - 400, `unsupported_file_type`, Unsupported extension + - 503, `s3_connection_failed`, Unable to connect to S3 service + - 503, `s3_permission_denied`, No permission to upload files to S3 + - 503, `s3_file_too_large`, File exceeds S3 size limit + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + +--- + + + + URLを使用してリモートファイルをアップロードし、メッセージ送信時に使用することで、マルチモーダルな理解を可能にします。 + アップロードされたファイルは、現在のエンドユーザーのみが使用できます。 + + ### リクエストボディ + + + リモートファイルのURLアドレス。 + + + + ### レスポンス + アップロードが成功すると、サーバーはファイルのIDと関連情報を返します。 + - `id` (uuid) ID + - `name` (string) ファイル名 + - `size` (int) ファイルサイズ(バイト) + - `extension` (string) ファイル拡張子 + - `mime_type` (string) ファイルのMIMEタイプ + - `created_by` (uuid) エンドユーザーID + - `created_at` (timestamp) 作成タイムスタンプ + - `url` (string) ファイルの署名付きアクセスURL + + ### エラー + - 400, `remote_file_upload_error`, リモートファイルのアップロードに失敗しました。以下の場合が含まれます: + - リクエストタイムアウト + - ネットワークエラー + - 空のファイル内容 + - ファイル処理の失敗 + - 400, `file_too_large`, ファイルが大きすぎます + - 400, `unsupported_file_type`, サポートされていない拡張子です + - 503, `s3_connection_failed`, S3サービスに接続できません + - 503, `s3_permission_denied`, S3へのファイルアップロード権限がありません + - 503, `s3_file_too_large`, ファイルがS3のサイズ制限を超えています + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + +--- + + --- + +--- + + + + + 通过 URL 上传远程文件,用于发送消息时使用,可实现多模态理解。 + 上传的文件仅供当前终端用户使用。 + + ### Request Body + + + 远程文件的 URL 地址。 + + + + ### Response + 成功上传后,服务器会返回文件的 ID 和相关信息。 + - `id` (uuid) ID + - `name` (string) 文件名 + - `size` (int) 文件大小(byte) + - `extension` (string) 文件后缀 + - `mime_type` (string) 文件 mime-type + - `created_by` (uuid) 上传人 ID + - `created_at` (timestamp) 上传时间 + - `url` (string) 文件的签名访问 URL + + ### Errors + - 400, `remote_file_upload_error`, 远程文件上传失败,包括以下情况: + - 请求超时 + - 网络错误 + - 空文件内容 + - 文件处理失败 + - 400, `file_too_large`, 文件太大 + - 400, `unsupported_file_type`, 不支持的扩展名 + - 503, `s3_connection_failed`, 无法连接到 S3 服务 + - 503, `s3_permission_denied`, 无权限上传文件到 S3 + - 503, `s3_file_too_large`, 文件超出 S3 大小限制 + + + + ```bash {{ title: 'cURL' }} + curl -X POST '${props.appDetail.api_base_url}/remote-files/upload' \ + --header 'Authorization: Bearer {api_key}' \ + --form 'url=https://example.com/image.jpg' + ``` + + + + ```json {{ title: 'Response' }} + { + "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67", + "name": "example.jpg", + "size": 1024, + "extension": "jpg", + "mime_type": "image/jpeg", + "created_by": 123, + "created_at": 1577836800, + "url": "https://example.com/signed-url" + } + ``` + + + + --- + ---