您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

template.en.mdx 27KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
  3. # Completion App API
  4. The text generation application offers non-session support and is ideal for translation, article writing, summarization AI, and more.
  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='/completion-messages'
  24. method='POST'
  25. title='Create Completion Message'
  26. name='#Create-Completion-Message'
  27. />
  28. <Row>
  29. <Col>
  30. Send a request to the text generation application.
  31. ### Request Body
  32. <Properties>
  33. <Property name='inputs' type='object' key='inputs'>
  34. Allows the entry of various variable values defined by the App.
  35. 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.
  36. The text generation application requires at least one key/value pair to be inputted.
  37. - `query` (string) Required
  38. The input text, the content to be processed.
  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. <i>Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.</i>
  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='files' type='array[object]' key='files'>
  51. File list, suitable for inputting files (images) combined with text understanding and answering questions, available only when the model supports Vision capability.
  52. - `type` (string) Supported type: `image` (currently only supports image type)
  53. - `transfer_method` (string) Transfer method, `remote_url` for image URL / `local_file` for file upload
  54. - `url` (string) Image URL (when the transfer method is `remote_url`)
  55. - `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`)
  56. </Property>
  57. </Properties>
  58. ### Response
  59. When `response_mode` is `blocking`, return a CompletionResponse object.
  60. When `response_mode` is `streaming`, return a ChunkCompletionResponse stream.
  61. ### ChatCompletionResponse
  62. Returns the complete App result, `Content-Type` is `application/json`.
  63. - `message_id` (string) Unique message ID
  64. - `mode` (string) App mode, fixed as `chat`
  65. - `answer` (string) Complete response content
  66. - `metadata` (object) Metadata
  67. - `usage` (Usage) Model usage information
  68. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  69. - `created_at` (int) Message creation timestamp, e.g., 1705395332
  70. ### ChunkChatCompletionResponse
  71. Returns the stream chunks outputted by the App, `Content-Type` is `text/event-stream`.
  72. Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below:
  73. <CodeGroup>
  74. ```streaming {{ title: 'Response' }}
  75. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  76. ```
  77. </CodeGroup>
  78. The structure of the streaming chunks varies depending on the `event`:
  79. - `event: message` LLM returns text chunk event, i.e., the complete text is output in a chunked fashion.
  80. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  81. - `message_id` (string) Unique message ID
  82. - `answer` (string) LLM returned text chunk content
  83. - `created_at` (int) Creation timestamp, e.g., 1705395332
  84. - `event: message_end` Message end event, receiving this event means streaming has ended.
  85. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  86. - `message_id` (string) Unique message ID
  87. - `metadata` (object) Metadata
  88. - `usage` (Usage) Model usage information
  89. - `retriever_resources` (array[RetrieverResource]) Citation and Attribution List
  90. - `event: tts_message` TTS audio stream event, that is, speech synthesis output. The content is an audio block in Mp3 format, encoded as a base64 string. When playing, simply decode the base64 and feed it into the player. (This message is available only when auto-play is enabled)
  91. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  92. - `message_id` (string) Unique message ID
  93. - `audio` (string) The audio after speech synthesis, encoded in base64 text content, when playing, simply decode the base64 and feed it into the player
  94. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  95. - `event: tts_message_end` TTS audio stream end event, receiving this event indicates the end of the audio stream.
  96. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  97. - `message_id` (string) Unique message ID
  98. - `audio` (string) The end event has no audio, so this is an empty string
  99. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  100. - `event: message_replace` Message content replacement event.
  101. 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.
  102. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  103. - `message_id` (string) Unique message ID
  104. - `answer` (string) Replacement content (directly replaces all LLM reply text)
  105. - `created_at` (int) Creation timestamp, e.g., 1705395332
  106. - `event: error`
  107. 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.
  108. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  109. - `message_id` (string) Unique message ID
  110. - `status` (int) HTTP status code
  111. - `code` (string) Error code
  112. - `message` (string) Error message
  113. - `event: ping` Ping event every 10 seconds to keep the connection alive.
  114. ### Errors
  115. - 404, Conversation does not exists
  116. - 400, `invalid_param`, abnormal parameter input
  117. - 400, `app_unavailable`, App configuration unavailable
  118. - 400, `provider_not_initialize`, no available model credential configuration
  119. - 400, `provider_quota_exceeded`, model invocation quota insufficient
  120. - 400, `model_currently_not_support`, current model unavailable
  121. - 400, `completion_request_error`, text generation failed
  122. - 500, internal server error
  123. </Col>
  124. <Col sticky>
  125. <CodeGroup title="Request" tag="POST" label="/completion-messages" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": {"query": "Hello, world!"},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}>
  126. ```bash {{ title: 'cURL' }}
  127. curl -X POST '${props.appDetail.api_base_url}/completion-messages' \
  128. --header 'Authorization: Bearer {api_key}' \
  129. --header 'Content-Type: application/json' \
  130. --data-raw '{
  131. "inputs": {
  132. "query": "Hello, world!"
  133. },
  134. "response_mode": "streaming",
  135. "user": "abc-123"
  136. }'
  137. ```
  138. </CodeGroup>
  139. ### Blocking Mode
  140. <CodeGroup title="Response">
  141. ```json {{ title: 'Response' }}
  142. {
  143. "event": "message",
  144. "message_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  145. "mode": "completion",
  146. "answer": "Hello World!...",
  147. "metadata": {
  148. "usage": {
  149. "prompt_tokens": 1033,
  150. "prompt_unit_price": "0.001",
  151. "prompt_price_unit": "0.001",
  152. "prompt_price": "0.0010330",
  153. "completion_tokens": 128,
  154. "completion_unit_price": "0.002",
  155. "completion_price_unit": "0.001",
  156. "completion_price": "0.0002560",
  157. "total_tokens": 1161,
  158. "total_price": "0.0012890",
  159. "currency": "USD",
  160. "latency": 0.7682376249867957
  161. }
  162. },
  163. "created_at": 1705407629
  164. }
  165. ```
  166. </CodeGroup>
  167. ### Streaming Mode
  168. <CodeGroup title="Response">
  169. ```streaming {{ title: 'Response' }}
  170. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " I", "created_at": 1679586595}
  171. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": "'m", "created_at": 1679586595}
  172. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " glad", "created_at": 1679586595}
  173. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " to", "created_at": 1679586595}
  174. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " meet", "created_at": 1679586595}
  175. data: {"event": "message", "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290", "answer": " you", "created_at": 1679586595}
  176. data: {"event": "message_end", "id": "5e52ce04-874b-4d27-9045-b3bc80def685", "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}}}
  177. data: {"event": "tts_message", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq"}
  178. data: {"event": "tts_message_end", "conversation_id": "23dd85f3-1a41-4ea0-b7a9-062734ccfaf9", "message_id": "a8bdc41c-13b2-4c18-bfd9-054b9803038c", "created_at": 1721205487, "task_id": "3bf8a0bb-e73b-4690-9e66-4e429bad8ee7", "audio": ""}
  179. ```
  180. </CodeGroup>
  181. </Col>
  182. </Row>
  183. ---
  184. <Heading
  185. url='/files/upload'
  186. method='POST'
  187. title='File Upload'
  188. name='#file-upload'
  189. />
  190. <Row>
  191. <Col>
  192. Upload a file (currently only images are supported) for use when sending messages, enabling multimodal understanding of images and text.
  193. Supports png, jpg, jpeg, webp, gif formats.
  194. <i>Uploaded files are for use by the current end-user only.</i>
  195. ### Request Body
  196. This interface requires a `multipart/form-data` request.
  197. - `file` (File) Required
  198. The file to be uploaded.
  199. - `user` (string) Required
  200. User identifier, defined by the developer's rules, must be unique within the application.
  201. ### Response
  202. After a successful upload, the server will return the file's ID and related information.
  203. - `id` (uuid) ID
  204. - `name` (string) File name
  205. - `size` (int) File size (bytes)
  206. - `extension` (string) File extension
  207. - `mime_type` (string) File mime-type
  208. - `created_by` (uuid) End-user ID
  209. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  210. ### Errors
  211. - 400, `no_file_uploaded`, a file must be provided
  212. - 400, `too_many_files`, currently only one file is accepted
  213. - 400, `unsupported_preview`, the file does not support preview
  214. - 400, `unsupported_estimate`, the file does not support estimation
  215. - 413, `file_too_large`, the file is too large
  216. - 415, `unsupported_file_type`, unsupported extension, currently only document files are accepted
  217. - 503, `s3_connection_failed`, unable to connect to S3 service
  218. - 503, `s3_permission_denied`, no permission to upload files to S3
  219. - 503, `s3_file_too_large`, file exceeds S3 size limit
  220. - 500, internal server error
  221. </Col>
  222. <Col sticky>
  223. ### Request Example
  224. <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'`}>
  225. ```bash {{ title: 'cURL' }}
  226. curl -X POST '${props.appDetail.api_base_url}/files/upload' \
  227. --header 'Authorization: Bearer {api_key}' \
  228. --form 'file=@"/path/to/file"'
  229. ```
  230. </CodeGroup>
  231. ### Response Example
  232. <CodeGroup title="Response">
  233. ```json {{ title: 'Response' }}
  234. {
  235. "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
  236. "name": "example.png",
  237. "size": 1024,
  238. "extension": "png",
  239. "mime_type": "image/png",
  240. "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13",
  241. "created_at": 1577836800,
  242. }
  243. ```
  244. </CodeGroup>
  245. </Col>
  246. </Row>
  247. ---
  248. <Heading
  249. url='/completion-messages/:task_id/stop'
  250. method='POST'
  251. title='Stop Generate'
  252. name='#stop-generatebacks'
  253. />
  254. <Row>
  255. <Col>
  256. Only supported in streaming mode.
  257. ### Path
  258. - `task_id` (string) Task ID, can be obtained from the streaming chunk return
  259. Request Body
  260. - `user` (string) Required
  261. User identifier, used to define the identity of the end-user, must be consistent with the user passed in the send message interface.
  262. ### Response
  263. - `result` (string) Always returns "success"
  264. </Col>
  265. <Col sticky>
  266. ### Request Example
  267. <CodeGroup title="Request" tag="POST" label="/completion-messages/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{ "user": "abc-123"}'`}>
  268. ```bash {{ title: 'cURL' }}
  269. curl -X POST '${props.appDetail.api_base_url}/completion-messages/:task_id/stop' \
  270. -H 'Authorization: Bearer {api_key}' \
  271. -H 'Content-Type: application/json' \
  272. --data-raw '{
  273. "user": "abc-123"
  274. }'
  275. ```
  276. </CodeGroup>
  277. ### Response Example
  278. <CodeGroup title="Response">
  279. ```json {{ title: 'Response' }}
  280. {
  281. "result": "success"
  282. }
  283. ```
  284. </CodeGroup>
  285. </Col>
  286. </Row>
  287. ---
  288. <Heading
  289. url='/messages/:message_id/feedbacks'
  290. method='POST'
  291. title='Message Feedback'
  292. name='#feedbacks'
  293. />
  294. <Row>
  295. <Col>
  296. End-users can provide feedback messages, facilitating application developers to optimize expected outputs.
  297. ### Path
  298. <Properties>
  299. <Property name='message_id' type='string' key='message_id'>
  300. Message ID
  301. </Property>
  302. </Properties>
  303. ### Request Body
  304. <Properties>
  305. <Property name='rating' type='string' key='rating'>
  306. Upvote as `like`, downvote as `dislike`, revoke upvote as `null`
  307. </Property>
  308. <Property name='user' type='string' key='user'>
  309. User identifier, defined by the developer's rules, must be unique within the application.
  310. </Property>
  311. <Property name='content' type='string' key='content'>
  312. The specific content of message feedback.
  313. </Property>
  314. </Properties>
  315. ### Response
  316. - `result` (string) Always returns "success"
  317. </Col>
  318. <Col sticky>
  319. <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 "content": "message feedback information"\n}'`}>
  320. ```bash {{ title: 'cURL' }}
  321. curl -X POST '${props.appDetail.api_base_url}/messages/:message_id/feedbacks' \
  322. --header 'Authorization: Bearer {api_key}' \
  323. --header 'Content-Type: application/json' \
  324. --data-raw '{
  325. "rating": "like",
  326. "user": "abc-123",
  327. "content": "message feedback information"
  328. }'
  329. ```
  330. </CodeGroup>
  331. <CodeGroup title="Response">
  332. ```json {{ title: 'Response' }}
  333. {
  334. "result": "success"
  335. }
  336. ```
  337. </CodeGroup>
  338. </Col>
  339. </Row>
  340. ---
  341. <Heading
  342. url='/app/feedbacks'
  343. method='GET'
  344. title='Get feedbacks of application'
  345. name='#app-feedbacks'
  346. />
  347. <Row>
  348. <Col>
  349. Get application's feedbacks.
  350. ### Query
  351. <Properties>
  352. <Property name='page' type='string' key='page'>
  353. (optional)pagination,default:1
  354. </Property>
  355. </Properties>
  356. <Properties>
  357. <Property name='limit' type='string' key='limit'>
  358. (optional) records per page default:20
  359. </Property>
  360. </Properties>
  361. ### Response
  362. - `data` (List) return apps feedback list.
  363. </Col>
  364. <Col sticky>
  365. <CodeGroup title="Request" tag="GET" label="/app/feedbacks" targetCode={`curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20'`}>
  366. ```bash {{ title: 'cURL' }}
  367. curl -X GET '${props.appDetail.api_base_url}/app/feedbacks?page=1&limit=20' \
  368. --header 'Authorization: Bearer {api_key}' \
  369. --header 'Content-Type: application/json'
  370. ```
  371. </CodeGroup>
  372. <CodeGroup title="Response">
  373. ```json {{ title: 'Response' }}
  374. {
  375. "data": [
  376. {
  377. "id": "8c0fbed8-e2f9-49ff-9f0e-15a35bdd0e25",
  378. "app_id": "f252d396-fe48-450e-94ec-e184218e7346",
  379. "conversation_id": "2397604b-9deb-430e-b285-4726e51fd62d",
  380. "message_id": "709c0b0f-0a96-4a4e-91a4-ec0889937b11",
  381. "rating": "like",
  382. "content": "message feedback information-3",
  383. "from_source": "user",
  384. "from_end_user_id": "74286412-9a1a-42c1-929c-01edb1d381d5",
  385. "from_account_id": null,
  386. "created_at": "2025-04-24T09:24:38",
  387. "updated_at": "2025-04-24T09:24:38"
  388. }
  389. ]
  390. }
  391. ```
  392. </CodeGroup>
  393. </Col>
  394. </Row>
  395. ---
  396. <Heading
  397. url='/text-to-audio'
  398. method='POST'
  399. title='Text to Audio'
  400. name='#audio'
  401. />
  402. <Row>
  403. <Col>
  404. Text to speech.
  405. ### Request Body
  406. <Properties>
  407. <Property name='message_id' type='str' key='message_id'>
  408. For text messages generated by Dify, simply pass the generated message-id directly. The backend will use the message-id to look up the corresponding content and synthesize the voice information directly. If both message_id and text are provided simultaneously, the message_id is given priority.
  409. </Property>
  410. <Property name='text' type='str' key='text'>
  411. Speech generated content.
  412. </Property>
  413. <Property name='user' type='string' key='user'>
  414. The user identifier, defined by the developer, must ensure uniqueness within the app.
  415. </Property>
  416. </Properties>
  417. </Col>
  418. <Col sticky>
  419. <CodeGroup title="Request" tag="POST" label="/text-to-audio" targetCode={`curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",\n "text": "Hello Dify",\n "user": "abc-123"\n}'`}>
  420. ```bash {{ title: 'cURL' }}
  421. curl -o text-to-audio.mp3 -X POST '${props.appDetail.api_base_url}/text-to-audio' \
  422. --header 'Authorization: Bearer {api_key}' \
  423. --header 'Content-Type: application/json' \
  424. --data-raw '{
  425. "message_id": "5ad4cb98-f0c7-4085-b384-88c403be6290",
  426. "text": "Hello Dify",
  427. "user": "abc-123"
  428. }'
  429. ```
  430. </CodeGroup>
  431. <CodeGroup title="headers">
  432. ```json {{ title: 'headers' }}
  433. {
  434. "Content-Type": "audio/wav"
  435. }
  436. ```
  437. </CodeGroup>
  438. </Col>
  439. </Row>
  440. ---
  441. <Heading
  442. url='/info'
  443. method='GET'
  444. title='Get Application Basic Information'
  445. name='#info'
  446. />
  447. <Row>
  448. <Col>
  449. Used to get basic information about this application
  450. ### Response
  451. - `name` (string) application name
  452. - `description` (string) application description
  453. - `tags` (array[string]) application tags
  454. </Col>
  455. <Col>
  456. <CodeGroup title="Request" tag="GET" label="/info" targetCode={`curl -X GET '${props.appDetail.api_base_url}/info' \\\n-H 'Authorization: Bearer {api_key}'`}>
  457. ```bash {{ title: 'cURL' }}
  458. curl -X GET '${props.appDetail.api_base_url}/info' \
  459. -H 'Authorization: Bearer {api_key}'
  460. ```
  461. </CodeGroup>
  462. <CodeGroup title="Response">
  463. ```json {{ title: 'Response' }}
  464. {
  465. "name": "My App",
  466. "description": "This is my app.",
  467. "tags": [
  468. "tag1",
  469. "tag2"
  470. ]
  471. }
  472. ```
  473. </CodeGroup>
  474. </Col>
  475. </Row>
  476. ---
  477. <Heading
  478. url='/parameters'
  479. method='GET'
  480. title='Get Application Parameters Information'
  481. name='#parameters'
  482. />
  483. <Row>
  484. <Col>
  485. Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.
  486. ### Response
  487. - `opening_statement` (string) Opening statement
  488. - `suggested_questions` (array[string]) List of suggested questions for the opening
  489. - `suggested_questions_after_answer` (object) Suggest questions after enabling the answer.
  490. - `enabled` (bool) Whether it is enabled
  491. - `speech_to_text` (object) Speech to text
  492. - `enabled` (bool) Whether it is enabled
  493. - `retriever_resource` (object) Citation and Attribution
  494. - `enabled` (bool) Whether it is enabled
  495. - `annotation_reply` (object) Annotation reply
  496. - `enabled` (bool) Whether it is enabled
  497. - `user_input_form` (array[object]) User input form configuration
  498. - `text-input` (object) Text input control
  499. - `label` (string) Variable display label name
  500. - `variable` (string) Variable ID
  501. - `required` (bool) Whether it is required
  502. - `default` (string) Default value
  503. - `paragraph` (object) Paragraph text input control
  504. - `label` (string) Variable display label name
  505. - `variable` (string) Variable ID
  506. - `required` (bool) Whether it is required
  507. - `default` (string) Default value
  508. - `select` (object) Dropdown control
  509. - `label` (string) Variable display label name
  510. - `variable` (string) Variable ID
  511. - `required` (bool) Whether it is required
  512. - `default` (string) Default value
  513. - `options` (array[string]) Option values
  514. - `file_upload` (object) File upload configuration
  515. - `image` (object) Image settings
  516. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`
  517. - `enabled` (bool) Whether it is enabled
  518. - `number_limits` (int) Image number limit, default is 3
  519. - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one
  520. - `system_parameters` (object) System parameters
  521. - `file_size_limit` (int) Document upload size limit (MB)
  522. - `image_file_size_limit` (int) Image file upload size limit (MB)
  523. - `audio_file_size_limit` (int) Audio file upload size limit (MB)
  524. - `video_file_size_limit` (int) Video file upload size limit (MB)
  525. </Col>
  526. <Col sticky>
  527. <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters'`}>
  528. ```bash {{ title: 'cURL' }}
  529. curl -X GET '${props.appDetail.api_base_url}/parameters' \
  530. --header 'Authorization: Bearer {api_key}'
  531. ```
  532. </CodeGroup>
  533. <CodeGroup title="Response">
  534. ```json {{ title: 'Response' }}
  535. {
  536. "opening_statement": "Hello!",
  537. "suggested_questions_after_answer": {
  538. "enabled": true
  539. },
  540. "speech_to_text": {
  541. "enabled": true
  542. },
  543. "retriever_resource": {
  544. "enabled": true
  545. },
  546. "annotation_reply": {
  547. "enabled": true
  548. },
  549. "user_input_form": [
  550. {
  551. "paragraph": {
  552. "label": "Query",
  553. "variable": "query",
  554. "required": true,
  555. "default": ""
  556. }
  557. }
  558. ],
  559. "file_upload": {
  560. "image": {
  561. "enabled": false,
  562. "number_limits": 3,
  563. "detail": "high",
  564. "transfer_methods": [
  565. "remote_url",
  566. "local_file"
  567. ]
  568. }
  569. },
  570. "system_parameters": {
  571. "file_size_limit": 15,
  572. "image_file_size_limit": 10,
  573. "audio_file_size_limit": 50,
  574. "video_file_size_limit": 100
  575. }
  576. }
  577. ```
  578. </CodeGroup>
  579. </Col>
  580. </Row>
  581. ---
  582. <Heading
  583. url='/site'
  584. method='GET'
  585. title='Get Application WebApp Settings'
  586. name='#site'
  587. />
  588. <Row>
  589. <Col>
  590. Used to get the WebApp settings of the application.
  591. ### Response
  592. - `title` (string) WebApp name
  593. - `chat_color_theme` (string) Chat color theme, in hex format
  594. - `chat_color_theme_inverted` (bool) Whether the chat color theme is inverted
  595. - `icon_type` (string) Icon type, `emoji` - emoji, `image` - picture
  596. - `icon` (string) Icon. If it's `emoji` type, it's an emoji symbol; if it's `image` type, it's an image URL.
  597. - `icon_background` (string) Background color in hex format
  598. - `icon_url` (string) Icon URL
  599. - `description` (string) Description
  600. - `copyright` (string) Copyright information
  601. - `privacy_policy` (string) Privacy policy link
  602. - `custom_disclaimer` (string) Custom disclaimer
  603. - `default_language` (string) Default language
  604. - `show_workflow_steps` (bool) Whether to show workflow details
  605. - `use_icon_as_answer_icon` (bool) Whether to replace 🤖 in chat with the WebApp icon
  606. </Col>
  607. <Col>
  608. <CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}>
  609. ```bash {{ title: 'cURL' }}
  610. curl -X GET '${props.appDetail.api_base_url}/site' \
  611. -H 'Authorization: Bearer {api_key}'
  612. ```
  613. </CodeGroup>
  614. <CodeGroup title="Response">
  615. ```json {{ title: 'Response' }}
  616. {
  617. "title": "My App",
  618. "chat_color_theme": "#ff4a4a",
  619. "chat_color_theme_inverted": false,
  620. "icon_type": "emoji",
  621. "icon": "😄",
  622. "icon_background": "#FFEAD5",
  623. "icon_url": null,
  624. "description": "This is my app.",
  625. "copyright": "all rights reserved",
  626. "privacy_policy": "",
  627. "custom_disclaimer": "All generated by AI",
  628. "default_language": "en-US",
  629. "show_workflow_steps": false,
  630. "use_icon_as_answer_icon": false,
  631. }
  632. ```
  633. </CodeGroup>
  634. </Col>
  635. </Row>
  636. ___