You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

template_advanced_chat.ja.mdx 67KB

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