您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

template_advanced_chat.ja.mdx 67KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
  3. # 高度なチャットアプリ API
  4. チャットアプリケーションはセッションの持続性をサポートしており、以前のチャット履歴を応答のコンテキストとして使用できます。これは、チャットボットやカスタマーサービス AI などに適用できます。
  5. <div>
  6. ### ベース URL
  7. <CodeGroup title="コード" targetCode={props.appDetail.api_base_url} />
  8. ### 認証
  9. サービス API は `API-Key` 認証を使用します。
  10. <i>**API キーはサーバー側に保存し、クライアント側で共有または保存しないことを強くお勧めします。API キーの漏洩は深刻な結果を招く可能性があります。**</i>
  11. すべての API リクエストには、以下のように `Authorization`HTTP ヘッダーに API キーを含めてください:
  12. <CodeGroup title="コード" targetCode='Authorization: Bearer {API_KEY}' />
  13. </div>
  14. ---
  15. <Heading
  16. url='/chat-messages'
  17. method='POST'
  18. title='チャットメッセージを送信'
  19. name='#Send-Chat-Message'
  20. />
  21. <Row>
  22. <Col>
  23. チャットアプリケーションにリクエストを送信します。
  24. ### リクエストボディ
  25. <Properties>
  26. <Property name='query' type='string' key='query'>
  27. ユーザー入力/質問内容
  28. </Property>
  29. <Property name='inputs' type='object' key='inputs'>
  30. アプリによって定義されたさまざまな変数値の入力を許可します。
  31. `inputs`パラメータには複数のキー/値ペアが含まれ、各キーは特定の変数に対応し、各値はその変数の特定の値です。
  32. 変数がファイルタイプの場合、以下の`files`で説明されているキーを持つオブジェクトを指定します。
  33. デフォルト`{}`
  34. </Property>
  35. <Property name='response_mode' type='string' key='response_mode'>
  36. 応答の返却モードを指定します。サポートされているモード:
  37. - `streaming` ストリーミングモード(推奨)、SSE([サーバー送信イベント](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events))を通じてタイプライターのような出力を実装します。
  38. - `blocking` ブロッキングモード、実行完了後に結果を返します。(プロセスが長い場合、リクエストが中断される可能性があります)
  39. Cloudflareの制限により、リクエストは100秒後に返答なしで中断されます。
  40. </Property>
  41. <Property name='user' type='string' key='user'>
  42. ユーザー識別子、エンドユーザーの身元を定義するために使用され、統計のために使用されます。
  43. アプリケーション内で開発者によって一意に定義されるべきです。サービス API は WebApp によって作成された会話を共有しません。
  44. </Property>
  45. <Property name='conversation_id' type='string' key='conversation_id'>
  46. 会話ID、以前のチャット記録に基づいて会話を続けるには、以前のメッセージのconversation_idを渡す必要があります。
  47. </Property>
  48. <Property name='files' type='array[object]' key='files'>
  49. ファイルリスト、テキストの理解と質問への回答を組み合わせたファイルの入力に適しており、モデルがビジョン機能をサポートしている場合にのみ利用可能です。
  50. - `type` (string) サポートされているタイプ:
  51. - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
  52. - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
  53. - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
  54. - `video` ('MP4', 'MOV', 'MPEG', 'MPGA')
  55. - `custom` (他のファイルタイプ)
  56. - `transfer_method` (string) 転送方法、画像URLの場合は`remote_url` / ファイルアップロードの場合は`local_file`
  57. - `url` (string) 画像URL(転送方法が`remote_url`の場合)
  58. - `upload_file_id` (string) アップロードされたファイルID、事前にファイルアップロードAPIを通じて取得する必要があります(転送方法が`local_file`の場合)
  59. </Property>
  60. <Property name='auto_generate_name' type='bool' key='auto_generate_name'>
  61. タイトルを自動生成、デフォルトは`true`。
  62. `false`に設定すると、会話のリネームAPIを呼び出し、`auto_generate`を`true`に設定することで非同期タイトル生成を実現できます。
  63. </Property>
  64. <Property name='workflow_id' type='string' key='workflow_id'>
  65. (オプション)ワークフローID、特定のバージョンを指定するために使用、提供されない場合はデフォルトの公開バージョンを使用。
  66. </Property>
  67. <Property name='trace_id' type='string' key='trace_id'>
  68. (オプション)トレースID。既存の業務システムのトレースコンポーネントと連携し、エンドツーエンドの分散トレーシングを実現するために使用します。指定がない場合、システムが自動的に trace_id を生成します。以下の3つの方法で渡すことができ、優先順位は次のとおりです:<br/>
  69. - Header:HTTPヘッダー <code>X-Trace-Id</code> で渡す(最優先)。<br/>
  70. - クエリパラメータ:URLクエリパラメータ <code>trace_id</code> で渡す。<br/>
  71. - リクエストボディ:リクエストボディの <code>trace_id</code> フィールドで渡す(本フィールド)。<br/>
  72. </Property>
  73. </Properties>
  74. ### 応答
  75. response_modeがブロッキングの場合、CompletionResponseオブジェクトを返します。
  76. response_modeがストリーミングの場合、ChunkCompletionResponseストリームを返します。
  77. ### ChatCompletionResponse
  78. 完全なアプリ結果を返します。`Content-Type`は`application/json`です。
  79. - `event` (string) イベントタイプ、固定で `message`
  80. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  81. - `id` (string) ユニークID
  82. - `message_id` (string) 一意のメッセージID
  83. - `conversation_id` (string) 会話ID
  84. - `mode` (string) アプリモード、`chat`として固定
  85. - `answer` (string) 完全な応答内容
  86. - `metadata` (object) メタデータ
  87. - `usage` (Usage) モデル使用情報
  88. - `retriever_resources` (array[RetrieverResource]) 引用と帰属リスト
  89. - `created_at` (int) メッセージ作成タイムスタンプ、例:1705395332
  90. ### ChunkChatCompletionResponse
  91. アプリによって出力されたストリームチャンクを返します。`Content-Type`は`text/event-stream`です。
  92. 各ストリーミングチャンクは`data:`で始まり、2つの改行文字`\n\n`で区切られます。以下のように表示されます:
  93. <CodeGroup>
  94. ```streaming {{ title: '応答' }}
  95. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  96. ```
  97. </CodeGroup>
  98. ストリーミングチャンクの構造は`event`に応じて異なります:
  99. - `event: message` LLMがテキストチャンクイベントを返します。つまり、完全なテキストがチャンク形式で出力されます。
  100. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  101. - `message_id` (string) 一意のメッセージID
  102. - `conversation_id` (string) 会話ID
  103. - `answer` (string) LLMが返したテキストチャンク内容
  104. - `created_at` (int) 作成タイムスタンプ、例:1705395332
  105. - `event: message_file` メッセージファイルイベント、ツールによって新しいファイルが作成されました
  106. - `id` (string) ファイル一意ID
  107. - `type` (string) ファイルタイプ、現在は"image"のみ許可
  108. - `belongs_to` (string) 所属、ここでは'assistant'のみ
  109. - `url` (string) ファイルのリモートURL
  110. - `conversation_id` (string) 会話ID
  111. - `event: message_end` メッセージ終了イベント、このイベントを受信するとストリーミングが終了したことを意味します。
  112. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  113. - `message_id` (string) 一意のメッセージID
  114. - `conversation_id` (string) 会話ID
  115. - `metadata` (object) メタデータ
  116. - `usage` (Usage) モデル使用情報
  117. - `retriever_resources` (array[RetrieverResource]) 引用と帰属リスト
  118. - `event: tts_message` TTSオーディオストリームイベント、つまり音声合成出力。内容はMp3形式のオーディオブロックで、base64文字列としてエンコードされています。再生時には、base64をデコードしてプレーヤーに入力するだけです。(このメッセージは自動再生が有効な場合にのみ利用可能)
  119. - `task_id` (string) タスクID、リクエスト追跡と以下のストップ応答インターフェースに使用
  120. - `message_id` (string) 一意のメッセージID
  121. - `audio` (string) 音声合成後のオーディオ、base64テキストコンテンツとしてエンコードされており、再生時にはbase64をデコードしてプレーヤーに入力するだけです
  122. - `created_at` (int) 作成タイムスタンプ、例:1705395332
  123. - `event: tts_message_end` TTSオーディオストリーム終了イベント、このイベントを受信するとオーディオストリームが終了したことを示します。
  124. - `task_id` (string) タスクID、リクエスト追跡と以下のストップ応答インターフェースに使用
  125. - `message_id` (string) 一意のメッセージID
  126. - `audio` (string) 終了イベントにはオーディオがないため、これは空の文字列です
  127. - `created_at` (int) 作成タイムスタンプ、例:1705395332
  128. - `event: message_replace` メッセージ内容置換イベント。
  129. 出力内容のモデレーションが有効な場合、内容がフラグ付けされると、このイベントを通じてメッセージ内容がプリセットの返信に置き換えられます。
  130. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  131. - `message_id` (string) 一意のメッセージID
  132. - `conversation_id` (string) 会話ID
  133. - `answer` (string) 置換内容(すべてのLLM返信テキストを直接置き換えます)
  134. - `created_at` (int) 作成タイムスタンプ、例:1705395332
  135. - `event: workflow_started` ワークフローが実行を開始
  136. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  137. - `workflow_run_id` (string) ワークフロー実行の一意ID
  138. - `event` (string) `workflow_started`に固定
  139. - `data` (object) 詳細
  140. - `id` (string) ワークフロー実行の一意ID
  141. - `workflow_id` (string) 関連ワークフローのID
  142. - `created_at` (timestamp) 作成タイムスタンプ、例:1705395332
  143. - `event: node_started` ノード実行が開始
  144. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  145. - `workflow_run_id` (string) ワークフロー実行の一意ID
  146. - `event` (string) `node_started`に固定
  147. - `data` (object) 詳細
  148. - `id` (string) ワークフロー実行の一意ID
  149. - `node_id` (string) ノードのID
  150. - `node_type` (string) ノードのタイプ
  151. - `title` (string) ノードの名前
  152. - `index` (int) 実行シーケンス番号、トレースノードシーケンスを表示するために使用
  153. - `predecessor_node_id` (string) オプションのプレフィックスノードID、キャンバス表示実行パスに使用
  154. - `inputs` (object) ノードで使用されるすべての前のノード変数の内容
  155. - `created_at` (timestamp) 開始のタイムスタンプ、例:1705395332
  156. - `event: node_finished` ノード実行が終了、成功または失敗は同じイベント内で異なる状態で示されます
  157. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  158. - `workflow_run_id` (string) ワークフロー実行の一意ID
  159. - `event` (string) `node_finished`に固定
  160. - `data` (object) 詳細
  161. - `id` (string) ワークフロー実行の一意ID
  162. - `node_id` (string) ノードのID
  163. - `node_type` (string) ノードのタイプ
  164. - `title` (string) ノードの名前
  165. - `index` (int) 実行シーケンス番号、トレースノードシーケンスを表示するために使用
  166. - `predecessor_node_id` (string) オプションのプレフィックスノードID、キャンバス表示実行パスに使用
  167. - `inputs` (object) ノードで使用されるすべての前のノード変数の内容
  168. - `process_data` (json) オプションのノードプロセスデータ
  169. - `outputs` (json) オプションの出力内容
  170. - `status` (string) 実行の状態、`running` / `succeeded` / `failed` / `stopped`
  171. - `error` (string) オプションのエラー理由
  172. - `elapsed_time` (float) オプションの使用される合計秒数
  173. - `execution_metadata` (json) メタデータ
  174. - `total_tokens` (int) オプションの使用されるトークン数
  175. - `total_price` (decimal) オプションの合計コスト
  176. - `currency` (string) オプション、例:`USD` / `RMB`
  177. - `created_at` (timestamp) 開始のタイムスタンプ、例:1705395332
  178. - `event: workflow_finished` ワークフロー実行が終了、成功または失敗は同じイベント内で異なる状態で示されます
  179. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  180. - `workflow_run_id` (string) ワークフロー実行の一意ID
  181. - `event` (string) `workflow_finished`に固定
  182. - `data` (object) 詳細
  183. - `id` (string) ワークフロー実行のID
  184. - `workflow_id` (string) 関連ワークフローのID
  185. - `status` (string) 実行の状態、`running` / `succeeded` / `failed` / `stopped`
  186. - `outputs` (json) オプションの出力内容
  187. - `error` (string) オプションのエラー理由
  188. - `elapsed_time` (float) オプションの使用される合計秒数
  189. - `total_tokens` (int) オプションの使用されるトークン数
  190. - `total_steps` (int) デフォルト0
  191. - `created_at` (timestamp) 開始時間
  192. - `finished_at` (timestamp) 終了時間
  193. - `event: error`
  194. ストリーミングプロセス中に発生する例外はストリームイベントの形式で出力され、エラーイベントを受信するとストリームが終了します。
  195. - `task_id` (string) タスクID、リクエスト追跡と以下のStop Generate APIに使用
  196. - `message_id` (string) 一意のメッセージID
  197. - `status` (int) HTTPステータスコード
  198. - `code` (string) エラーコード
  199. - `message` (string) エラーメッセージ
  200. - `event: ping` 接続を維持するために10秒ごとにpingイベントが発生します。
  201. ### エラー
  202. - 404, 会話が存在しません
  203. - 400, `invalid_param`, 異常なパラメータ入力
  204. - 400, `app_unavailable`, アプリ構成が利用できません
  205. - 400, `provider_not_initialize`, 利用可能なモデル資格情報構成がありません
  206. - 400, `provider_quota_exceeded`, モデル呼び出しクォータが不足しています
  207. - 400, `model_currently_not_support`, 現在のモデルが利用できません
  208. - 400, `workflow_not_found`, 指定されたワークフローバージョンが見つかりません
  209. - 400, `draft_workflow_error`, ドラフトワークフローバージョンは使用できません
  210. - 400, `workflow_id_format_error`, ワークフローID形式エラー、UUID形式が必要です
  211. - 400, `completion_request_error`, テキスト生成に失敗しました
  212. - 500, 内部サーバーエラー
  213. </Col>
  214. <Col sticky>
  215. <CodeGroup
  216. title="リクエスト"
  217. tag="POST"
  218. label="/chat-messages"
  219. targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\
  220. --header 'Authorization: Bearer {api_key}' \\
  221. --header 'Content-Type: application/json' \\
  222. --data-raw '{
  223. "inputs": ${JSON.stringify(props.inputs)},
  224. "query": "What are the specs of the iPhone 13 Pro Max?",
  225. "response_mode": "streaming",
  226. "conversation_id": "",
  227. "user": "abc-123",
  228. "files": [
  229. {
  230. "type": "image",
  231. "transfer_method": "remote_url",
  232. "url": "https://cloud.dify.ai/logo/logo-site.png"
  233. }
  234. ]
  235. }'`}
  236. />
  237. ### ブロッキングモード
  238. <CodeGroup title="応答">
  239. ```json {{ title: '応答' }}
  240. {
  241. "event": "message",
  242. "task_id": "c3800678-a077-43df-a102-53f23ed20b88",
  243. "id": "9da23599-e713-473b-982c-4328d4f5c78a",
  244. "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  245. "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
  246. "mode": "chat",
  247. "answer": "iPhone 13 Pro Maxの仕様は次のとおりです:...",
  248. "metadata": {
  249. "usage": {
  250. "prompt_tokens": 1033,
  251. "prompt_unit_price": "0.001",
  252. "prompt_price_unit": "0.001",
  253. "prompt_price": "0.0010330",
  254. "completion_tokens": 128,
  255. "completion_unit_price": "0.002",
  256. "completion_price_unit": "0.001",
  257. "completion_price": "0.0002560",
  258. "total_tokens": 1161,
  259. "total_price": "0.0012890",
  260. "currency": "USD",
  261. "latency": 0.7682376249867957
  262. },
  263. "retriever_resources": [
  264. {
  265. "position": 1,
  266. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  267. "dataset_name": "iPhone",
  268. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  269. "document_name": "iPhone List",
  270. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  271. "score": 0.98457545,
  272. "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""
  273. }
  274. ]
  275. },
  276. "created_at": 1705407629
  277. }
  278. ```
  279. </CodeGroup>
  280. ### ストリーミングモード
  281. <CodeGroup title="応答">
  282. ```streaming {{ title: '応答' }}
  283. data: {"event": "workflow_started", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "workflow_id": "dfjasklfjdslag", "created_at": 1679586595}}
  284. data: {"event": "node_started", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "node_id": "dfjasklfjdslag", "node_type": "start", "title": "Start", "index": 0, "predecessor_node_id": "fdljewklfklgejlglsd", "inputs": {}, "created_at": 1679586595}}
  285. data: {"event": "node_finished", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "node_id": "dfjasklfjdslag", "node_type": "start", "title": "Start", "index": 0, "predecessor_node_id": "fdljewklfklgejlglsd", "inputs": {}, "outputs": {}, "status": "succeeded", "elapsed_time": 0.324, "execution_metadata": {"total_tokens": 63127864, "total_price": 2.378, "currency": "USD"}, "created_at": 1679586595}}
  286. data: {"event": "workflow_finished", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "workflow_id": "dfjasklfjdslag", "outputs": {}, "status": "succeeded", "elapsed_time": 0.324, "total_tokens": 63127864, "total_steps": "1", "created_at": 1679586595, "finished_at": 1679976595}}
  287. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " I", "created_at": 1679586595}
  288. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": "'m", "created_at": 1679586595}
  289. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " glad", "created_at": 1679586595}
  290. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
  291. data: {"event": "message", "message_id" : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
  292. data: {"event": "message", "message_id" : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
  293. data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "metadata": {"usage": {"prompt_tokens": 1033, "prompt_unit_price": "0.001", "prompt_price_unit": "0.001", "prompt_price": "0.0010330", "completion_tokens": 135, "completion_unit_price": "0.002", "completion_price_unit": "0.001", "completion_price": "0.0002700", "total_tokens": 1168, "total_price": "0.0013030", "currency": "USD", "latency": 1.381760165997548}, "retriever_resources": [{"position": 1, "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb", "dataset_name": "iPhone", "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00", "document_name": "iPhone List", "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a", "score": 0.98457545, "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""}]}}
  294. data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
  295. data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
  296. ```
  297. </CodeGroup>
  298. </Col>
  299. </Row>
  300. ---
  301. <Heading
  302. url='/files/upload'
  303. method='POST'
  304. title='ファイルアップロード'
  305. name='#file-upload'
  306. />
  307. <Row>
  308. <Col>
  309. メッセージ送信時に使用するファイルをアップロードし、画像とテキストのマルチモーダル理解を可能にします。
  310. アプリケーションでサポートされている形式をサポートします。
  311. アップロードされたファイルは現在のエンドユーザーのみが使用できます。
  312. ### リクエストボディ
  313. このインターフェースは`multipart/form-data`リクエストを必要とします。
  314. - `file` (File) 必須
  315. アップロードするファイル。
  316. - `user` (string) 必須
  317. ユーザー識別子、開発者のルールによって定義され、アプリケーション内で一意でなければなりません。サービス API は WebApp によって作成された会話を共有しません。
  318. ### 応答
  319. アップロードが成功すると、サーバーはファイルの ID と関連情報を返します。
  320. - `id` (uuid) ID
  321. - `name` (string) ファイル名
  322. - `size` (int) ファイルサイズ(バイト)
  323. - `extension` (string) ファイル拡張子
  324. - `mime_type` (string) ファイルの MIME タイプ
  325. - `created_by` (uuid) エンドユーザーID
  326. - `created_at` (timestamp) 作成タイムスタンプ、例:1705395332
  327. ### エラー
  328. - 400, `no_file_uploaded`, ファイルが提供されなければなりません
  329. - 400, `too_many_files`, 現在は 1 つのファイルのみ受け付けます
  330. - 400, `unsupported_preview`, ファイルはプレビューをサポートしていません
  331. - 400, `unsupported_estimate`, ファイルは推定をサポートしていません
  332. - 413, `file_too_large`, ファイルが大きすぎます
  333. - 415, `unsupported_file_type`, サポートされていない拡張子、現在はドキュメントファイルのみ受け付けます
  334. - 503, `s3_connection_failed`, S3 サービスに接続できません
  335. - 503, `s3_permission_denied`, S3 にファイルをアップロードする権限がありません
  336. - 503, `s3_file_too_large`, ファイルが S3 のサイズ制限を超えています
  337. - 500, 内部サーバーエラー
  338. </Col>
  339. <Col sticky>
  340. ### リクエスト例
  341. <CodeGroup
  342. title="リクエスト"
  343. tag="POST"
  344. label="/files/upload"
  345. targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\
  346. --header 'Authorization: Bearer {api_key}' \\
  347. --form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif]' \\
  348. --form 'user=abc-123'`}
  349. />
  350. ### 応答例
  351. <CodeGroup title="応答">
  352. ```json {{ title: '応答' }}
  353. {
  354. "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
  355. "name": "example.png",
  356. "size": 1024,
  357. "extension": "png",
  358. "mime_type": "image/png",
  359. "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13",
  360. "created_at": 1577836800,
  361. }
  362. ```
  363. </CodeGroup>
  364. </Col>
  365. </Row>
  366. ---
  367. <Heading
  368. url='/files/:file_id/preview'
  369. method='GET'
  370. title='ファイルプレビュー'
  371. name='#file-preview'
  372. />
  373. <Row>
  374. <Col>
  375. アップロードされたファイルをプレビューまたはダウンロードします。このエンドポイントを使用すると、以前にファイルアップロード API でアップロードされたファイルにアクセスできます。
  376. <i>ファイルは、リクエストしているアプリケーションのメッセージ範囲内にある場合のみアクセス可能です。</i>
  377. ### パスパラメータ
  378. - `file_id` (string) 必須
  379. プレビューするファイルの一意識別子。ファイルアップロード API レスポンスから取得します。
  380. ### クエリパラメータ
  381. - `as_attachment` (boolean) オプション
  382. ファイルを添付ファイルとして強制ダウンロードするかどうか。デフォルトは `false`(ブラウザでプレビュー)。
  383. ### レスポンス
  384. ブラウザ表示またはダウンロード用の適切なヘッダー付きでファイル内容を返します。
  385. - `Content-Type` ファイル MIME タイプに基づいて設定
  386. - `Content-Length` ファイルサイズ(バイト、利用可能な場合)
  387. - `Content-Disposition` `as_attachment=true` の場合は "attachment" に設定
  388. - `Cache-Control` パフォーマンス向上のためのキャッシュヘッダー
  389. - `Accept-Ranges` 音声/動画ファイルの場合は "bytes" に設定
  390. ### エラー
  391. - 400, `invalid_param`, パラメータ入力異常
  392. - 403, `file_access_denied`, ファイルアクセス拒否またはファイルが現在のアプリケーションに属していません
  393. - 404, `file_not_found`, ファイルが見つからないか削除されています
  394. - 500, サーバー内部エラー
  395. </Col>
  396. <Col sticky>
  397. ### リクエスト例
  398. <CodeGroup
  399. title="リクエスト"
  400. tag="GET"
  401. label="/files/:file_id/preview"
  402. targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview' \\
  403. --header 'Authorization: Bearer {api_key}'`}
  404. />
  405. ### 添付ファイルとしてダウンロード
  406. <CodeGroup
  407. title="ダウンロードリクエスト"
  408. tag="GET"
  409. label="/files/:file_id/preview?as_attachment=true"
  410. targetCode={`curl -X GET '${props.appDetail.api_base_url}/files/72fa9618-8f89-4a37-9b33-7e1178a24a67/preview?as_attachment=true' \\
  411. --header 'Authorization: Bearer {api_key}' \\
  412. --output downloaded_file.png`}
  413. />
  414. ### レスポンスヘッダー例
  415. <CodeGroup title="Response Headers">
  416. ```http {{ title: 'ヘッダー - 画像プレビュー' }}
  417. Content-Type: image/png
  418. Content-Length: 1024
  419. Cache-Control: public, max-age=3600
  420. ```
  421. </CodeGroup>
  422. ### ダウンロードレスポンスヘッダー
  423. <CodeGroup title="Download Response Headers">
  424. ```http {{ title: 'ヘッダー - ファイルダウンロード' }}
  425. Content-Type: image/png
  426. Content-Length: 1024
  427. Content-Disposition: attachment; filename*=UTF-8''example.png
  428. Cache-Control: public, max-age=3600
  429. ```
  430. </CodeGroup>
  431. </Col>
  432. </Row>
  433. ---
  434. <Heading
  435. url='/chat-messages/:task_id/stop'
  436. method='POST'
  437. title='生成を停止'
  438. name='#stop-generatebacks'
  439. />
  440. <Row>
  441. <Col>
  442. ストリーミングモードでのみサポートされています。
  443. ### パス
  444. - `task_id` (string) タスク ID、ストリーミングチャンクの返り値から取得できます
  445. ### リクエストボディ
  446. - `user` (string) 必須
  447. ユーザー識別子、エンドユーザーの身元を定義するために使用され、送信メッセージインターフェースで渡されたユーザーと一致している必要があります。サービス API は WebApp によって作成された会話を共有しません。
  448. ### 応答
  449. - `result` (string) 常に"success"を返します
  450. </Col>
  451. <Col sticky>
  452. ### リクエスト例
  453. <CodeGroup
  454. title="リクエスト"
  455. tag="POST"
  456. label="/chat-messages/:task_id/stop"
  457. targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\
  458. -H 'Authorization: Bearer {api_key}' \\
  459. -H 'Content-Type: application/json' \\
  460. --data-raw '{
  461. "user": "abc-123"
  462. }'`}
  463. />
  464. ### 応答例
  465. <CodeGroup title="応答">
  466. ```json {{ title: '応答' }}
  467. {
  468. "result": "success"
  469. }
  470. ```
  471. </CodeGroup>
  472. </Col>
  473. </Row>
  474. ---
  475. <Heading
  476. url='/messages/:message_id/feedbacks'
  477. method='POST'
  478. title='メッセージフィードバック'
  479. name='#feedbacks'
  480. />
  481. <Row>
  482. <Col>
  483. エンドユーザーはフィードバックメッセージを提供でき、アプリケーション開発者が期待される出力を最適化するのを支援します。
  484. ### パス
  485. <Properties>
  486. <Property name='message_id' type='string' key='message_id'>
  487. メッセージID
  488. </Property>
  489. </Properties>
  490. ### リクエストボディ
  491. <Properties>
  492. <Property name='rating' type='string' key='rating'>
  493. アップボートは`like`、ダウンボートは`dislike`、アップボートの取り消しは`null`
  494. </Property>
  495. <Property name='user' type='string' key='user'>
  496. ユーザー識別子、開発者のルールによって定義され、アプリケーション内で一意でなければなりません。
  497. </Property>
  498. <Property name='content' type='string' key='content'>
  499. メッセージのフィードバックです。
  500. </Property>
  501. </Properties>
  502. ### 応答
  503. - `result` (string) 常に"success"を返します
  504. </Col>
  505. <Col sticky>
  506. <CodeGroup
  507. title="リクエスト"
  508. tag="POST"
  509. label="/messages/:message_id/feedbacks"
  510. targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \\
  511. --header 'Authorization: Bearer {api_key}' \\
  512. --header 'Content-Type: application/json' \\
  513. --data-raw '{
  514. "rating": "like",
  515. "user": "abc-123",
  516. "content": "message feedback information"
  517. }'`}
  518. />
  519. <CodeGroup title="応答">
  520. ```json {{ title: '応答' }}
  521. {
  522. "result": "success"
  523. }
  524. ```
  525. </CodeGroup>
  526. </Col>
  527. </Row>
  528. ---
  529. <Heading
  530. url='/app/feedbacks'
  531. method='GET'
  532. title='アプリのメッセージの「いいね」とフィードバックを取得'
  533. name='#app-feedbacks'
  534. />
  535. <Row>
  536. <Col>
  537. アプリのエンドユーザーからのフィードバックや「いいね」を取得します。
  538. ### クエリ
  539. <Properties>
  540. <Property name='page' type='string' key='page'>
  541. (任意)ページ番号。デフォルト値:1
  542. </Property>
  543. </Properties>
  544. <Properties>
  545. <Property name='limit' type='string' key='limit'>
  546. (任意)1ページあたりの件数。デフォルト値:20
  547. </Property>
  548. </Properties>
  549. ### レスポンス
  550. - `data` (リスト) このアプリの「いいね」とフィードバックの一覧を返します。
  551. </Col>
  552. <Col sticky>
  553. <CodeGroup
  554. title="リクエスト"
  555. tag="GET"
  556. label="/app/feedbacks"
  557. targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \\
  558. --header 'Authorization: Bearer {api_key}' \\
  559. --header 'Content-Type: application/json'`}
  560. />
  561. <CodeGroup title="Response">
  562. ```json {{ title: 'Response' }}
  563. {
  564. "data": [
  565. {
  566. "id": "8c0fbed8-e2f9-49ff-9f0e-15a35bdd0e25",
  567. "app_id": "f252d396-fe48-450e-94ec-e184218e7346",
  568. "conversation_id": "2397604b-9deb-430e-b285-4726e51fd62d",
  569. "message_id": "709c0b0f-0a96-4a4e-91a4-ec0889937b11",
  570. "rating": "like",
  571. "content": "message feedback information-3",
  572. "from_source": "user",
  573. "from_end_user_id": "74286412-9a1a-42c1-929c-01edb1d381d5",
  574. "from_account_id": null,
  575. "created_at": "2025-04-24T09:24:38",
  576. "updated_at": "2025-04-24T09:24:38"
  577. }
  578. ]
  579. }
  580. ```
  581. </CodeGroup>
  582. </Col>
  583. </Row>
  584. ---
  585. <Heading
  586. url='/messages/{message_id}/suggested'
  587. method='GET'
  588. title='次の推奨質問'
  589. name='#suggested'
  590. />
  591. <Row>
  592. <Col>
  593. 現在のメッセージに対する次の質問の提案を取得します
  594. ### パスパラメータ
  595. <Properties>
  596. <Property name='message_id' type='string' key='message_id'>
  597. メッセージID
  598. </Property>
  599. </Properties>
  600. ### クエリ
  601. <Properties>
  602. <Property name='user' type='string' key='user'>
  603. ユーザー識別子、エンドユーザーの身元を定義するために使用され、統計のために使用されます。
  604. アプリケーション内で開発者によって一意に定義されるべきです。
  605. </Property>
  606. </Properties>
  607. </Col>
  608. <Col sticky>
  609. <CodeGroup
  610. title="リクエスト"
  611. tag="GET"
  612. label="/messages/{message_id}/suggested"
  613. targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \\
  614. --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\
  615. --header 'Content-Type: application/json'`}
  616. />
  617. <CodeGroup title="応答">
  618. ```json {{ title: '応答' }}
  619. {
  620. "result": "success",
  621. "data": [
  622. "a",
  623. "b",
  624. "c"
  625. ]
  626. }
  627. ```
  628. </CodeGroup>
  629. </Col>
  630. </Row>
  631. ---
  632. <Heading
  633. url='/messages'
  634. method='GET'
  635. title='会話履歴メッセージを取得'
  636. name='#messages'
  637. />
  638. <Row>
  639. <Col>
  640. スクロールロード形式で履歴チャット記録を返し、最初のページは最新の`{limit}`メッセージを返します。つまり、逆順です。
  641. ### クエリ
  642. <Properties>
  643. <Property name='conversation_id' type='string' key='conversation_id'>
  644. 会話ID
  645. </Property>
  646. <Property name='user' type='string' key='user'>
  647. ユーザー識別子、エンドユーザーの身元を定義するために使用され、統計のために使用されます。
  648. アプリケーション内で開発者によって一意に定義されるべきです。
  649. </Property>
  650. <Property name='first_id' type='string' key='first_id'>
  651. 現在のページの最初のチャット記録のID、デフォルトはnullです。
  652. </Property>
  653. <Property name='limit' type='int' key='limit'>
  654. 1回のリクエストで返すチャット履歴メッセージの数、デフォルトは20です。
  655. </Property>
  656. </Properties>
  657. ### 応答
  658. - `data` (array[object]) メッセージリスト
  659. - `id` (string) メッセージID
  660. - `conversation_id` (string) 会話ID
  661. - `inputs` (object) ユーザー入力パラメータ。
  662. - `query` (string) ユーザー入力/質問内容。
  663. - `message_files` (array[object]) メッセージファイル
  664. - `id` (string) ID
  665. - `type` (string) ファイルタイプ、画像の場合はimage
  666. - `url` (string) ファイルプレビューURL、ファイルアクセスにはファイルプレビューAPI(`/files/{file_id}/preview`)を使用してください
  667. - `belongs_to` (string) 所属、userまたはassistant
  668. - `answer` (string) 応答メッセージ内容
  669. - `created_at` (timestamp) 作成タイムスタンプ、例:1705395332
  670. - `feedback` (object) フィードバック情報
  671. - `rating` (string) アップボートは`like` / ダウンボートは`dislike`
  672. - `retriever_resources` (array[RetrieverResource]) 引用と帰属リスト
  673. - `has_more` (bool) 次のページがあるかどうか
  674. - `limit` (int) 返された項目数、入力がシステム制限を超える場合、システム制限数を返します
  675. </Col>
  676. <Col sticky>
  677. <CodeGroup
  678. title="リクエスト"
  679. tag="GET"
  680. label="/messages"
  681. targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id={conversation_id}'
  682. --header 'Authorization: Bearer {api_key}'`}
  683. />
  684. ### 応答例
  685. <CodeGroup title="応答">
  686. ```json {{ title: '応答' }}
  687. {
  688. "limit": 20,
  689. "has_more": false,
  690. "data": [
  691. {
  692. "id": "a076a87f-31e5-48dc-b452-0061adbbc922",
  693. "conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
  694. "inputs": {
  695. "name": "dify"
  696. },
  697. "query": "iphone 13 pro",
  698. "answer": "iPhone 13 Proは2021年9月24日に発売され、6.1インチのディスプレイと1170 x 2532の解像度を備えています。Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)プロセッサ、6 GBのRAMを搭載し、128 GB、256 GB、512 GB、1 TBのストレージオプションを提供します。カメラは12 MP、バッテリー容量は3095 mAhで、iOS 15を搭載しています。",
  699. "message_files": [],
  700. "feedback": null,
  701. "retriever_resources": [
  702. {
  703. "position": 1,
  704. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  705. "dataset_name": "iPhone",
  706. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  707. "document_name": "iPhone List",
  708. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  709. "score": 0.98457545,
  710. "content": "\"Model\",\"Release Date\",\"Display Size\",\"Resolution\",\"Processor\",\"RAM\",\"Storage\",\"Camera\",\"Battery\",\"Operating System\"\n\"iPhone 13 Pro Max\",\"September 24, 2021\",\"6.7 inch\",\"1284 x 2778\",\"Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard)\",\"6 GB\",\"128, 256, 512 GB, 1TB\",\"12 MP\",\"4352 mAh\",\"iOS 15\""
  711. }
  712. ],
  713. "created_at": 1705569239,
  714. }
  715. ]
  716. }
  717. ```
  718. </CodeGroup>
  719. </Col>
  720. </Row>
  721. ---
  722. <Heading
  723. url='/conversations'
  724. method='GET'
  725. title='会話を取得'
  726. name='#conversations'
  727. />
  728. <Row>
  729. <Col>
  730. 現在のユーザーの会話リストを取得し、デフォルトで最新の 20 件を返します。
  731. ### クエリ
  732. <Properties>
  733. <Property name='user' type='string' key='user'>
  734. ユーザー識別子、エンドユーザーの身元を定義するために使用され、統計のために使用されます。
  735. アプリケーション内で開発者によって一意に定義されるべきです。
  736. </Property>
  737. <Property name='last_id' type='string' key='last_id'>
  738. (Optional)現在のページの最後の記録のID、デフォルトはnullです。
  739. </Property>
  740. <Property name='limit' type='int' key='limit'>
  741. (Optional)1回のリクエストで返す記録の数、デフォルトは最新の20件です。最大100、最小1。
  742. </Property>
  743. <Property name='sort_by' type='string' key='sort_by'>
  744. (Optional)ソートフィールド、デフォルト:-updated_at(更新時間で降順にソート)
  745. - 利用可能な値:created_at, -created_at, updated_at, -updated_at
  746. - フィールドの前の記号は順序または逆順を表し、"-"は逆順を表します。
  747. </Property>
  748. </Properties>
  749. ### 応答
  750. - `data` (array[object]) 会話のリスト
  751. - `id` (string) 会話ID
  752. - `name` (string) 会話名、デフォルトではLLMによって生成されます。
  753. - `inputs` (object) ユーザー入力パラメータ。
  754. - `introduction` (string) 紹介
  755. - `created_at` (timestamp) 作成タイムスタンプ、例:1705395332
  756. - `updated_at` (timestamp) 更新タイムスタンプ、例:1705395332
  757. - `has_more` (bool)
  758. - `limit` (int) 返されたエントリ数、入力がシステム制限を超える場合、システム制限数が返されます
  759. </Col>
  760. <Col sticky>
  761. <CodeGroup
  762. title="リクエスト"
  763. tag="GET"
  764. label="/conversations"
  765. targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \\
  766. --header 'Authorization: Bearer {api_key}'`}
  767. />
  768. <CodeGroup title="応答">
  769. ```json {{ title: '応答' }}
  770. {
  771. "limit": 20,
  772. "has_more": false,
  773. "data": [
  774. {
  775. "id": "10799fb8-64f7-4296-bbf7-b42bfbe0ae54",
  776. "name": "新しいチャット",
  777. "inputs": {
  778. "book": "book",
  779. "myName": "Lucy"
  780. },
  781. "status": "normal",
  782. "created_at": 1679667915,
  783. "updated_at": 1679667915
  784. },
  785. {
  786. "id": "hSIhXBhNe8X1d8Et"
  787. // ...
  788. }
  789. ]
  790. }
  791. ```
  792. </CodeGroup>
  793. </Col>
  794. </Row>
  795. ---
  796. <Heading
  797. url='/conversations/:conversation_id'
  798. method='DELETE'
  799. title='会話を削除'
  800. name='#delete'
  801. />
  802. <Row>
  803. <Col>
  804. 会話を削除します。
  805. ### パス
  806. - `conversation_id` (string) 会話ID
  807. ### リクエストボディ
  808. <Properties>
  809. <Property name='user' type='string' key='user'>
  810. ユーザー識別子、開発者によって定義され、アプリケーション内で一意であることを保証しなければなりません。
  811. </Property>
  812. </Properties>
  813. ### 応答
  814. - `result` (string) 常に"success"を返します
  815. </Col>
  816. <Col sticky>
  817. <CodeGroup
  818. title="リクエスト"
  819. tag="DELETE"
  820. label="/conversations/:conversation_id"
  821. targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/{conversation_id}' \\
  822. --header 'Content-Type: application/json' \\
  823. --header 'Accept: application/json' \\
  824. --header 'Authorization: Bearer {api_key}' \\
  825. --data '{
  826. "user": "abc-123"
  827. }'`}
  828. />
  829. <CodeGroup title="応答">
  830. ```text {{ title: '応答' }}
  831. 204 No Content
  832. ```
  833. </CodeGroup>
  834. </Col>
  835. </Row>
  836. ---
  837. <Heading
  838. url='/conversations/:conversation_id/name'
  839. method='POST'
  840. title='会話の名前を変更'
  841. name='#rename'
  842. />
  843. <Row>
  844. <Col>
  845. ### リクエストボディ
  846. セッションの名前を変更します。セッション名は、複数のセッションをサポートするクライアントでの表示に使用されます。
  847. ### パス
  848. - `conversation_id` (string) 会話ID
  849. <Properties>
  850. <Property name='name' type='string' key='name'>
  851. (Optional)会話の名前。`auto_generate`が`true`に設定されている場合、このパラメータは省略できます。
  852. </Property>
  853. <Property name='auto_generate' type='bool' key='auto_generate'>
  854. (Optional)タイトルを自動生成、デフォルトは`false`
  855. </Property>
  856. <Property name='user' type='string' key='user'>
  857. ユーザー識別子、開発者によって定義され、アプリケーション内で一意であることを保証しなければなりません。
  858. </Property>
  859. </Properties>
  860. ### 応答
  861. - `id` (string) 会話ID
  862. - `name` (string) 会話名
  863. - `inputs` (object) ユーザー入力パラメータ
  864. - `status` (string) 会話状態
  865. - `introduction` (string) 紹介
  866. - `created_at` (timestamp) 作成タイムスタンプ、例:1705395332
  867. - `updated_at` (timestamp) 更新タイムスタンプ、例:1705395332
  868. </Col>
  869. <Col sticky>
  870. <CodeGroup
  871. title="リクエスト"
  872. tag="POST"
  873. label="/conversations/:conversation_id/name"
  874. targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/{conversation_id}/name' \\
  875. --header 'Content-Type: application/json' \\
  876. --header 'Authorization: Bearer {api_key}' \\
  877. --data-raw '{
  878. "name": "",
  879. "auto_generate": true,
  880. "user": "abc-123"
  881. }'`}
  882. />
  883. <CodeGroup title="応答">
  884. ```json {{ title: '応答' }}
  885. {
  886. "id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
  887. "name": "チャット vs AI",
  888. "inputs": {},
  889. "status": "normal",
  890. "introduction": "",
  891. "created_at": 1705569238,
  892. "updated_at": 1705569238
  893. }
  894. ```
  895. </CodeGroup>
  896. </Col>
  897. </Row>
  898. ---
  899. <Heading
  900. url='/conversations/:conversation_id/variables'
  901. method='GET'
  902. title='会話変数の取得'
  903. name='#conversation-variables'
  904. />
  905. <Row>
  906. <Col>
  907. 特定の会話から変数を取得します。このエンドポイントは、会話中に取得された構造化データを抽出するのに役立ちます。
  908. ### パスパラメータ
  909. <Properties>
  910. <Property name='conversation_id' type='string' key='conversation_id'>
  911. 変数を取得する会話のID。
  912. </Property>
  913. </Properties>
  914. ### クエリパラメータ
  915. <Properties>
  916. <Property name='user' type='string' key='user'>
  917. ユーザー識別子。開発者によって定義されたルールに従い、アプリケーション内で一意である必要があります。
  918. </Property>
  919. <Property name='last_id' type='string' key='last_id'>
  920. (Optional)現在のページの最後の記録のID、デフォルトはnullです。
  921. </Property>
  922. <Property name='limit' type='int' key='limit'>
  923. (Optional)1回のリクエストで返す記録の数、デフォルトは最新の20件です。最大100、最小1。
  924. </Property>
  925. </Properties>
  926. ### レスポンス
  927. - `limit` (int) ページごとのアイテム数
  928. - `has_more` (bool) さらにアイテムがあるかどうか
  929. - `data` (array[object]) 変数のリスト
  930. - `id` (string) 変数 ID
  931. - `name` (string) 変数名
  932. - `value_type` (string) 変数タイプ(文字列、数値、真偽値など)
  933. - `value` (string) 変数値
  934. - `description` (string) 変数の説明
  935. - `created_at` (int) 作成タイムスタンプ
  936. - `updated_at` (int) 最終更新タイムスタンプ
  937. ### エラー
  938. - 404, `conversation_not_exists`, 会話が見つかりません
  939. </Col>
  940. <Col sticky>
  941. <CodeGroup
  942. title="リクエスト"
  943. tag="GET"
  944. label="/conversations/:conversation_id/variables"
  945. debug="true"
  946. targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123' \\
  947. --header 'Authorization: Bearer {api_key}'`} />
  948. <CodeGroup
  949. title="変数名フィルター付きリクエスト"
  950. language="bash"
  951. targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables?user=abc-123&variable_name=customer_name' \\
  952. --header 'Authorization: Bearer {api_key}'`}
  953. />
  954. <CodeGroup title="Response">
  955. ```json {{ title: 'Response' }}
  956. {
  957. "limit": 100,
  958. "has_more": false,
  959. "data": [
  960. {
  961. "id": "variable-uuid-1",
  962. "name": "customer_name",
  963. "value_type": "string",
  964. "value": "John Doe",
  965. "description": "会話から抽出された顧客名",
  966. "created_at": 1650000000000,
  967. "updated_at": 1650000000000
  968. },
  969. {
  970. "id": "variable-uuid-2",
  971. "name": "order_details",
  972. "value_type": "json",
  973. "value": "{\"product\":\"Widget\",\"quantity\":5,\"price\":19.99}",
  974. "description": "顧客の注文詳細",
  975. "created_at": 1650000000000,
  976. "updated_at": 1650000000000
  977. }
  978. ]
  979. }
  980. ```
  981. </CodeGroup>
  982. </Col>
  983. </Row>
  984. ---
  985. <Heading
  986. url='/conversations/:conversation_id/variables/:variable_id'
  987. method='PUT'
  988. title='会話変数の更新'
  989. name='#update-conversation-variable'
  990. />
  991. <Row>
  992. <Col>
  993. 特定の会話変数の値を更新します。このエンドポイントは、名前、型、説明を保持しながら、会話中にキャプチャされた変数の値を変更することを可能にします。
  994. ### パスパラメータ
  995. <Properties>
  996. <Property name='conversation_id' type='string' key='conversation_id'>
  997. 更新する変数を含む会話のID。
  998. </Property>
  999. <Property name='variable_id' type='string' key='variable_id'>
  1000. 更新する変数のID。
  1001. </Property>
  1002. </Properties>
  1003. ### リクエストボディ
  1004. <Properties>
  1005. <Property name='value' type='any' key='value'>
  1006. 変数の新しい値。変数の期待される型(文字列、数値、オブジェクトなど)と一致する必要があります。
  1007. </Property>
  1008. <Property name='user' type='string' key='user'>
  1009. ユーザー識別子。開発者によって定義されたルールに従い、アプリケーション内で一意である必要があります。
  1010. </Property>
  1011. </Properties>
  1012. ### レスポンス
  1013. 以下を含む更新された変数オブジェクトを返します:
  1014. - `id` (string) 変数ID
  1015. - `name` (string) 変数名
  1016. - `value_type` (string) 変数型(文字列、数値、オブジェクトなど)
  1017. - `value` (any) 更新された変数値
  1018. - `description` (string) 変数の説明
  1019. - `created_at` (int) 作成タイムスタンプ
  1020. - `updated_at` (int) 最終更新タイムスタンプ
  1021. ### エラー
  1022. - 400, `Type mismatch: variable expects {expected_type}, but got {actual_type} type`, 値の型が変数の期待される型と一致しません
  1023. - 404, `conversation_not_exists`, 会話が見つかりません
  1024. - 404, `conversation_variable_not_exists`, 変数が見つかりません
  1025. </Col>
  1026. <Col sticky>
  1027. <CodeGroup
  1028. title="リクエスト"
  1029. tag="PUT"
  1030. label="/conversations/:conversation_id/variables/:variable_id"
  1031. targetCode={`curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
  1032. --header 'Content-Type: application/json' \\
  1033. --header 'Authorization: Bearer {api_key}' \\
  1034. --data-raw '{
  1035. "value": "Updated Value",
  1036. "user": "abc-123"
  1037. }'`}
  1038. />
  1039. <CodeGroup
  1040. title="異なる値型での更新"
  1041. targetCode={[
  1042. {
  1043. title: '文字列値',
  1044. code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
  1045. --header 'Content-Type: application/json' \\
  1046. --header 'Authorization: Bearer {api_key}' \\
  1047. --data-raw '{
  1048. "value": "新しい文字列値",
  1049. "user": "abc-123"
  1050. }'`,
  1051. }, {
  1052. title: '数値',
  1053. code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
  1054. --header 'Content-Type: application/json' \\
  1055. --header 'Authorization: Bearer {api_key}' \\
  1056. --data-raw '{
  1057. "value": 42,
  1058. "user": "abc-123"
  1059. }'`,
  1060. }, {
  1061. title: 'オブジェクト値',
  1062. code: `curl -X PUT '${props.appDetail.api_base_url}/conversations/{conversation_id}/variables/{variable_id}' \\
  1063. --header 'Content-Type: application/json' \\
  1064. --header 'Authorization: Bearer {api_key}' \\
  1065. --data-raw '{
  1066. "value": {"product": "Widget", "quantity": 10, "price": 29.99},
  1067. "user": "abc-123"
  1068. }'`,
  1069. },
  1070. ]}
  1071. />
  1072. <CodeGroup title="Response">
  1073. ```json {{ title: 'Response' }}
  1074. {
  1075. "id": "variable-uuid-1",
  1076. "name": "customer_name",
  1077. "value_type": "string",
  1078. "value": "Updated Value",
  1079. "description": "会話から抽出された顧客名",
  1080. "created_at": 1650000000000,
  1081. "updated_at": 1650000001000
  1082. }
  1083. ```
  1084. </CodeGroup>
  1085. </Col>
  1086. </Row>
  1087. ---
  1088. <Heading
  1089. url='/audio-to-text'
  1090. method='POST'
  1091. title='音声からテキストへ'
  1092. name='#audio-to-text'
  1093. />
  1094. <Row>
  1095. <Col>
  1096. このエンドポイントは multipart/form-data リクエストを必要とします。
  1097. ### リクエストボディ
  1098. <Properties>
  1099. <Property name='file' type='file' key='file'>
  1100. オーディオファイル。
  1101. サポートされている形式:`['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']`
  1102. ファイルサイズ制限:15MB
  1103. </Property>
  1104. <Property name='user' type='string' key='user'>
  1105. ユーザー識別子、開発者のルールによって定義され、アプリケーション内で一意でなければなりません。
  1106. </Property>
  1107. </Properties>
  1108. ### 応答
  1109. - `text` (string) 出力テキスト
  1110. </Col>
  1111. <Col sticky>
  1112. <CodeGroup
  1113. title="リクエスト"
  1114. tag="POST"
  1115. label="/audio-to-text"
  1116. targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\
  1117. --header 'Authorization: Bearer {api_key}' \\
  1118. --form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}
  1119. />
  1120. <CodeGroup title="応答">
  1121. ```json {{ title: '応答' }}
  1122. {
  1123. "text": ""
  1124. }
  1125. ```
  1126. </CodeGroup>
  1127. </Col>
  1128. </Row>
  1129. ---
  1130. <Heading
  1131. url='/text-to-audio'
  1132. method='POST'
  1133. title='テキストから音声へ'
  1134. name='#text-to-audio'
  1135. />
  1136. <Row>
  1137. <Col>
  1138. テキストを音声に変換します。
  1139. ### リクエストボディ
  1140. <Properties>
  1141. <Property name='message_id' type='str' key='message_id'>
  1142. Difyによって生成されたテキストメッセージの場合、生成されたメッセージIDを直接渡します。バックエンドはメッセージIDを使用して対応する内容を検索し、音声情報を直接合成します。message_idとtextが同時に提供される場合、message_idが優先されます。
  1143. </Property>
  1144. <Property name='text' type='str' key='text'>
  1145. 音声生成コンテンツ。
  1146. </Property>
  1147. <Property name='user' type='string' key='user'>
  1148. ユーザー識別子、開発者によって定義され、アプリ内で一意であることを保証しなければなりません。
  1149. </Property>
  1150. </Properties>
  1151. </Col>
  1152. <Col sticky>
  1153. <CodeGroup
  1154. title="リクエスト"
  1155. tag="POST"
  1156. label="/text-to-audio"
  1157. targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\
  1158. --header 'Authorization: Bearer {api_key}' \\
  1159. --header 'Content-Type: application/json' \\
  1160. --data-raw '{
  1161. "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
  1162. "text": "Hello Dify",
  1163. "user": "abc-123",
  1164. }'`}
  1165. />
  1166. <CodeGroup title="ヘッダー">
  1167. ```json {{ title: 'ヘッダー' }}
  1168. {
  1169. "Content-Type": "audio/wav"
  1170. }
  1171. ```
  1172. </CodeGroup>
  1173. </Col>
  1174. </Row>
  1175. ---
  1176. <Heading
  1177. url='/info'
  1178. method='GET'
  1179. title='アプリケーションの基本情報を取得'
  1180. name='#info'
  1181. />
  1182. <Row>
  1183. <Col>
  1184. このアプリケーションの基本情報を取得するために使用されます
  1185. ### Response
  1186. - `name` (string) アプリケーションの名前
  1187. - `description` (string) アプリケーションの説明
  1188. - `tags` (array[string]) アプリケーションのタグ
  1189. - `mode` (string) アプリケーションのモード
  1190. - `author_name` (string) 作者の名前
  1191. </Col>
  1192. <Col>
  1193. <CodeGroup
  1194. title="リクエスト"
  1195. tag="GET"
  1196. label="/info"
  1197. targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\
  1198. -H 'Authorization: Bearer {api_key}'`}
  1199. />
  1200. <CodeGroup title="Response">
  1201. ```json {{ title: 'Response' }}
  1202. {
  1203. "name": "My App",
  1204. "description": "This is my app.",
  1205. "tags": [
  1206. "tag1",
  1207. "tag2"
  1208. ],
  1209. "mode": "advanced-chat",
  1210. "author_name": "Dify"
  1211. }
  1212. ```
  1213. </CodeGroup>
  1214. </Col>
  1215. </Row>
  1216. ---
  1217. <Heading
  1218. url='/parameters'
  1219. method='GET'
  1220. title='アプリケーションのパラメータ情報を取得'
  1221. name='#parameters'
  1222. />
  1223. <Row>
  1224. <Col>
  1225. ページに入る際に、機能、入力パラメータ名、タイプ、デフォルト値などの情報を取得するために使用されます。
  1226. ### 応答
  1227. - `opening_statement` (string) 開始の挨拶
  1228. - `suggested_questions` (array[string]) 開始時の推奨質問のリスト
  1229. - `suggested_questions_after_answer` (object) 答えを有効にした後の質問を提案します。
  1230. - `enabled` (bool) 有効かどうか
  1231. - `speech_to_text` (object) 音声からテキストへ
  1232. - `enabled` (bool) 有効かどうか
  1233. - `text_to_speech` (object) テキストから音声へ
  1234. - `enabled` (bool) 有効かどうか
  1235. - `voice` (string) 音声タイプ
  1236. - `language` (string) 言語
  1237. - `autoPlay` (string) 自動再生
  1238. - `enabled` 有効
  1239. - `disabled` 無効
  1240. - `retriever_resource` (object) 引用と帰属
  1241. - `enabled` (bool) 有効かどうか
  1242. - `annotation_reply` (object) 注釈返信
  1243. - `enabled` (bool) 有効かどうか
  1244. - `user_input_form` (array[object]) ユーザー入力フォームの設定
  1245. - `text-input` (object) テキスト入力コントロール
  1246. - `label` (string) 変数表示ラベル名
  1247. - `variable` (string) 変数ID
  1248. - `required` (bool) 必須かどうか
  1249. - `default` (string) デフォルト値
  1250. - `paragraph` (object) 段落テキスト入力コントロール
  1251. - `label` (string) 変数表示ラベル名
  1252. - `variable` (string) 変数ID
  1253. - `required` (bool) 必須かどうか
  1254. - `default` (string) デフォルト値
  1255. - `select` (object) ドロップダウンコントロール
  1256. - `label` (string) 変数表示ラベル名
  1257. - `variable` (string) 変数ID
  1258. - `required` (bool) 必須かどうか
  1259. - `default` (string) デフォルト値
  1260. - `options` (array[string]) オプション値
  1261. - `file_upload` (object) ファイルアップロード設定
  1262. - `document` (object) ドキュメント設定
  1263. 現在サポートされているドキュメントタイプ:`txt`, `md`, `markdown`, `pdf`, `html`, `xlsx`, `xls`, `docx`, `csv`, `eml`, `msg`, `pptx`, `ppt`, `xml`, `epub`。
  1264. - `enabled` (bool) 有効かどうか
  1265. - `number_limits` (int) ドキュメント数の上限。デフォルトは 3
  1266. - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
  1267. - `image` (object) 画像設定
  1268. 現在サポートされている画像タイプ:`png`, `jpg`, `jpeg`, `webp`, `gif`。
  1269. - `enabled` (bool) 有効かどうか
  1270. - `number_limits` (int) 画像数の上限。デフォルトは 3
  1271. - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
  1272. - `audio` (object) オーディオ設定
  1273. 現在サポートされているオーディオタイプ:`mp3`, `m4a`, `wav`, `webm`, `amr`。
  1274. - `enabled` (bool) 有効かどうか
  1275. - `number_limits` (int) オーディオ数の上限。デフォルトは 3
  1276. - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
  1277. - `video` (object) ビデオ設定
  1278. 現在サポートされているビデオタイプ:`mp4`, `mov`, `mpeg`, `mpga`。
  1279. - `enabled` (bool) 有効かどうか
  1280. - `number_limits` (int) ビデオ数の上限。デフォルトは 3
  1281. - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
  1282. - `custom` (object) カスタム設定
  1283. - `enabled` (bool) 有効かどうか
  1284. - `number_limits` (int) カスタム数の上限。デフォルトは 3
  1285. - `transfer_methods` (array[string]) 転送方法リスト:`remote_url`, `local_file`。いずれかを選択する必要があります。
  1286. - `system_parameters` (object) システムパラメータ
  1287. - `file_size_limit` (int) ドキュメントアップロードサイズ制限(MB)
  1288. - `image_file_size_limit` (int) 画像ファイルアップロードサイズ制限(MB)
  1289. - `audio_file_size_limit` (int) オーディオファイルアップロードサイズ制限(MB)
  1290. - `video_file_size_limit` (int) ビデオファイルアップロードサイズ制限(MB)
  1291. </Col>
  1292. <Col sticky>
  1293. <CodeGroup
  1294. title="リクエスト"
  1295. tag="GET"
  1296. label="/parameters"
  1297. targetCode={`curl -X GET '${props.appDetail.api_base_url}/parameters'`}
  1298. />
  1299. <CodeGroup title="応答">
  1300. ```json {{ title: '応答' }}
  1301. {
  1302. "opening_statement": "こんにちは!",
  1303. "suggested_questions_after_answer": {
  1304. "enabled": true
  1305. },
  1306. "speech_to_text": {
  1307. "enabled": true
  1308. },
  1309. "text_to_speech": {
  1310. "enabled": true,
  1311. "voice": "sambert-zhinan-v1",
  1312. "language": "zh-Hans",
  1313. "autoPlay": "disabled"
  1314. },
  1315. "retriever_resource": {
  1316. "enabled": true
  1317. },
  1318. "annotation_reply": {
  1319. "enabled": true
  1320. },
  1321. "user_input_form": [
  1322. {
  1323. "paragraph": {
  1324. "label": "クエリ",
  1325. "variable": "query",
  1326. "required": true,
  1327. "default": ""
  1328. }
  1329. }
  1330. ],
  1331. "file_upload": {
  1332. "image": {
  1333. "enabled": false,
  1334. "number_limits": 3,
  1335. "detail": "high",
  1336. "transfer_methods": [
  1337. "remote_url",
  1338. "local_file"
  1339. ]
  1340. }
  1341. },
  1342. "system_parameters": {
  1343. "file_size_limit": 15,
  1344. "image_file_size_limit": 10,
  1345. "audio_file_size_limit": 50,
  1346. "video_file_size_limit": 100
  1347. }
  1348. }
  1349. ```
  1350. </CodeGroup>
  1351. </Col>
  1352. </Row>
  1353. ---
  1354. <Heading
  1355. url='/meta'
  1356. method='GET'
  1357. title='アプリケーションのメタ情報を取得'
  1358. name='#meta'
  1359. />
  1360. <Row>
  1361. <Col>
  1362. このアプリケーションのツールのアイコンを取得するために使用されます
  1363. ### 応答
  1364. - `tool_icons`(object[string]) ツールアイコン
  1365. - `tool_name` (string)
  1366. - `icon` (object|string)
  1367. - (object) アイコンオブジェクト
  1368. - `background` (string) 背景色(16 進数形式)
  1369. - `content`(string) 絵文字
  1370. - (string) アイコンの URL
  1371. </Col>
  1372. <Col>
  1373. <CodeGroup
  1374. title="リクエスト"
  1375. tag="GET"
  1376. label="/meta"
  1377. targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta' \\
  1378. -H 'Authorization: Bearer {api_key}'`}
  1379. />
  1380. <CodeGroup title="応答">
  1381. ```json {{ title: '応答' }}
  1382. {
  1383. "tool_icons": {
  1384. "dalle2": "https://cloud.dify.ai/console/api/workspaces/current/tool-provider/builtin/dalle/icon",
  1385. "api_tool": {
  1386. "background": "#252525",
  1387. "content": "\ud83d\ude01"
  1388. }
  1389. }
  1390. }
  1391. ```
  1392. </CodeGroup>
  1393. </Col>
  1394. </Row>
  1395. ---
  1396. <Heading
  1397. url='/site'
  1398. method='GET'
  1399. title='アプリのWebApp設定を取得'
  1400. name='#site'
  1401. />
  1402. <Row>
  1403. <Col>
  1404. アプリの WebApp 設定を取得するために使用します。
  1405. ### 応答
  1406. - `title` (string) WebApp 名
  1407. - `chat_color_theme` (string) チャットの色テーマ、16 進数形式
  1408. - `chat_color_theme_inverted` (bool) チャットの色テーマを反転するかどうか
  1409. - `icon_type` (string) アイコンタイプ、`emoji`-絵文字、`image`-画像
  1410. - `icon` (string) アイコン。`emoji`タイプの場合は絵文字、`image`タイプの場合は画像 URL
  1411. - `icon_background` (string) 16 進数形式の背景色
  1412. - `icon_url` (string) アイコンの URL
  1413. - `description` (string) 説明
  1414. - `copyright` (string) 著作権情報
  1415. - `privacy_policy` (string) プライバシーポリシーのリンク
  1416. - `custom_disclaimer` (string) カスタム免責事項
  1417. - `default_language` (string) デフォルト言語
  1418. - `show_workflow_steps` (bool) ワークフローの詳細を表示するかどうか
  1419. - `use_icon_as_answer_icon` (bool) WebApp のアイコンをチャット内の🤖に置き換えるかどうか
  1420. </Col>
  1421. <Col>
  1422. <CodeGroup
  1423. title="リクエスト"
  1424. tag="GET"
  1425. label="/site"
  1426. targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\
  1427. -H 'Authorization: Bearer {api_key}'`}
  1428. />
  1429. <CodeGroup title="Response">
  1430. ```json {{ title: 'Response' }}
  1431. {
  1432. "title": "My App",
  1433. "chat_color_theme": "#ff4a4a",
  1434. "chat_color_theme_inverted": false,
  1435. "icon_type": "emoji",
  1436. "icon": "😄",
  1437. "icon_background": "#FFEAD5",
  1438. "icon_url": null,
  1439. "description": "This is my app.",
  1440. "copyright": "all rights reserved",
  1441. "privacy_policy": "",
  1442. "custom_disclaimer": "All generated by AI",
  1443. "default_language": "en-US",
  1444. "show_workflow_steps": false,
  1445. "use_icon_as_answer_icon": false,
  1446. }
  1447. ```
  1448. </CodeGroup>
  1449. </Col>
  1450. </Row>
  1451. ___