template_workflow.en.mdx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. import { CodeGroup } from '../code.tsx'
  2. import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from '../md.tsx'
  3. # Workflow App API
  4. Workflow applications 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='/workflows/run'
  24. method='POST'
  25. title='Execute Workflow'
  26. name='#Execute-Workflow'
  27. />
  28. <Row>
  29. <Col>
  30. Execute workflow, cannot be executed without a published workflow.
  31. ### Request Body
  32. - `inputs` (object) Required
  33. Allows the entry of various variable values defined by the App.
  34. 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.
  35. The workflow application requires at least one key/value pair to be inputted.
  36. If the variable is of File type, specify an object that has the keys described in `files` below.
  37. - `response_mode` (string) Required
  38. The mode of response return, supporting:
  39. - `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)).
  40. - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long)
  41. <i>Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.</i>
  42. - `user` (string) Required
  43. User identifier, used to define the identity of the end-user for retrieval and statistics.
  44. Should be uniquely defined by the developer within the application.
  45. - `files` (array[object]) Optional
  46. File list, suitable for inputting files combined with text understanding and answering questions, available only when the model supports Vision capability.
  47. - `type` (string) Supported type:
  48. - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB')
  49. - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG')
  50. - `audio` ('MP3', 'M4A', 'WAV', 'WEBM', 'AMR')
  51. - `video` ('MP4', 'MOV', 'MPEG', 'MPGA')
  52. - `transfer_method` (string) Transfer method, `remote_url` for image URL / `local_file` for file upload
  53. - `url` (string) Image URL (when the transfer method is `remote_url`)
  54. - `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`)
  55. ### Response
  56. When `response_mode` is `blocking`, return a CompletionResponse object.
  57. When `response_mode` is `streaming`, return a ChunkCompletionResponse stream.
  58. ### CompletionResponse
  59. Returns the App result, `Content-Type` is `application/json`.
  60. - `workflow_run_id` (string) Unique ID of workflow execution
  61. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  62. - `data` (object) detail of result
  63. - `id` (string) ID of workflow execution
  64. - `workflow_id` (string) ID of related workflow
  65. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  66. - `outputs` (json) Optional content of output
  67. - `error` (string) Optional reason of error
  68. - `elapsed_time` (float) Optional total seconds to be used
  69. - `total_tokens` (int) Optional tokens to be used
  70. - `total_steps` (int) default 0
  71. - `created_at` (timestamp) start time
  72. - `finished_at` (timestamp) end time
  73. ### ChunkCompletionResponse
  74. Returns the stream chunks outputted by the App, `Content-Type` is `text/event-stream`.
  75. Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below:
  76. <CodeGroup>
  77. ```streaming {{ title: 'Response' }}
  78. data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n
  79. ```
  80. </CodeGroup>
  81. The structure of the streaming chunks varies depending on the `event`:
  82. - `event: workflow_started` workflow starts execution
  83. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  84. - `workflow_run_id` (string) Unique ID of workflow execution
  85. - `event` (string) fixed to `workflow_started`
  86. - `data` (object) detail
  87. - `id` (string) Unique ID of workflow execution
  88. - `workflow_id` (string) ID of related workflow
  89. - `sequence_number` (int) Self-increasing serial number, self-increasing in the App, starting from 1
  90. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  91. - `event: node_started` node execution started
  92. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  93. - `workflow_run_id` (string) Unique ID of workflow execution
  94. - `event` (string) fixed to `node_started`
  95. - `data` (object) detail
  96. - `id` (string) Unique ID of workflow execution
  97. - `node_id` (string) ID of node
  98. - `node_type` (string) type of node
  99. - `title` (string) name of node
  100. - `index` (int) Execution sequence number, used to display Tracing Node sequence
  101. - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
  102. - `inputs` (array[object]) Contents of all preceding node variables used in the node
  103. - `created_at` (timestamp) timestamp of start, e.g., 1705395332
  104. - `event: node_finished` node execution ends, success or failure in different states in the same event
  105. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  106. - `workflow_run_id` (string) Unique ID of workflow execution
  107. - `event` (string) fixed to `node_finished`
  108. - `data` (object) detail
  109. - `id` (string) Unique ID of workflow execution
  110. - `node_id` (string) ID of node
  111. - `node_type` (string) type of node
  112. - `title` (string) name of node
  113. - `index` (int) Execution sequence number, used to display Tracing Node sequence
  114. - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path
  115. - `inputs` (array[object]) Contents of all preceding node variables used in the node
  116. - `process_data` (json) Optional node process data
  117. - `outputs` (json) Optional content of output
  118. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  119. - `error` (string) Optional reason of error
  120. - `elapsed_time` (float) Optional total seconds to be used
  121. - `execution_metadata` (json) meta data
  122. - `total_tokens` (int) optional tokens to be used
  123. - `total_price` (decimal) optional Total cost
  124. - `currency` (string) optional e.g. `USD` / `RMB`
  125. - `created_at` (timestamp) timestamp of start, e.g., 1705395332
  126. - `event: workflow_finished` workflow execution ends, success or failure in different states in the same event
  127. - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API
  128. - `workflow_run_id` (string) Unique ID of workflow execution
  129. - `event` (string) fixed to `workflow_finished`
  130. - `data` (object) detail
  131. - `id` (string) ID of workflow execution
  132. - `workflow_id` (string) ID of related workflow
  133. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  134. - `outputs` (json) Optional content of output
  135. - `error` (string) Optional reason of error
  136. - `elapsed_time` (float) Optional total seconds to be used
  137. - `total_tokens` (int) Optional tokens to be used
  138. - `total_steps` (int) default 0
  139. - `created_at` (timestamp) start time
  140. - `finished_at` (timestamp) end time
  141. - `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)
  142. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  143. - `message_id` (string) Unique message ID
  144. - `audio` (string) The audio after speech synthesis, encoded in base64 text content, when playing, simply decode the base64 and feed it into the player
  145. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  146. - `event: tts_message_end` TTS audio stream end event, receiving this event indicates the end of the audio stream.
  147. - `task_id` (string) Task ID, used for request tracking and the stop response interface below
  148. - `message_id` (string) Unique message ID
  149. - `audio` (string) The end event has no audio, so this is an empty string
  150. - `created_at` (int) Creation timestamp, e.g.: 1705395332
  151. - `event: ping` Ping event every 10 seconds to keep the connection alive.
  152. ### Errors
  153. - 400, `invalid_param`, abnormal parameter input
  154. - 400, `app_unavailable`, App configuration unavailable
  155. - 400, `provider_not_initialize`, no available model credential configuration
  156. - 400, `provider_quota_exceeded`, model invocation quota insufficient
  157. - 400, `model_currently_not_support`, current model unavailable
  158. - 400, `workflow_request_error`, workflow execution failed
  159. - 500, internal server error
  160. </Col>
  161. <Col sticky>
  162. <CodeGroup title="Request" tag="POST" label="/workflows/run" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/run' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n "inputs": ${JSON.stringify(props.inputs)},\n "response_mode": "streaming",\n "user": "abc-123"\n}'\n`}>
  163. ```bash {{ title: 'cURL' }}
  164. curl -X POST '${props.appDetail.api_base_url}/workflows/run' \
  165. --header 'Authorization: Bearer {api_key}' \
  166. --header 'Content-Type: application/json' \
  167. --data-raw '{
  168. "inputs": {},
  169. "response_mode": "streaming",
  170. "user": "abc-123"
  171. }'
  172. ```
  173. </CodeGroup>
  174. ### Blocking Mode
  175. <CodeGroup title="Response">
  176. ```json {{ title: 'Response' }}
  177. {
  178. "workflow_run_id": "djflajgkldjgd",
  179. "task_id": "9da23599-e713-473b-982c-4328d4f5c78a",
  180. "data": {
  181. "id": "fdlsjfjejkghjda",
  182. "workflow_id": "fldjaslkfjlsda",
  183. "status": "succeeded",
  184. "outputs": {
  185. "text": "Nice to meet you."
  186. },
  187. "error": null,
  188. "elapsed_time": 0.875,
  189. "total_tokens": 3562,
  190. "total_steps": 8,
  191. "created_at": 1705407629,
  192. "finished_at": 1727807631
  193. }
  194. }
  195. ```
  196. </CodeGroup>
  197. ### Streaming Mode
  198. <CodeGroup title="Response">
  199. ```streaming {{ title: 'Response' }}
  200. 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}}
  201. 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}}
  202. 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}}
  203. 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}}
  204. 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"}
  205. 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": ""}
  206. ```
  207. </CodeGroup>
  208. </Col>
  209. </Row>
  210. ---
  211. <Heading
  212. url='/workflows/run/:workflow_id'
  213. method='GET'
  214. title='Get Workflow Run Detail'
  215. name='#get-workflow-run-detail'
  216. />
  217. <Row>
  218. <Col>
  219. Retrieve the current execution results of a workflow task based on the workflow execution ID.
  220. ### Path
  221. - `workflow_id` (string) Workflow ID, can be obtained from the streaming chunk return
  222. ### Response
  223. - `id` (string) ID of workflow execution
  224. - `workflow_id` (string) ID of related workflow
  225. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  226. - `inputs` (json) content of input
  227. - `outputs` (json) content of output
  228. - `error` (string) reason of error
  229. - `total_steps` (int) total steps of task
  230. - `total_tokens` (int) total tokens to be used
  231. - `created_at` (timestamp) start time
  232. - `finished_at` (timestamp) end time
  233. - `elapsed_time` (float) total seconds to be used
  234. </Col>
  235. <Col sticky>
  236. ### Request Example
  237. <CodeGroup title="Request" tag="GET" label="/workflows/run/:workflow_id" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_id' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json'`}>
  238. ```bash {{ title: 'cURL' }}
  239. curl -X GET '${props.appDetail.api_base_url}/workflows/run/:workflow_id' \
  240. -H 'Authorization: Bearer {api_key}' \
  241. -H 'Content-Type: application/json'
  242. ```
  243. </CodeGroup>
  244. ### Response Example
  245. <CodeGroup title="Response">
  246. ```json {{ title: 'Response' }}
  247. {
  248. "id": "b1ad3277-089e-42c6-9dff-6820d94fbc76",
  249. "workflow_id": "19eff89f-ec03-4f75-b0fc-897e7effea02",
  250. "status": "succeeded",
  251. "inputs": "{\"sys.files\": [], \"sys.user_id\": \"abc-123\"}",
  252. "outputs": null,
  253. "error": null,
  254. "total_steps": 3,
  255. "total_tokens": 0,
  256. "created_at": "Thu, 18 Jul 2024 03:17:40 -0000",
  257. "finished_at": "Thu, 18 Jul 2024 03:18:10 -0000",
  258. "elapsed_time": 30.098514399956912
  259. }
  260. ```
  261. </CodeGroup>
  262. </Col>
  263. </Row>
  264. ---
  265. <Heading
  266. url='/workflows/tasks/:task_id/stop'
  267. method='POST'
  268. title='Stop Generate'
  269. name='#stop-generatebacks'
  270. />
  271. <Row>
  272. <Col>
  273. Only supported in streaming mode.
  274. ### Path
  275. - `task_id` (string) Task ID, can be obtained from the streaming chunk return
  276. ### Request Body
  277. - `user` (string) Required
  278. User identifier, used to define the identity of the end-user, must be consistent with the user passed in the send message interface.
  279. ### Response
  280. - `result` (string) Always returns "success"
  281. </Col>
  282. <Col sticky>
  283. ### Request Example
  284. <CodeGroup title="Request" tag="POST" label="/workflows/tasks/:task_id/stop" targetCode={`curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \\\n-H 'Authorization: Bearer {api_key}' \\\n-H 'Content-Type: application/json' \\\n--data-raw '{"user": "abc-123"}'`}>
  285. ```bash {{ title: 'cURL' }}
  286. curl -X POST '${props.appDetail.api_base_url}/workflows/tasks/:task_id/stop' \
  287. -H 'Authorization: Bearer {api_key}' \
  288. -H 'Content-Type: application/json' \
  289. --data-raw '{
  290. "user": "abc-123"
  291. }'
  292. ```
  293. </CodeGroup>
  294. ### Response Example
  295. <CodeGroup title="Response">
  296. ```json {{ title: 'Response' }}
  297. {
  298. "result": "success"
  299. }
  300. ```
  301. </CodeGroup>
  302. </Col>
  303. </Row>
  304. ---
  305. <Heading
  306. url='/files/upload'
  307. method='POST'
  308. title='File Upload'
  309. name='#file-upload'
  310. />
  311. <Row>
  312. <Col>
  313. Upload a file for use when sending messages, enabling multimodal understanding of images and text.
  314. Supports any formats that are supported by your workflow.
  315. Uploaded files are for use by the current end-user only.
  316. ### Request Body
  317. This interface requires a `multipart/form-data` request.
  318. - `file` (File) Required
  319. The file to be uploaded.
  320. - `user` (string) Required
  321. User identifier, defined by the developer's rules, must be unique within the application.
  322. ### Response
  323. After a successful upload, the server will return the file's ID and related information.
  324. - `id` (uuid) ID
  325. - `name` (string) File name
  326. - `size` (int) File size (bytes)
  327. - `extension` (string) File extension
  328. - `mime_type` (string) File mime-type
  329. - `created_by` (uuid) End-user ID
  330. - `created_at` (timestamp) Creation timestamp, e.g., 1705395332
  331. ### Errors
  332. - 400, `no_file_uploaded`, a file must be provided
  333. - 400, `too_many_files`, currently only one file is accepted
  334. - 400, `unsupported_preview`, the file does not support preview
  335. - 400, `unsupported_estimate`, the file does not support estimation
  336. - 413, `file_too_large`, the file is too large
  337. - 415, `unsupported_file_type`, unsupported extension, currently only document files are accepted
  338. - 503, `s3_connection_failed`, unable to connect to S3 service
  339. - 503, `s3_permission_denied`, no permission to upload files to S3
  340. - 503, `s3_file_too_large`, file exceeds S3 size limit
  341. - 500, internal server error
  342. </Col>
  343. <Col sticky>
  344. ### Request Example
  345. <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'`}>
  346. ```bash {{ title: 'cURL' }}
  347. curl -X POST '${props.appDetail.api_base_url}/files/upload' \
  348. --header 'Authorization: Bearer {api_key}' \
  349. --form 'file=@"/path/to/file"'
  350. ```
  351. </CodeGroup>
  352. ### Response Example
  353. <CodeGroup title="Response">
  354. ```json {{ title: 'Response' }}
  355. {
  356. "id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
  357. "name": "example.png",
  358. "size": 1024,
  359. "extension": "png",
  360. "mime_type": "image/png",
  361. "created_by": "6ad1ab0a-73ff-4ac1-b9e4-cdb312f71f13",
  362. "created_at": 1577836800,
  363. }
  364. ```
  365. </CodeGroup>
  366. </Col>
  367. </Row>
  368. ---
  369. <Heading
  370. url='/parameters'
  371. method='GET'
  372. title='Get Application Information'
  373. name='#parameters'
  374. />
  375. <Row>
  376. <Col>
  377. Used at the start of entering the page to obtain information such as features, input parameter names, types, and default values.
  378. ### Query
  379. <Properties>
  380. <Property name='user' type='string' key='user'>
  381. User identifier, defined by the developer's rules, must be unique within the application.
  382. </Property>
  383. </Properties>
  384. ### Response
  385. - `user_input_form` (array[object]) User input form configuration
  386. - `text-input` (object) Text input control
  387. - `label` (string) Variable display label name
  388. - `variable` (string) Variable ID
  389. - `required` (bool) Whether it is required
  390. - `default` (string) Default value
  391. - `paragraph` (object) Paragraph text input control
  392. - `label` (string) Variable display label name
  393. - `variable` (string) Variable ID
  394. - `required` (bool) Whether it is required
  395. - `default` (string) Default value
  396. - `select` (object) Dropdown control
  397. - `label` (string) Variable display label name
  398. - `variable` (string) Variable ID
  399. - `required` (bool) Whether it is required
  400. - `default` (string) Default value
  401. - `options` (array[string]) Option values
  402. - `file_upload` (object) File upload configuration
  403. - `image` (object) Image settings
  404. Currently only supports image types: `png`, `jpg`, `jpeg`, `webp`, `gif`
  405. - `enabled` (bool) Whether it is enabled
  406. - `number_limits` (int) Image number limit, default is 3
  407. - `transfer_methods` (array[string]) List of transfer methods, remote_url, local_file, must choose one
  408. - `system_parameters` (object) System parameters
  409. - `file_size_limit` (int) Document upload size limit (MB)
  410. - `image_file_size_limit` (int) Image file upload size limit (MB)
  411. - `audio_file_size_limit` (int) Audio file upload size limit (MB)
  412. - `video_file_size_limit` (int) Video file upload size limit (MB)
  413. </Col>
  414. <Col sticky>
  415. <CodeGroup title="Request" tag="GET" label="/parameters" targetCode={` curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123'`}>
  416. ```bash {{ title: 'cURL' }}
  417. curl -X GET '${props.appDetail.api_base_url}/parameters?user=abc-123' \
  418. --header 'Authorization: Bearer {api_key}'
  419. ```
  420. </CodeGroup>
  421. <CodeGroup title="Response">
  422. ```json {{ title: 'Response' }}
  423. {
  424. "user_input_form": [
  425. {
  426. "paragraph": {
  427. "label": "Query",
  428. "variable": "query",
  429. "required": true,
  430. "default": ""
  431. }
  432. }
  433. ],
  434. "file_upload": {
  435. "image": {
  436. "enabled": false,
  437. "number_limits": 3,
  438. "detail": "high",
  439. "transfer_methods": [
  440. "remote_url",
  441. "local_file"
  442. ]
  443. }
  444. },
  445. "system_parameters": {
  446. "file_size_limit": 15,
  447. "image_file_size_limit": 10,
  448. "audio_file_size_limit": 50,
  449. "video_file_size_limit": 100
  450. }
  451. }
  452. ```
  453. </CodeGroup>
  454. </Col>
  455. </Row>
  456. ---
  457. <Heading
  458. url='/workflows/logs'
  459. method='GET'
  460. title='Get Workflow Logs'
  461. name='#Get-Workflow-Logs'
  462. />
  463. <Row>
  464. <Col>
  465. Returns workflow logs, with the first page returning the latest `{limit}` messages, i.e., in reverse order.
  466. ### Query
  467. <Properties>
  468. <Property name='keyword' type='string' key='keyword'>
  469. Keyword to search
  470. </Property>
  471. <Property name='status' type='string' key='status'>
  472. succeeded/failed/stopped
  473. </Property>
  474. <Property name='page' type='int' key='page'>
  475. current page, default is 1.
  476. </Property>
  477. <Property name='limit' type='int' key='limit'>
  478. How many chat history messages to return in one request, default is 20.
  479. </Property>
  480. </Properties>
  481. ### Response
  482. - `page` (int) Current page
  483. - `limit` (int) Number of returned items, if input exceeds system limit, returns system limit amount
  484. - `total` (int) Number of total items
  485. - `has_more` (bool) Whether there is a next page
  486. - `data` (array[object]) Log list
  487. - `id` (string) ID
  488. - `workflow_run` (object) Workflow run
  489. - `id` (string) ID
  490. - `version` (string) Version
  491. - `status` (string) status of execution, `running` / `succeeded` / `failed` / `stopped`
  492. - `error` (string) Optional reason of error
  493. - `elapsed_time` (float) total seconds to be used
  494. - `total_tokens` (int) tokens to be used
  495. - `total_steps` (int) default 0
  496. - `created_at` (timestamp) start time
  497. - `finished_at` (timestamp) end time
  498. - `created_from` (string) Created from
  499. - `created_by_role` (string) Created by role
  500. - `created_by_account` (string) Optional Created by account
  501. - `created_by_end_user` (object) Created by end user
  502. - `id` (string) ID
  503. - `type` (string) Type
  504. - `is_anonymous` (bool) Is anonymous
  505. - `session_id` (string) Session ID
  506. - `created_at` (timestamp) create time
  507. </Col>
  508. <Col sticky>
  509. <CodeGroup title="Request" tag="GET" label="/workflows/logs" targetCode={`curl -X GET '${props.appDetail.api_base_url}/workflows/logs'\\\n --header 'Authorization: Bearer {api_key}'`}>
  510. ```bash {{ title: 'cURL' }}
  511. curl -X GET '${props.appDetail.api_base_url}/workflows/logs?limit=1'
  512. --header 'Authorization: Bearer {api_key}'
  513. ```
  514. </CodeGroup>
  515. ### Response Example
  516. <CodeGroup title="Response">
  517. ```json {{ title: 'Response' }}
  518. {
  519. "page": 1,
  520. "limit": 1,
  521. "total": 7,
  522. "has_more": true,
  523. "data": [
  524. {
  525. "id": "e41b93f1-7ca2-40fd-b3a8-999aeb499cc0",
  526. "workflow_run": {
  527. "id": "c0640fc8-03ef-4481-a96c-8a13b732a36e",
  528. "version": "2024-08-01 12:17:09.771832",
  529. "status": "succeeded",
  530. "error": null,
  531. "elapsed_time": 1.3588523610014818,
  532. "total_tokens": 0,
  533. "total_steps": 3,
  534. "created_at": 1726139643,
  535. "finished_at": 1726139644
  536. },
  537. "created_from": "service-api",
  538. "created_by_role": "end_user",
  539. "created_by_account": null,
  540. "created_by_end_user": {
  541. "id": "7f7d9117-dd9d-441d-8970-87e5e7e687a3",
  542. "type": "service_api",
  543. "is_anonymous": false,
  544. "session_id": "abc-123"
  545. },
  546. "created_at": 1726139644
  547. }
  548. ]
  549. }
  550. ```
  551. </CodeGroup>
  552. </Col>
  553. </Row>