template_advanced_chat.en.mdx 42 KB

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