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

template_advanced_chat.ja.mdx 67KB

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