Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: correct File Preview API position in Japanese advanced chat template (#23645)

lyzno1a17b7b3d89c9
diff --git a/web/app/components/develop/template/template_advanced_chat.ja.mdx b/web/app/components/develop/template/template_advanced_chat.ja.mdx
index 65a9daa1945..bbe0f29b7ae 100644
--- a/web/app/components/develop/template/template_advanced_chat.ja.mdx
+++ b/web/app/components/develop/template/template_advanced_chat.ja.mdx
@@ -392,6 +392,86 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Row>
---
+<Heading
+ url='/files/:file_id/preview'
+ method='GET'
+ title='ファイルプレビュー'
+ name='#file-preview'
+/>
+<Row>
+ <Col>
+ アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。
+
+ <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i>
+
+ ### パスパラメータ
+ - `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, サーバー内部エラー
+
+ </Col>
+ <Col sticky>
+ ### リクエスト例
+ <CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}>
+
+ ```bash {{ title: 'cURL - ブラウザプレビュー' }}
+ curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \
+ --header 'Authorization: Bearer {api_key}'
+ ```
+
+ </CodeGroup>
+
+ ### 添付ファイルとしてダウンロード
+ <CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}>
+
+ ```bash {{ title: 'cURL' }}
+ curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \
+ --header 'Authorization: Bearer {api_key}' \
+ --output downloaded_file.png
+ ```
+
+ </CodeGroup>
+
+ ### レスポンスヘッダー例
+ <CodeGroup title="Response Headers">
+ ```http {{ title: 'ヘッダー - 画像プレビュー' }}
+ Content-Type: image/png
+ Content-Length: 1024
+ Cache-Control: public, max-age=3600
+ ```
+ </CodeGroup>
+
+ ### ダウンロードレスポンスヘッダー
+ <CodeGroup title="Download Response Headers">
+ ```http {{ title: 'ヘッダー - ファイルダウンロード' }}
+ Content-Type: image/png
+ Content-Length: 1024
+ Content-Disposition: attachment; filename*=UTF-8''example.png
+ Cache-Control: public, max-age=3600
+ ```
+ </CodeGroup>
+ </Col>
+</Row>
+
+---
+
<Heading
url='/chat-messages/:task_id/stop'
method='POST'
@@ -1422,86 +1502,6 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
</Row>
---
-<Heading
- url='/files/:file_id/preview'
- method='GET'
- title='ファイルプレビュー'
- name='#file-preview'
-/>
-<Row>
- <Col>
- アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。
-
- <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i>
-
- ### パスパラメータ
- - `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, サーバー内部エラー
-
- </Col>
- <Col sticky>
- ### リクエスト例
- <CodeGroup title="Request" tag="GET" label="/files/:file_id/preview" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\\n--header 'Authorization: Bearer {api_key}'`}>
-
- ```bash {{ title: 'cURL - ブラウザプレビュー' }}
- curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \
- --header 'Authorization: Bearer {api_key}'
- ```
-
- </CodeGroup>
-
- ### 添付ファイルとしてダウンロード
- <CodeGroup title="Download Request" tag="GET" label="/files/:file_id/preview?as_attachment=true" targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\\n--header 'Authorization: Bearer {api_key}' \\\n--output downloaded_file.png`}>
-
- ```bash {{ title: 'cURL' }}
- curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \
- --header 'Authorization: Bearer {api_key}' \
- --output downloaded_file.png
- ```
-
- </CodeGroup>
-
- ### レスポンスヘッダー例
- <CodeGroup title="Response Headers">
- ```http {{ title: 'ヘッダー - 画像プレビュー' }}
- Content-Type: image/png
- Content-Length: 1024
- Cache-Control: public, max-age=3600
- ```
- </CodeGroup>
-
- ### ダウンロードレスポンスヘッダー
- <CodeGroup title="Download Response Headers">
- ```http {{ title: 'ヘッダー - ファイルダウンロード' }}
- Content-Type: image/png
- Content-Length: 1024
- Content-Disposition: attachment; filename*=UTF-8''example.png
- Cache-Control: public, max-age=3600
- ```
- </CodeGroup>
- </Col>
-</Row>
-
----
-
<Heading
url='/meta'
method='GET'