diff --git a/web/app/components/develop/template/template_workflow.en.mdx b/web/app/components/develop/template/template_workflow.en.mdx index 00e6189cb..f28677368 100644 --- a/web/app/components/develop/template/template_workflow.en.mdx +++ b/web/app/components/develop/template/template_workflow.en.mdx @@ -740,84 +740,6 @@ Workflow applications offers non-session support and is ideal for translation, a --- - - - - Preview or download uploaded files. This endpoint allows you to access files that have been previously uploaded via the File Upload API. - - Files can only be accessed if they belong to messages within the requesting application. - - ### Path Parameters - - `file_id` (string) Required - The unique identifier of the file to preview, obtained from the File Upload API response. - - ### Query Parameters - - `as_attachment` (boolean) Optional - Whether to force download the file as an attachment. Default is `false` (preview in browser). - - ### Response - Returns the file content with appropriate headers for browser display or download. - - `Content-Type` Set based on file mime type - - `Content-Length` File size in bytes (if available) - - `Content-Disposition` Set to "attachment" if `as_attachment=true` - - `Cache-Control` Caching headers for performance - - `Accept-Ranges` Set to "bytes" for audio/video files - - ### Errors - - 400, `invalid_param`, abnormal parameter input - - 403, `file_access_denied`, file access denied or file does not belong to current application - - 404, `file_not_found`, file not found or has been deleted - - 500, internal server error - - - - ### Request Example - - - ### Download as Attachment - - - ### Response Headers Example - - ```http {{ title: 'Headers - Image Preview' }} - Content-Type: image/png - Content-Length: 1024 - Cache-Control: public, max-age=3600 - ``` - - - ### Download Response Headers - - ```http {{ title: 'Headers - File Download' }} - Content-Type: image/png - Content-Length: 1024 - Content-Disposition: attachment; filename*=UTF-8''example.png - Cache-Control: public, max-age=3600 - ``` - - - - ---- - - - - アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。 - - ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。 - - ### パスパラメータ - - `file_id` (string) 必須 - プレビューするファイルの一意識別子。ファイルアップロード API レスポンスから取得します。 - - ### クエリパラメータ - - `as_attachment` (boolean) オプション - ファイルを添付ファイルとして強制ダウンロードするかどうか。デフォルトは `false`(ブラウザでプレビュー)。 - - ### レスポンス - ブラウザ表示またはダウンロード用の適切なヘッダー付きでファイル内容を返します。 - - `Content-Type` ファイル MIME タイプに基づいて設定 - - `Content-Length` ファイルサイズ(バイト、利用可能な場合) - - `Content-Disposition` `as_attachment=true` の場合は "attachment" に設定 - - `Cache-Control` パフォーマンス向上のためのキャッシュヘッダー - - `Accept-Ranges` 音声/動画ファイルの場合は "bytes" に設定 - - ### エラー - - 400, `invalid_param`, パラメータ入力異常 - - 403, `file_access_denied`, ファイルアクセス拒否またはファイルが現在のアプリケーションに属していません - - 404, `file_not_found`, ファイルが見つからないか削除されています - - 500, サーバー内部エラー - - - - ### リクエスト例 - - - ### 添付ファイルとしてダウンロード - - - ### レスポンスヘッダー例 - - ```http {{ title: 'ヘッダー - 画像プレビュー' }} - Content-Type: image/png - Content-Length: 1024 - Cache-Control: public, max-age=3600 - ``` - - - ### ダウンロードレスポンスヘッダー - - ```http {{ title: 'ヘッダー - ファイルダウンロード' }} - Content-Type: image/png - Content-Length: 1024 - Content-Disposition: attachment; filename*=UTF-8''example.png - Cache-Control: public, max-age=3600 - ``` - - - - ---- - --- - - - - 预览或下载已上传的文件。此端点允许您访问先前通过文件上传 API 上传的文件。 - - 文件只能在属于请求应用程序的消息范围内访问。 - - ### 路径参数 - - `file_id` (string) 必需 - 要预览的文件的唯一标识符,从文件上传 API 响应中获得。 - - ### 查询参数 - - `as_attachment` (boolean) 可选 - 是否强制将文件作为附件下载。默认为 `false`(在浏览器中预览)。 - - ### 响应 - 返回带有适当浏览器显示或下载标头的文件内容。 - - `Content-Type` 根据文件 MIME 类型设置 - - `Content-Length` 文件大小(以字节为单位,如果可用) - - `Content-Disposition` 如果 `as_attachment=true` 则设置为 "attachment" - - `Cache-Control` 用于性能的缓存标头 - - `Accept-Ranges` 对于音频/视频文件设置为 "bytes" - - ### 错误 - - 400, `invalid_param`, 参数输入异常 - - 403, `file_access_denied`, 文件访问被拒绝或文件不属于当前应用程序 - - 404, `file_not_found`, 文件未找到或已被删除 - - 500, 服务内部错误 - - - - ### 请求示例 - - - ### 作为附件下载 - - - ### 响应标头示例 - - ```http {{ title: 'Headers - 图片预览' }} - Content-Type: image/png - Content-Length: 1024 - Cache-Control: public, max-age=3600 - ``` - - - ### 文件下载响应标头 - - ```http {{ title: 'Headers - 文件下载' }} - Content-Type: image/png - Content-Length: 1024 - Content-Disposition: attachment; filename*=UTF-8''example.png - Cache-Control: public, max-age=3600 - ``` - - - ---- -