template_chat.en.mdx 44 KB

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