Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

template_chat.ja.mdx 69KB

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