template_advanced_chat.en.mdx 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
  3. # Advanced Chat App API
  4. Chat applications support session persistence, allowing previous chat history to be used as context for responses. This can be applicable for chatbots, customer service AI, etc.
  5. <div>
  6. ### Base URL
  7. <CodeGroup title="Code" targetCode={props.appDetail.api_base_url}>
  8. ```javascript
  9. ```
  10. </CodeGroup>
  11. ### Authentication
  12. The Service API uses `API-Key` authentication.
  13. <i>**Strongly recommend storing your API Key on the server-side, not shared or stored on the client-side, to avoid possible API-Key leakage that can lead to serious consequences.**</i>
  14. For all API requests, include your API Key in the `Authorization`HTTP Header, as shown below:
  15. <CodeGroup title="Code">
  16. ```javascript
  17. Authorization: Bearer {API_KEY}
  18. ```
  19. </CodeGroup>
  20. </div>
  21. ---
  22. <Heading
  23. url='/chat-messages'
  24. method='POST'
  25. title='Send Chat Message'
  26. name='#Send-Chat-Message'
  27. />
  28. <Row>
  29. <Col>
  30. Send a request to the chat application.
  31. ### Request Body
  32. <Properties>
  33. <Property name='query' type='string' key='query'>
  34. User Input/Question content
  35. </Property>
  36. <Property name='inputs' type='object' key='inputs'>
  37. Allows the entry of various variable values defined by the App.
  38. The `inputs` parameter contains multiple key/value pairs, with each key corresponding to a specific variable and each value being the specific value for that variable. Default `{}`
  39. </Property>
  40. <Property name='response_mode' type='string' key='response_mode'>
  41. The mode of response return, supporting:
  42. - `streaming` Streaming mode (recommended), implements a typewriter-like output through SSE ([Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)).
  43. - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long)
  44. Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.
  45. </Property>
  46. <Property name='user' type='string' key='user'>
  47. User identifier, used to define the identity of the end-user for retrieval and statistics.
  48. Should be uniquely defined by the developer within the application.
  49. </Property>
  50. <Property name='conversation_id' type='string' key='conversation_id'>
  51. Converation ID, to continue the conversation based on previous chat records, it is necessary to pass the previous message's conversation_id.
  52. </Property>
  53. <Property name='files' type='array[object]' key='files'>
  54. File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability.
  55. - `type` (string) Supported type: `image` (currently only supports image type)
  56. - `transfer_method` (string) Transfer method, `remote_url` for image URL / `local_file` for file upload
  57. - `url` (string) Image URL (when the transfer method is `remote_url`)
  58. - `upload_file_id` (string) Uploaded file ID, which must be obtained by uploading through the File Upload API in advance (when the transfer method is `local_file`)
  59. </Property>
  60. <Property name='auto_generate_name' type='bool' key='auto_generate_name'>
  61. Auto-generate title, default is `true`.
  62. If set to `false`, can achieve async title generation by calling the conversation rename API and setting `auto_generate` to `true`.
  63. </Property>
  64. </Properties>
  65. ### Response
  66. When response_mode is blocking, return a CompletionResponse object.
  67. When response_mode is streaming, return a ChunkCompletionResponse stream.
  68. ### ChatCompletionResponse
  69. Returns the complete App result, `Content-Type` is `application/json`.
  70. - `message_id` (string) Unique message ID
  71. - `conversation_id` (string) Conversation ID
  72. - `mode` (string) App mode, fixed as `chat`
  73. - `answer` (string) Complete response content
  74. - `metadata` (object) Metadata
  75. - `usage` (Usage) Model usage information
  76. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  77. - `created_at` (int) Message creation timestamp, e.g., 1705395332
  78. ### ChunkChatCompletionResponse
  79. Returns the stream chunks outputted by the App, `Content-Type` is `text/event-stream`.
  80. Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below:
  81. <CodeGroup>
  82. ```streaming {{ title: 'Response' }}
  83. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  84. ```
  85. </CodeGroup>
  86. The structure of the streaming chunks varies depending on the `event`:
  87. - `event: message` LLM returns text chunk event, i.e., the complete text is output in a chunked fashion.
  88. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  89. - `message_id` (string) Unique message ID
  90. - `conversation_id` (string) Conversation ID
  91. - `answer` (string) LLM returned text chunk content
  92. - `created_at` (int) Creation timestamp, e.g., 1705395332
  93. - `event: message_file` Message file event, a new file has created by tool
  94. - `id` (string) File unique ID
  95. - `type` (string) File type,only allow "image" currently
  96. - `belongs_to` (string) Belongs to, it will only be an 'assistant' here
  97. - `url` (string) Remote url of file
  98. - `conversation_id` (string) Conversation ID
  99. - `event: message_end` Message end event, receiving this event means streaming has ended.
  100. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  101. - `message_id` (string) Unique message ID
  102. - `conversation_id` (string) Conversation ID
  103. - `metadata` (object) Metadata
  104. - `usage` (Usage) Model usage information
  105. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  106. - `event: tts_message` TTS audio stream event, that is, speech synthesis output. The content is an audio block in Mp3 format, encoded as a base64 string. When playing, simply decode the base64 and feed it into the player. (This message is available only when auto-play is enabled)
  107. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  108. - `message_id` (string) Unique message ID
  109. - `audio` (string) The audio after speech synthesis, encoded in base64 text content, when playing, simply decode the base64 and feed it into the player
  110. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  111. - `event: tts_message_end` TTS audio stream end event, receiving this event indicates the end of the audio stream.
  112. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  113. - `message_id` (string) Unique message ID
  114. - `audio` (string) The end event has no audio, so this is an empty string
  115. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  116. - `event: message_replace` Message content replacement event.
  117. When output content moderation is enabled, if the content is flagged, then the message content will be replaced with a preset reply through this event.
  118. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  119. - `message_id` (string) Unique message ID
  120. - `conversation_id` (string) Conversation ID
  121. - `answer` (string) Replacement content (directly replaces all LLM reply text)
  122. - `created_at` (int) Creation timestamp, e.g., 1705395332
  123. - `event: workflow_started` workflow starts execution
  124. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  125. - `workflow_run_id` (string) Unique ID of workflow execution
  126. - `event` (string) fixed to `workflow_started`
  127. - `data` (object) detail
  128. - `id` (string) Unique ID of workflow execution
  129. - `workflow_id` (string) ID of related workflow
  130. - `sequence_number` (int) Self-increasing serial number, self-increasing in the App, starting from 1
  131. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  132. - `event: node_started` node execution started
  133. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  134. - `workflow_run_id` (string) Unique ID of workflow execution
  135. - `event` (string) fixed to `node_started`
  136. - `data` (object) detail
  137. - `id` (string) Unique ID of workflow execution
  138. - `node_id` (string) ID of node
  139. - `node_type` (string) type of node
  140. - `title` (string) name of node
  141. - `index` (int) Execution sequence number, used to display Tracing Node sequence
  142. - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
  143. - `inputs` (array[object]) Contents of all preceding node variables used in the node
  144. - `created_at` (timestamp) timestamp of start, e.g., 1705395332
  145. - `event: node_finished` node execution ends, success or failure in different states in the same event
  146. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  147. - `workflow_run_id` (string) Unique ID of workflow execution
  148. - `event` (string) fixed to `node_finished`
  149. - `data` (object) detail
  150. - `id` (string) Unique ID of workflow execution
  151. - `node_id` (string) ID of node
  152. - `node_type` (string) type of node
  153. - `title` (string) name of node
  154. - `index` (int) Execution sequence number, used to display Tracing Node sequence
  155. - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
  156. - `inputs` (array[object]) Contents of all preceding node variables used in the node
  157. - `process_data` (json) Optional node process data
  158. - `outputs` (json) Optional content of output
  159. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  160. - `error` (string) Optional reason of error
  161. - `elapsed_time` (float) Optional total seconds to be used
  162. - `execution_metadata` (json) meta data
  163. - `total_tokens` (int) optional tokens to be used
  164. - `total_price` (decimal) optional Total cost
  165. - `currency` (string) optional e.g. `USD` / `RMB`
  166. - `created_at` (timestamp) timestamp of start, e.g., 1705395332
  167. - `event: workflow_finished` workflow execution ends, success or failure in different states in the same event
  168. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  169. - `workflow_run_id` (string) Unique ID of workflow execution
  170. - `event` (string) fixed to `workflow_finished`
  171. - `data` (object) detail
  172. - `id` (string) ID of workflow execution
  173. - `workflow_id` (string) ID of related workflow
  174. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  175. - `outputs` (json) Optional content of output
  176. - `error` (string) Optional reason of error
  177. - `elapsed_time` (float) Optional total seconds to be used
  178. - `total_tokens` (int) Optional tokens to be used
  179. - `total_steps` (int) default 0
  180. - `created_at` (timestamp) start time
  181. - `finished_at` (timestamp) end time
  182. - `event: error`
  183. Exceptions that occur during the streaming process will be output in the form of stream events, and reception of an error event will end the stream.
  184. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  185. - `message_id` (string) Unique message ID
  186. - `status` (int) HTTP status code
  187. - `code` (string) Error code
  188. - `message` (string) Error message
  189. - `event: ping` Ping event every 10 seconds to keep the connection alive.
  190. ### Errors
  191. - 404, Conversation does not exists
  192. - 400, `invalid_param`, abnormal parameter input
  193. - 400, `app_unavailable`, App configuration unavailable
  194. - 400, `provider_not_initialize`, no available model credential configuration
  195. - 400, `provider_quota_exceeded`, model invocation quota insufficient
  196. - 400, `model_currently_not_support`, current model unavailable
  197. - 400, `completion_request_error`, text generation failed
  198. - 500, internal server error
  199. </Col>
  200. <Col sticky>
  201. <CodeGroup title="Request" tag="POST" label="/chat-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "query": "What are the specs of the iPhone 13 Pro Max?",\n "response_mode": "streaming",\n "conversation_id": "",\n "user": "abc-123",\n "files": [\n {\n "type": "image",\n "transfer_method": "remote_url",\n "url": "https://cloud.dify.ai/logo/logo-site.png"\n }\n ]\n}'`}>
  202. ```bash {{ title: 'cURL' }}
  203. curl -X POST '${props.appDetail.api_base_url}/chat-messages' \
  204. --header 'Authorization: Bearer {api_key}' \
  205. --header 'Content-Type: application/json' \
  206. --data-raw '{
  207. "inputs": {},
  208. "query": "eh",
  209. "response_mode": "streaming",
  210. "conversation_id": "1c7e55fb-1ba2-4e10-81b5-30addcea2276",
  211. "user": "abc-123"
  212. }'
  213. ```
  214. </CodeGroup>
  215. ### Blocking Mode
  216. <CodeGroup title="Response">
  217. ```json {{ title: 'Response' }}
  218. {
  219. "event": "message",
  220. "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  221. "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2",
  222. "mode": "chat",
  223. "answer": "iPhone 13 Pro Max specs are listed heere:...",
  224. "metadata": {
  225. "usage": {
  226. "prompt_tokens": 1033,
  227. "prompt_unit_price": "0.001",
  228. "prompt_price_unit": "0.001",
  229. "prompt_price": "0.0010330",
  230. "completion_tokens": 128,
  231. "completion_unit_price": "0.002",
  232. "completion_price_unit": "0.001",
  233. "completion_price": "0.0002560",
  234. "total_tokens": 1161,
  235. "total_price": "0.0012890",
  236. "currency": "USD",
  237. "latency": 0.7682376249867957
  238. },
  239. "retriever_resources": [
  240. {
  241. "position": 1,
  242. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  243. "dataset_name": "iPhone",
  244. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  245. "document_name": "iPhone List",
  246. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  247. "score": 0.98457545,
  248. "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\""
  249. }
  250. ]
  251. },
  252. "created_at": 1705407629
  253. }
  254. ```
  255. </CodeGroup>
  256. ### Streaming Mode
  257. <CodeGroup title="Response">
  258. ```streaming {{ title: 'Response' }}
  259. data: {"event": "workflow_started", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "workflow_id": "dfjasklfjdslag", "sequence_number": 1, "created_at": 1679586595}}
  260. data: {"event": "node_started", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "node_id": "dfjasklfjdslag", "node_type": "start", "title": "Start", "index": 0, "predecessor_node_id": "fdljewklfklgejlglsd", "inputs": {}, "created_at": 1679586595}}
  261. data: {"event": "node_finished", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "node_id": "dfjasklfjdslag", "node_type": "start", "title": "Start", "index": 0, "predecessor_node_id": "fdljewklfklgejlglsd", "inputs": {}, "outputs": {}, "status": "succeeded", "elapsed_time": 0.324, "execution_metadata": {"total_tokens": 63127864, "total_price": 2.378, "currency": "USD"}, "created_at": 1679586595}}
  262. data: {"event": "workflow_finished", "task_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "workflow_run_id": "5ad498-f0c7-4085-b384-88cbe6290", "data": {"id": "5ad498-f0c7-4085-b384-88cbe6290", "workflow_id": "dfjasklfjdslag", "outputs": {}, "status": "succeeded", "elapsed_time": 0.324, "total_tokens": 63127864, "total_steps": "1", "created_at": 1679586595, "finished_at": 1679976595}}
  263. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " I", "created_at": 1679586595}
  264. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": "'m", "created_at": 1679586595}
  265. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " glad", "created_at": 1679586595}
  266. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " to", "created_at": 1679586595}
  267. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " meet", "created_at": 1679586595}
  268. data: {"event": "message", "message_id": : "5ad4cb98-f0c7-4085-b384-88c403be6290", "conversation_id": "45701982-8118-4bc5-8e9b-64562b4555f2", "answer": " you", "created_at": 1679586595}
  269. 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\""}]}}}
  270. 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"}
  271. 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": ""}
  272. ```
  273. </CodeGroup>
  274. </Col>
  275. </Row>
  276. ---
  277. <Heading
  278. url='/files/upload'
  279. method='POST'
  280. title='File Upload'
  281. name='#file-upload'
  282. />
  283. <Row>
  284. <Col>
  285. Upload a file (currently only images are supported) for use when sending messages, enabling multimodal understanding of images and text.
  286. Supports png, jpg, jpeg, webp, gif formats.
  287. Uploaded files are for use by the current end-user only.
  288. ### Request Body
  289. This interface requires a `multipart/form-data` request.
  290. - `file` (File) Required
  291. The file to be uploaded.
  292. - `user` (string) Required
  293. User identifier, defined by the developer's rules, must be unique within the application.
  294. ### Response
  295. After a successful upload, the server will return the file's ID and related information.
  296. - `id` (uuid) ID
  297. - `name` (string) File name
  298. - `size` (int) File size (bytes)
  299. - `extension` (string) File extension
  300. - `mime_type` (string) File mime-type
  301. - `created_by` (uuid) End-user ID
  302. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  303. ### Errors
  304. - 400, `no_file_uploaded`, a file must be provided
  305. - 400, `too_many_files`, currently only one file is accepted
  306. - 400, `unsupported_preview`, the file does not support preview
  307. - 400, `unsupported_estimate`, the file does not support estimation
  308. - 413, `file_too_large`, the file is too large
  309. - 415, `unsupported_file_type`, unsupported extension, currently only document files are accepted
  310. - 503, `s3_connection_failed`, unable to connect to S3 service
  311. - 503, `s3_permission_denied`, no permission to upload files to S3
  312. - 503, `s3_file_too_large`, file exceeds S3 size limit
  313. - 500, internal server error
  314. </Col>
  315. <Col sticky>
  316. ### Request Example
  317. <CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl -X POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif] \\\n--form 'user=abc-123'`}>
  318. ```bash {{ title: 'cURL' }}
  319. curl -X POST '${props.appDetail.api_base_url}/files/upload' \
  320. --header 'Authorization: Bearer {api_key}' \
  321. --form 'file=@"/path/to/file"'
  322. ```
  323. </CodeGroup>
  324. ### Response Example
  325. <CodeGroup title="Response">
  326. ```json {{ title: 'Response' }}
  327. {
  328. "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
  329. "name": "example.png",
  330. "size": 1024,
  331. "extension": "png",
  332. "mime_type": "image/png",
  333. "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13",
  334. "created_at": 1577836800,
  335. }
  336. ```
  337. </CodeGroup>
  338. </Col>
  339. </Row>
  340. ---
  341. <Heading
  342. url='/chat-messages/:task_id/stop'
  343. method='POST'
  344. title='Stop Generate'
  345. name='#stop-generatebacks'
  346. />
  347. <Row>
  348. <Col>
  349. Only supported in streaming mode.
  350. ### Path
  351. - `task_id` (string) Task ID, can be obtained from the streaming chunk return
  352. ### Request Body
  353. - `user` (string) Required
  354. User identifier, used to define the identity of the end-user, must be consistent with the user passed in the send message interface.
  355. ### Response
  356. - `result` (string) Always returns "success"
  357. </Col>
  358. <Col sticky>
  359. ### Request Example
  360. <CodeGroup title="Request" tag="POST" label="/chat-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}>
  361. ```bash {{ title: 'cURL' }}
  362. curl -X POST '${props.appDetail.api_base_url}/chat-messages/:task_id/stop' \
  363. -H 'Authorization: Bearer {api_key}' \
  364. -H 'Content-Type: application/json' \
  365. --data-raw '{
  366. "user": "abc-123"
  367. }'
  368. ```
  369. </CodeGroup>
  370. ### Response Example
  371. <CodeGroup title="Response">
  372. ```json {{ title: 'Response' }}
  373. {
  374. "result": "success"
  375. }
  376. ```
  377. </CodeGroup>
  378. </Col>
  379. </Row>
  380. ---
  381. <Heading
  382. url='/messages/:message_id/feedbacks'
  383. method='POST'
  384. title='Message Feedback'
  385. name='#feedbacks'
  386. />
  387. <Row>
  388. <Col>
  389. End-users can provide feedback messages, facilitating application developers to optimize expected outputs.
  390. ### Path
  391. <Properties>
  392. <Property name='message_id' type='string' key='message_id'>
  393. Message ID
  394. </Property>
  395. </Properties>
  396. ### Request Body
  397. <Properties>
  398. <Property name='rating' type='string' key='rating'>
  399. Upvote as `like`, downvote as `dislike`, revoke upvote as `null`
  400. </Property>
  401. <Property name='user' type='string' key='user'>
  402. User identifier, defined by the developer's rules, must be unique within the application.
  403. </Property>
  404. </Properties>
  405. ### Response
  406. - `result` (string) Always returns "success"
  407. </Col>
  408. <Col sticky>
  409. <CodeGroup title="Request" tag="POST" label="/messages/:message_id/feedbacks" targetCode={`curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks \\\n --header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "rating": "like",\n "user": "abc-123"\n}'`}>
  410. ```bash {{ title: 'cURL' }}
  411. curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \
  412. --header 'Authorization: Bearer {api_key}' \
  413. --header 'Content-Type: application/json' \
  414. --data-raw '{
  415. "rating": "like",
  416. "user": "abc-123"
  417. }'
  418. ```
  419. </CodeGroup>
  420. <CodeGroup title="Response">
  421. ```json {{ title: 'Response' }}
  422. {
  423. "result": "success"
  424. }
  425. ```
  426. </CodeGroup>
  427. </Col>
  428. </Row>
  429. ---
  430. <Heading
  431. url='/messages/{message_id}/suggested'
  432. method='GET'
  433. title='next suggested questions'
  434. name='#suggested'
  435. />
  436. <Row>
  437. <Col>
  438. Get next questions suggestions for the current message
  439. ### Path Params
  440. <Properties>
  441. <Property name='message_id' type='string' key='message_id'>
  442. Message ID
  443. </Property>
  444. </Properties>
  445. ### Query
  446. <Properties>
  447. <Property name='user' type='string' key='user'>
  448. User identifier, used to define the identity of the end-user for retrieval and statistics.
  449. Should be uniquely defined by the developer within the application.
  450. </Property>
  451. </Properties>
  452. </Col>
  453. <Col sticky>
  454. <CodeGroup title="Request" tag="GET" label="/messages/{message_id}/suggested" targetCode={`curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123& \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--header 'Content-Type: application/json'`}>
  455. ```bash {{ title: 'cURL' }}
  456. curl --location --request GET '${props.appDetail.api_base_url}/messages/{message_id}/suggested?user=abc-123' \
  457. --header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
  458. --header 'Content-Type: application/json' \
  459. ```
  460. </CodeGroup>
  461. <CodeGroup title="Response">
  462. ```json {{ title: 'Response' }}
  463. {
  464. "result": "success",
  465. "data": [
  466. "a",
  467. "b",
  468. "c"
  469. ]
  470. }
  471. ```
  472. </CodeGroup>
  473. </Col>
  474. </Row>
  475. ---
  476. <Heading
  477. url='/messages'
  478. method='GET'
  479. title='Get Conversation History Messages'
  480. name='#messages'
  481. />
  482. <Row>
  483. <Col>
  484. Returns historical chat records in a scrolling load format, with the first page returning the latest `{limit}` messages, i.e., in reverse order.
  485. ### Query
  486. <Properties>
  487. <Property name='conversation_id' type='string' key='conversation_id'>
  488. Conversation ID
  489. </Property>
  490. <Property name='user' type='string' key='user'>
  491. User identifier, used to define the identity of the end-user for retrieval and statistics.
  492. Should be uniquely defined by the developer within the application.
  493. </Property>
  494. <Property name='first_id' type='string' key='first_id'>
  495. The ID of the first chat record on the current page, default is null.
  496. </Property>
  497. <Property name='limit' type='int' key='limit'>
  498. How many chat history messages to return in one request, default is 20.
  499. </Property>
  500. </Properties>
  501. ### Response
  502. - `data` (array[object]) Message list
  503. - `id` (string) Message ID
  504. - `conversation_id` (string) Conversation ID
  505. - `inputs` (array[object]) User input parameters.
  506. - `query` (string) User input / question content.
  507. - `message_files` (array[object]) Message files
  508. - `id` (string) ID
  509. - `type` (string) File type, image for images
  510. - `url` (string) Preview image URL
  511. - `belongs_to` (string) belongs to,user orassistant
  512. - `answer` (string) Response message content
  513. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  514. - `feedback` (object) Feedback information
  515. - `rating` (string) Upvote as `like` / Downvote as `dislike`
  516. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  517. - `has_more` (bool) Whether there is a next page
  518. - `limit` (int) Number of returned items, if input exceeds system limit, returns system limit amount
  519. </Col>
  520. <Col sticky>
  521. <CodeGroup title="Request" tag="GET" label="/messages" targetCode={`curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='\\\n --header 'Authorization: Bearer {api_key}'`}>
  522. ```bash {{ title: 'cURL' }}
  523. curl -X GET '${props.appDetail.api_base_url}/messages?user=abc-123&conversation_id='
  524. --header 'Authorization: Bearer {api_key}'
  525. ```
  526. </CodeGroup>
  527. ### Response Example
  528. <CodeGroup title="Response">
  529. ```json {{ title: 'Response' }}
  530. {
  531. "limit": 20,
  532. "has_more": false,
  533. "data": [
  534. {
  535. "id": "a076a87f-31e5-48dc-b452-0061adbbc922",
  536. "conversation_id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
  537. "inputs": {
  538. "name": "dify"
  539. },
  540. "query": "iphone 13 pro",
  541. "answer": "The iPhone 13 Pro, released on September 24, 2021, features a 6.1-inch display with a resolution of 1170 x 2532. It is equipped with a Hexa-core (2x3.23 GHz Avalanche + 4x1.82 GHz Blizzard) processor, 6 GB of RAM, and offers storage options of 128 GB, 256 GB, 512 GB, and 1 TB. The camera is 12 MP, the battery capacity is 3095 mAh, and it runs on iOS 15.",
  542. "message_files": [],
  543. "feedback": null,
  544. "retriever_resources": [
  545. {
  546. "position": 1,
  547. "dataset_id": "101b4c97-fc2e-463c-90b1-5261a4cdcafb",
  548. "dataset_name": "iPhone",
  549. "document_id": "8dd1ad74-0b5f-4175-b735-7d98bbbb4e00",
  550. "document_name": "iPhone List",
  551. "segment_id": "ed599c7f-2766-4294-9d1d-e5235a61270a",
  552. "score": 0.98457545,
  553. "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\""
  554. }
  555. ],
  556. "created_at": 1705569239,
  557. }
  558. ]
  559. }
  560. ```
  561. </CodeGroup>
  562. </Col>
  563. </Row>
  564. ---
  565. <Heading
  566. url='/conversations'
  567. method='GET'
  568. title='Get Conversations'
  569. name='#conversations'
  570. />
  571. <Row>
  572. <Col>
  573. Retrieve the conversation list for the current user, defaulting to the most recent 20 entries.
  574. ### Query
  575. <Properties>
  576. <Property name='user' type='string' key='user'>
  577. User identifier, used to define the identity of the end-user for retrieval and statistics.
  578. Should be uniquely defined by the developer within the application.
  579. </Property>
  580. <Property name='last_id' type='string' key='last_id'>
  581. The ID of the last record on the current page, default is null.
  582. </Property>
  583. <Property name='limit' type='int' key='limit'>
  584. How many records to return in one request, default is the most recent 20 entries.
  585. </Property>
  586. <Property name='pinned' type='bool' key='pinned'>
  587. Return only pinned conversations as `true`, only non-pinned as `false`
  588. </Property>
  589. </Properties>
  590. ### Response
  591. - `data` (array[object]) List of conversations
  592. - `id` (string) Conversation ID
  593. - `name` (string) Conversation name, by default, is generated by LLM.
  594. - `inputs` (array[object]) User input parameters.
  595. - `introduction` (string) Introduction
  596. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  597. - `has_more` (bool)
  598. - `limit` (int) Number of entries returned, if input exceeds system limit, system limit number is returned
  599. </Col>
  600. <Col sticky>
  601. <CodeGroup title="Request" tag="GET" label="/conversations" targetCode={`curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20'`}>
  602. ```bash {{ title: 'cURL' }}
  603. curl -X GET '${props.appDetail.api_base_url}/conversations?user=abc-123&last_id=&limit=20' \
  604. --header 'Authorization: Bearer {api_key}'
  605. ```
  606. </CodeGroup>
  607. <CodeGroup title="Response">
  608. ```json {{ title: 'Response' }}
  609. {
  610. "limit": 20,
  611. "has_more": false,
  612. "data": [
  613. {
  614. "id": "10799fb8-64f7-4296-bbf7-b42bfbe0ae54",
  615. "name": "New chat",
  616. "inputs": {
  617. "book": "book",
  618. "myName": "Lucy"
  619. },
  620. "status": "normal",
  621. "created_at": 1679667915
  622. },
  623. {
  624. "id": "hSIhXBhNe8X1d8Et"
  625. // ...
  626. }
  627. ]
  628. }
  629. ```
  630. </CodeGroup>
  631. </Col>
  632. </Row>
  633. ---
  634. <Heading
  635. url='/conversations/:conversation_id'
  636. method='DELETE'
  637. title='Delete Conversation'
  638. name='#delete'
  639. />
  640. <Row>
  641. <Col>
  642. Delete a conversation.
  643. ### Path
  644. - `conversation_id` (string) Conversation ID
  645. ### Request Body
  646. <Properties>
  647. <Property name='user' type='string' key='user'>
  648. The user identifier, defined by the developer, must ensure uniqueness within the application.
  649. </Property>
  650. </Properties>
  651. ### Response
  652. - `result` (string) Always returns "success"
  653. </Col>
  654. <Col sticky>
  655. <CodeGroup title="Request" tag="DELETE" label="/conversations/:conversation_id" targetCode={`curl -X DELETE '${props.appDetail.api_base_url}/conversations/:conversation_id' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "user": "abc-123"\n}'`}>
  656. ```bash {{ title: 'cURL' }}
  657. curl -X DELETE '${props.appDetail.api_base_url}/conversations/{convsation_id}' \
  658. --header 'Content-Type: application/json' \
  659. --header 'Accept: application/json' \
  660. --header 'Authorization: Bearer {api_key}' \
  661. --data '{
  662. "user": "abc-123"
  663. }'
  664. ```
  665. </CodeGroup>
  666. <CodeGroup title="Response">
  667. ```json {{ title: 'Response' }}
  668. {
  669. "result": "success"
  670. }
  671. ```
  672. </CodeGroup>
  673. </Col>
  674. </Row>
  675. ---
  676. <Heading
  677. url='/conversations/:conversation_id/name'
  678. method='POST'
  679. title='Conversation Rename'
  680. name='#rename'
  681. />
  682. <Row>
  683. <Col>
  684. ### Request Body
  685. <Properties>
  686. <Property name='name' type='string' key='name'>
  687. The name of the conversation. This parameter can be omitted if `auto_generate` is set to `true`.
  688. </Property>
  689. <Property name='auto_generate' type='bool' key='auto_generate'>
  690. Automatically generate the title, default is `false`
  691. </Property>
  692. <Property name='user' type='string' key='user'>
  693. The user identifier, defined by the developer, must ensure uniqueness within the application.
  694. </Property>
  695. </Properties>
  696. ### Response
  697. - `id` (string) Conversation ID
  698. - `name` (string) Conversation name
  699. - `inputs` array[object] User input parameters.
  700. - `introduction` (string) Introduction
  701. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  702. </Col>
  703. <Col sticky>
  704. <CodeGroup title="Request" tag="POST" label="/conversations/:conversation_id/name" targetCode={`curl -X POST '${props.appDetail.api_base_url}/conversations/name' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ \n "name": "", \n "user": "abc-123"\n}'`}>
  705. ```bash {{ title: 'cURL' }}
  706. curl -X POST '${props.appDetail.api_base_url}/conversations/:conversation_id/name' \
  707. --header 'Content-Type: application/json' \
  708. --header 'Authorization: Bearer {api_key}' \
  709. --data-raw '{
  710. "name": "",
  711. "user": "abc-123"
  712. }'
  713. ```
  714. </CodeGroup>
  715. <CodeGroup title="Response">
  716. ```json {{ title: 'Response' }}
  717. {
  718. "id": "cd78daf6-f9e4-4463-9ff2-54257230a0ce",
  719. "name": "Chat vs AI",
  720. "inputs": {},
  721. "introduction": "",
  722. "created_at": 1705569238
  723. }
  724. ```
  725. </CodeGroup>
  726. </Col>
  727. </Row>
  728. ---
  729. <Heading
  730. url='/audio-to-text'
  731. method='POST'
  732. title='Speech to Text'
  733. name='#audio'
  734. />
  735. <Row>
  736. <Col>
  737. This endpoint requires a multipart/form-data request.
  738. ### Request Body
  739. <Properties>
  740. <Property name='file' type='file' key='file'>
  741. Audio file.
  742. Supported formats: `['mp3', 'mp4', 'mpeg', 'mpga', 'm4a', 'wav', 'webm']`
  743. File size limit: 15MB
  744. </Property>
  745. <Property name='user' type='string' key='user'>
  746. User identifier, defined by the developer's rules, must be unique within the application.
  747. </Property>
  748. </Properties>
  749. ### Response
  750. - `text` (string) Output text
  751. </Col>
  752. <Col sticky>
  753. <CodeGroup title="Request" tag="POST" label="/audio-to-text" targetCode={`curl -X POST '${props.appDetail.api_base_url}/audio-to-text' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'file=@localfile;type=audio/[mp3|mp4|mpeg|mpga|m4a|wav|webm]'`}>
  754. ```bash {{ title: 'cURL' }}
  755. curl -X POST '${props.appDetail.api_base_url}/conversations/name' \
  756. --header 'Authorization: Bearer {api_key}' \
  757. --form 'file=@localfile;type=audio/mp3'
  758. ```
  759. </CodeGroup>
  760. <CodeGroup title="Response">
  761. ```json {{ text: 'hello' }}
  762. {
  763. "text": ""
  764. }
  765. ```
  766. </CodeGroup>
  767. </Col>
  768. </Row>
  769. ---
  770. <Heading
  771. url='/text-to-audio'
  772. method='POST'
  773. title='text to audio'
  774. name='#audio'
  775. />
  776. <Row>
  777. <Col>
  778. Text to speech.
  779. ### Request Body
  780. <Properties>
  781. <Property name='message_id' type='str' key='text'>
  782. For text messages generated by Dify, simply pass the generated message-id directly. The backend will use the message-id to look up the corresponding content and synthesize the voice information directly. If both message_id and text are provided simultaneously, the message_id is given priority.
  783. </Property>
  784. <Property name='text' type='str' key='text'>
  785. Speech generated content。
  786. </Property>
  787. <Property name='user' type='string' key='user'>
  788. The user identifier, defined by the developer, must ensure uniqueness within the app.
  789. </Property>
  790. </Properties>
  791. </Col>
  792. <Col sticky>
  793. <CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "Hello Dify",\n "user": "abc-123"\n}'`}>
  794. ```bash {{ title: 'cURL' }}
  795. curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \
  796. --header 'Authorization: Bearer {api_key}' \
  797. --header 'Content-Type: application/json' \
  798. --data-raw '{
  799. "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
  800. "text": "Hello Dify",
  801. "user": "abc-123",
  802. "streaming": false
  803. }'
  804. ```
  805. </CodeGroup>
  806. <CodeGroup title="headers">
  807. ```json {{ title: 'headers' }}
  808. {
  809. "Content-Type": "audio/wav"
  810. }
  811. ```
  812. </CodeGroup>
  813. </Col>
  814. </Row>
  815. ---
  816. <Heading
  817. url='/parameters'
  818. method='GET'
  819. title='Get Application Information'
  820. name='#parameters'
  821. />
  822. <Row>
  823. <Col>
  824. Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.
  825. ### Query
  826. <Properties>
  827. <Property name='user' type='string' key='user'>
  828. User identifier, defined by the developer's rules, must be unique within the application.
  829. </Property>
  830. </Properties>
  831. ### Response
  832. - `opening_statement` (string) Opening statement
  833. - `suggested_questions` (array[string]) List of suggested questions for the opening
  834. - `suggested_questions_after_answer` (object) Suggest questions after enabling the answer.
  835. - `enabled` (bool) Whether it is enabled
  836. - `speech_to_text` (object) Speech to text
  837. - `enabled` (bool) Whether it is enabled
  838. - `retriever_resource` (object) Citation and Attribution
  839. - `enabled` (bool) Whether it is enabled
  840. - `annotation_reply` (object) Annotation reply
  841. - `enabled` (bool) Whether it is enabled
  842. - `user_input_form` (array[object]) User input form configuration
  843. - `text-input` (object) Text input control
  844. - `label` (string) Variable display label name
  845. - `variable` (string) Variable ID
  846. - `required` (bool) Whether it is required
  847. - `default` (string) Default value
  848. - `paragraph` (object) Paragraph text input control
  849. - `label` (string) Variable display label name
  850. - `variable` (string) Variable ID
  851. - `required` (bool) Whether it is required
  852. - `default` (string) Default value
  853. - `select` (object) Dropdown control
  854. - `label` (string) Variable display label name
  855. - `variable` (string) Variable ID
  856. - `required` (bool) Whether it is required
  857. - `default` (string) Default value
  858. - `options` (array[string]) Option values
  859. - `file_upload` (object) File upload configuration
  860. - `image` (object) Image settings
  861. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`
  862. - `enabled` (bool) Whether it is enabled
  863. - `number_limits` (int) Image number limit, default is 3
  864. - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one
  865. - `system_parameters` (object) System parameters
  866. - `image_file_size_limit` (string) Image file upload size limit (MB)
  867. </Col>
  868. <Col sticky>
  869. <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123'`}>
  870. ```bash {{ title: 'cURL' }}
  871. curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
  872. --header 'Authorization: Bearer {api_key}'
  873. ```
  874. </CodeGroup>
  875. <CodeGroup title="Response">
  876. ```json {{ title: 'Response' }}
  877. {
  878. "opening_statement": "Hello!",
  879. "suggested_questions_after_answer": {
  880. "enabled": true
  881. },
  882. "speech_to_text": {
  883. "enabled": true
  884. },
  885. "retriever_resource": {
  886. "enabled": true
  887. },
  888. "annotation_reply": {
  889. "enabled": true
  890. },
  891. "user_input_form": [
  892. {
  893. "paragraph": {
  894. "label": "Query",
  895. "variable": "query",
  896. "required": true,
  897. "default": ""
  898. }
  899. }
  900. ],
  901. "file_upload": {
  902. "image": {
  903. "enabled": false,
  904. "number_limits": 3,
  905. "detail": "high",
  906. "transfer_methods": [
  907. "remote_url",
  908. "local_file"
  909. ]
  910. }
  911. },
  912. "system_parameters": {
  913. "image_file_size_limit": "10"
  914. }
  915. }
  916. ```
  917. </CodeGroup>
  918. </Col>
  919. </Row>
  920. ---
  921. <Heading
  922. url='/meta'
  923. method='GET'
  924. title='Get Application Meta Information'
  925. name='#meta'
  926. />
  927. <Row>
  928. <Col>
  929. Used to get icons of tools in this application
  930. ### Query
  931. <Properties>
  932. <Property name='user' type='string' key='user'>
  933. User identifier, defined by the developer's rules, must be unique within the application.
  934. </Property>
  935. </Properties>
  936. ### Response
  937. - `tool_icons`(object[string]) tool icons
  938. - `tool_name` (string)
  939. - `icon` (object|string)
  940. - (object) icon object
  941. - `background` (string) background color in hex format
  942. - `content`(string) emoji
  943. - (string) url of icon
  944. </Col>
  945. <Col>
  946. <CodeGroup title="Request" tag="GET" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/meta?user=abc-123' \\\n-H 'Authorization: Bearer {api_key}'`}>
  947. ```bash {{ title: 'cURL' }}
  948. curl -X GET '${props.appDetail.api_base_url}/meta?user=abc-123' \
  949. -H 'Authorization: Bearer {api_key}'
  950. ```
  951. </CodeGroup>
  952. <CodeGroup title="Response">
  953. ```json {{ title: 'Response' }}
  954. {
  955. "tool_icons": {
  956. "dalle2": "https://cloud.dify.ai/console/api/workspaces/current/tool-provider/builtin/dalle/icon",
  957. "api_tool": {
  958. "background": "#252525",
  959. "content": "\ud83d\ude01"
  960. }
  961. }
  962. }
  963. ```
  964. </CodeGroup>
  965. </Col>
  966. </Row>