From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- app/components/develop/template/template_workflow.en.mdx | 103 ++++++++++----------------------------------------- 1 files changed, 20 insertions(+), 83 deletions(-) diff --git a/app/components/develop/template/template_workflow.en.mdx b/app/components/develop/template/template_workflow.en.mdx index 2afcedc..27c0d26 100644 --- a/app/components/develop/template/template_workflow.en.mdx +++ b/app/components/develop/template/template_workflow.en.mdx @@ -43,9 +43,18 @@ - `inputs` (object) Required Allows the entry of various variable values defined by the App. 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. - The workflow application requires at least one key/value pair to be inputted. The variable can be of File Array type. - File Array type variable is suitable for inputting files combined with text understanding and answering questions, available only when the model supports file parsing and understanding capability. - If the variable is of File Array type, the corresponding value should be a list whose elements contain following attributions: + The workflow application requires at least one key/value pair to be inputted. + If the variable is of File type, specify an object that has the keys described in `files` below. + - `response_mode` (string) Required + The mode of response return, supporting: + - `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)). + - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long) + <i>Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.</i> + - `user` (string) Required + User identifier, used to define the identity of the end-user for retrieval and statistics. + Should be uniquely defined by the developer within the application. + - `files` (array[object]) Optional + File list, suitable for inputting files combined with text understanding and answering questions, available only when the model supports file parsing and understanding capability. - `type` (string) Supported type: - `document` ('TXT', 'MD', 'MARKDOWN', 'PDF', 'HTML', 'XLSX', 'XLS', 'DOCX', 'CSV', 'EML', 'MSG', 'PPTX', 'PPT', 'XML', 'EPUB') - `image` ('JPG', 'JPEG', 'PNG', 'GIF', 'WEBP', 'SVG') @@ -55,15 +64,6 @@ - `transfer_method` (string) Transfer method, `remote_url` for image URL / `local_file` for file upload - `url` (string) Image URL (when the transfer method is `remote_url`) - `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`) - - - `response_mode` (string) Required - The mode of response return, supporting: - - `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)). - - `blocking` Blocking mode, returns result after execution is complete. (Requests may be interrupted if the process is long) - <i>Due to Cloudflare restrictions, the request will be interrupted without a return after 100 seconds.</i> - - `user` (string) Required - User identifier, used to define the identity of the end-user for retrieval and statistics. - Should be uniquely defined by the developer within the application. ### Response When `response_mode` is `blocking`, return a CompletionResponse object. @@ -90,7 +90,7 @@ Each streaming chunk starts with `data:`, separated by two newline characters `\n\n`, as shown below: <CodeGroup> ```streaming {{ title: 'Response' }} - data: {"event": "text_chunk", "workflow_run_id": "b85e5fc5-751b-454d-b14e-dc5f240b0a31", "task_id": "bd029338-b068-4d34-a331-fc85478922c2", "data": {"text": "\u4e3a\u4e86", "from_variable_selector": ["1745912968134", "text"]}}\n\n + data: {"event": "message", "task_id": "900bbd43-dc0b-4383-a372-aa6e6c414227", "id": "663c5084-a254-4040-8ad3-51f2a3c1a77c", "answer": "Hi", "created_at": 1705398420}\n\n ``` </CodeGroup> The structure of the streaming chunks varies depending on the `event`: @@ -116,13 +116,6 @@ - `predecessor_node_id` (string) optional Prefix node ID, used for canvas display execution path - `inputs` (object) Contents of all preceding node variables used in the node - `created_at` (timestamp) timestamp of start, e.g., 1705395332 - - `event: text_chunk` Text fragment - - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API - - `workflow_run_id` (string) Unique ID of workflow execution - - `event` (string) fixed to `text_chunk` - - `data` (object) detail - - `text` (string) Text content - - `from_variable_selector` (array) Text source path, helping developers understand which node and variable generated the text - `event: node_finished` node execution ends, success or failure in different states in the same event - `task_id` (string) Task ID, used for request tracking and the below Stop Generate API - `workflow_run_id` (string) Unique ID of workflow execution @@ -197,18 +190,15 @@ ``` </CodeGroup> - <CodeGroup title="Example: file array as an input variable"> + <CodeGroup title="File variable example"> ```json {{ title: 'File variable example' }} { "inputs": { - "{variable_name}": - [ - { + "{variable_name}": { "transfer_method": "local_file", "upload_file_id": "{upload_file_id}", "type": "{document_type}" - } - ] + } } } ``` @@ -289,11 +279,11 @@ data = { "inputs": { - "orig_mail": [{ + "orig_mail": { "transfer_method": "local_file", "upload_file_id": file_id, "type": "document" - }] + } }, "response_mode": response_mode, "user": user @@ -377,8 +367,8 @@ "error": null, "total_steps": 3, "total_tokens": 0, - "created_at": 1705407629, - "finished_at": 1727807631, + "created_at": "Thu, 18 Jul 2024 03:17:40 -0000", + "finished_at": "Thu, 18 Jul 2024 03:18:10 -0000", "elapsed_time": 30.098514399956912 } ``` @@ -737,56 +727,3 @@ </CodeGroup> </Col> </Row> ---- - -<Heading - url='/site' - method='GET' - title='Get Application WebApp Settings' - name='#site' -/> -<Row> - <Col> - Used to get the WebApp settings of the application. - ### Response - - `title` (string) WebApp name - - `icon_type` (string) Icon type, `emoji` - emoji, `image` - picture - - `icon` (string) Icon. If it's `emoji` type, it's an emoji symbol; if it's `image` type, it's an image URL. - - `icon_background` (string) Background color in hex format - - `icon_url` (string) Icon URL - - `description` (string) Description - - `copyright` (string) Copyright information - - `privacy_policy` (string) Privacy policy link - - `custom_disclaimer` (string) Custom disclaimer - - `default_language` (string) Default language - - `show_workflow_steps` (bool) Whether to show workflow details - </Col> - <Col> - <CodeGroup title="Request" tag="POST" label="/meta" targetCode={`curl -X GET '${props.appDetail.api_base_url}/site' \\\n-H 'Authorization: Bearer {api_key}'`}> - ```bash {{ title: 'cURL' }} - curl -X GET '${props.appDetail.api_base_url}/site' \ - -H 'Authorization: Bearer {api_key}' - ``` - - </CodeGroup> - - <CodeGroup title="Response"> - ```json {{ title: 'Response' }} - { - "title": "My App", - "icon_type": "emoji", - "icon": "馃槃", - "icon_background": "#FFEAD5", - "icon_url": null, - "description": "This is my app.", - "copyright": "all rights reserved", - "privacy_policy": "", - "custom_disclaimer": "All generated by AI", - "default_language": "en-US", - "show_workflow_steps": false, - } - ``` - </CodeGroup> - </Col> -</Row> -___ -- Gitblit v1.8.0