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

template_chat.ja.mdx 69KB

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