mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-10 03:16:51 +08:00
feat: [frontend] support vision (#1518)
Co-authored-by: Joel <iamjoel007@gmail.com>
This commit is contained in:
@@ -56,6 +56,15 @@ For high-quality text generation, such as articles, summaries, and translations,
|
||||
<Property name='user' type='string' key='user'>
|
||||
The user identifier, defined by the developer, must ensure uniqueness within the app.
|
||||
</Property>
|
||||
<Property name='files' type='array[object]' key='files'>
|
||||
Uploaded files.
|
||||
- `type` file type: currently only `image` is supported.
|
||||
- `transfer_method` transfer method:
|
||||
- `remote_url`: Image address.
|
||||
- `local_file`: upload file.
|
||||
- `upload_file_id` Upload file ID. Required when `transfer_method` is `local_file`.
|
||||
- `url` image address. Required when `transfer_method` is `remote_url`.
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
@@ -168,6 +177,57 @@ For high-quality text generation, such as articles, summaries, and translations,
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/files/upload'
|
||||
method='POST'
|
||||
title='Upload files'
|
||||
name='#files-upload'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
Upload files to the server for text generation and dialogue. Uploaded files are only available to the current end user.
|
||||
|
||||
### Request Body
|
||||
The request method is `multipart/form-data`
|
||||
<Properties>
|
||||
<Property name='file' type='file' key='file'>
|
||||
The file to upload. Currently supports png, jpg, jpeg, webp, gif format files.
|
||||
</Property>
|
||||
<Property name='user' type='string' key='user'>
|
||||
User ID, rules are defined by the developer, and it is necessary to ensure that the user ID is unique within the application.
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
|
||||
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif] \\\n--form 'user=abc-123'`}>
|
||||
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \
|
||||
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
|
||||
--form 'file=@"/path/to/file"'
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
|
||||
"name": "example.png",
|
||||
"size": 1024,
|
||||
"extension": "png",
|
||||
"mime_type": "image/png",
|
||||
"created_by": 123,
|
||||
"created_at": 1577836800,
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/parameters'
|
||||
method='GET'
|
||||
@@ -176,7 +236,9 @@ For high-quality text generation, such as articles, summaries, and translations,
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
Retrieve configured Input parameters, including variable names, field names, types, and default values. Typically used for displaying these fields in a form or filling in default values after the client loads.
|
||||
Content include:
|
||||
1. Retrieve configured Input parameters, including variable names, field names, types, and default values. Typically used for displaying these fields in a form or filling in default values after the client loads.
|
||||
2. Configuration of uploading images, including whether to enable image uploading, the number of uploaded images and the uploading method. Note: This configuration is only available when using a model that supports multimodality.
|
||||
|
||||
### Query
|
||||
|
||||
@@ -201,19 +263,30 @@ For high-quality text generation, such as articles, summaries, and translations,
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"introduction": "nice to meet you",
|
||||
"variables": [
|
||||
"user_input_form": [
|
||||
{
|
||||
"key": "book",
|
||||
"name": "Which book?",
|
||||
"description": null,
|
||||
"type": "string",
|
||||
"default": null,
|
||||
"options": null
|
||||
},
|
||||
"text-input": {
|
||||
"label": "a",
|
||||
"variable": "a",
|
||||
"required": true,
|
||||
"max_length": 48,
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
{
|
||||
// ...
|
||||
}
|
||||
]
|
||||
],
|
||||
"file_upload": {
|
||||
"image": {
|
||||
"enabled": true,
|
||||
"number_limits": 3,
|
||||
"transfer_methods": [
|
||||
"remote_url",
|
||||
"local_file"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -56,6 +56,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
<Property name='user' type='string' key='user'>
|
||||
用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
|
||||
</Property>
|
||||
<Property name='files' type='array[object]' key='files'>
|
||||
上传的文件。
|
||||
- `type` 文件类型:目前仅支持 `image`。
|
||||
- `transfer_method` 传递方式:
|
||||
- `remote_url`: 图片地址。
|
||||
- `local_file`: 上传文件。
|
||||
- `upload_file_id` 上传文件 ID。`transfer_method` 为 `local_file` 时必填。
|
||||
- `url` 图片地址。`transfer_method` 为 `remote_url` 时必填。
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
@@ -168,6 +177,57 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/files/upload'
|
||||
method='POST'
|
||||
title='上传文件'
|
||||
name='#files-upload'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
上传文件到服务器,供文本生成、对话使用。上传的文件仅供当前终端用户使用。
|
||||
|
||||
### Request Body
|
||||
请求方式为 `multipart/form-data`。
|
||||
<Properties>
|
||||
<Property name='file' type='file' key='file'>
|
||||
要上传的文件。目前支持 png, jpg, jpeg, webp, gif 格式文件。
|
||||
</Property>
|
||||
<Property name='user' type='string' key='user'>
|
||||
用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
|
||||
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif] \\\n--form 'user=abc-123'`}>
|
||||
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \
|
||||
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
|
||||
--form 'file=@"/path/to/file"'
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
|
||||
"name": "example.png",
|
||||
"size": 1024,
|
||||
"extension": "png",
|
||||
"mime_type": "image/png",
|
||||
"created_by": 123,
|
||||
"created_at": 1577836800,
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/parameters'
|
||||
method='GET'
|
||||
@@ -176,7 +236,9 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
获取已配置的 Input 参数,包括变量名、字段名称、类型与默认值。通常用于客户端加载后显示这些字段的表单或填入默认值。
|
||||
内容包括:
|
||||
1. 已配置的 Input 参数,包括变量名、字段名称、类型与默认值。通常用于客户端加载后显示这些字段的表单或填入默认值。
|
||||
2. 上传图片的配置,包括是否开启上传图片,上传图片的数量和上传方式。注意:这个配置只有使用支持多模态的模型时才会生效。
|
||||
|
||||
### Query
|
||||
|
||||
@@ -201,19 +263,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"introduction": "nice to meet you",
|
||||
"variables": [
|
||||
"user_input_form": [
|
||||
{
|
||||
"key": "book",
|
||||
"name": "Which book?",
|
||||
"description": null,
|
||||
"type": "string",
|
||||
"default": null,
|
||||
"options": null
|
||||
},
|
||||
"text-input": {
|
||||
"label": "a",
|
||||
"variable": "a",
|
||||
"required": true,
|
||||
"max_length": 48,
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
{
|
||||
// ...
|
||||
}
|
||||
]
|
||||
],
|
||||
"file_upload": {
|
||||
"image": {
|
||||
"enabled": true,
|
||||
"number_limits": 3,
|
||||
"transfer_methods": [
|
||||
"remote_url",
|
||||
"local_file"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -62,6 +62,15 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
|
||||
<Property name='user' type='string' key='user'>
|
||||
The user identifier, defined by the developer, must ensure uniqueness within the app.
|
||||
</Property>
|
||||
<Property name='files' type='array[object]' key='files'>
|
||||
Uploaded files.
|
||||
- `type` file type: currently only `image` is supported.
|
||||
- `transfer_method` transfer method:
|
||||
- `remote_url`: Image address.
|
||||
- `local_file`: upload file.
|
||||
- `upload_file_id` Upload file ID. Required when `transfer_method` is `local_file`.
|
||||
- `url` image address. Required when `transfer_method` is `remote_url`.
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
@@ -449,6 +458,57 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/files/upload'
|
||||
method='POST'
|
||||
title='Upload files'
|
||||
name='#files-upload'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
Upload files to the server for text generation and dialogue. Uploaded files are only available to the current end user.
|
||||
|
||||
### Request Body
|
||||
The request method is `multipart/form-data`
|
||||
<Properties>
|
||||
<Property name='file' type='file' key='file'>
|
||||
The file to upload. Currently supports png, jpg, jpeg, webp, gif format files.
|
||||
</Property>
|
||||
<Property name='user' type='string' key='user'>
|
||||
User ID, rules are defined by the developer, and it is necessary to ensure that the user ID is unique within the application.
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
|
||||
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif] \\\n--form 'user=abc-123'`}>
|
||||
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \
|
||||
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
|
||||
--form 'file=@"/path/to/file"'
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
|
||||
"name": "example.png",
|
||||
"size": 1024,
|
||||
"extension": "png",
|
||||
"mime_type": "image/png",
|
||||
"created_by": 123,
|
||||
"created_at": 1577836800,
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/audio-to-text'
|
||||
method='POST'
|
||||
@@ -500,7 +560,9 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
Retrieve configured Input parameters, including variable names, field names, types, and default values. Typically used for displaying these fields in a form or filling in default values after the client loads.
|
||||
Content include:
|
||||
1. Retrieve configured Input parameters, including variable names, field names, types, and default values. Typically used for displaying these fields in a form or filling in default values after the client loads.
|
||||
2. Configuration of uploading images, including whether to enable image uploading, the number of uploaded images and the uploading method. Note: This configuration is only available when using a model that supports multimodality.
|
||||
|
||||
### Query
|
||||
|
||||
@@ -525,19 +587,30 @@ For versatile conversational apps using a Q&A format, call the chat-messages API
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"introduction": "nice to meet you",
|
||||
"variables": [
|
||||
"user_input_form": [
|
||||
{
|
||||
"key": "book",
|
||||
"name": "book",
|
||||
"description": null,
|
||||
"type": "string",
|
||||
"default": null,
|
||||
"options": null
|
||||
},
|
||||
"text-input": {
|
||||
"label": "a",
|
||||
"variable": "a",
|
||||
"required": true,
|
||||
"max_length": 48,
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
{
|
||||
// ...
|
||||
}
|
||||
]
|
||||
],
|
||||
"file_upload": {
|
||||
"image": {
|
||||
"enabled": true,
|
||||
"number_limits": 3,
|
||||
"transfer_methods": [
|
||||
"remote_url",
|
||||
"local_file"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -62,6 +62,15 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
<Property name='user' type='string' key='user'>
|
||||
用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
|
||||
</Property>
|
||||
<Property name='files' type='array[object]' key='files'>
|
||||
上传的文件。
|
||||
- `type` 文件类型:目前仅支持 `image`。
|
||||
- `transfer_method` 传递方式:
|
||||
- `remote_url`: 图片地址。
|
||||
- `local_file`: 上传文件。
|
||||
- `upload_file_id` 上传文件 ID。`transfer_method` 为 `local_file` 时必填。
|
||||
- `url` 图片地址。`transfer_method` 为 `remote_url` 时必填。
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
@@ -448,6 +457,57 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/files/upload'
|
||||
method='POST'
|
||||
title='上传文件'
|
||||
name='#files-upload'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
上传文件到服务器,供文本生成、对话使用。上传的文件仅供当前终端用户使用。
|
||||
|
||||
### Request Body
|
||||
请求方式为 `multipart/form-data`。
|
||||
<Properties>
|
||||
<Property name='file' type='file' key='file'>
|
||||
要上传的文件。目前支持 png, jpg, jpeg, webp, gif 格式文件。
|
||||
</Property>
|
||||
<Property name='user' type='string' key='user'>
|
||||
用户标识,由开发者定义规则,需保证用户标识在应用内唯一。
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
|
||||
<CodeGroup title="Request" tag="POST" label="/files/upload" targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \\\n--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \\\n--form 'file=@localfile;type=image/[png|jpeg|jpg|webp|gif] \\\n--form 'user=abc-123'`}>
|
||||
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.appDetail.api_base_url}/files/upload' \
|
||||
--header 'Authorization: Bearer ENTER-YOUR-SECRET-KEY' \
|
||||
--form 'file=@"/path/to/file"'
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "72fa9618-8f89-4a37-9b33-7e1178a24a67",
|
||||
"name": "example.png",
|
||||
"size": 1024,
|
||||
"extension": "png",
|
||||
"mime_type": "image/png",
|
||||
"created_by": 123,
|
||||
"created_at": 1577836800,
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
---
|
||||
|
||||
<Heading
|
||||
url='/audio-to-text'
|
||||
method='POST'
|
||||
@@ -499,7 +559,9 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
获取已配置的 Input 参数,包括变量名、字段名称、类型与默认值。通常用于客户端加载后显示这些字段的表单或填入默认值。
|
||||
内容包括:
|
||||
1. 已配置的 Input 参数,包括变量名、字段名称、类型与默认值。通常用于客户端加载后显示这些字段的表单或填入默认值。
|
||||
2. 上传图片的配置,包括是否开启上传图片,上传图片的数量和上传方式。注意:这个配置只有使用支持多模态的模型时才会生效。
|
||||
|
||||
### Query
|
||||
|
||||
@@ -524,19 +586,30 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"introduction": "nice to meet you",
|
||||
"variables": [
|
||||
"user_input_form": [
|
||||
{
|
||||
"key": "book",
|
||||
"name": "book",
|
||||
"description": null,
|
||||
"type": "string",
|
||||
"default": null,
|
||||
"options": null
|
||||
},
|
||||
"text-input": {
|
||||
"label": "a",
|
||||
"variable": "a",
|
||||
"required": true,
|
||||
"max_length": 48,
|
||||
"default": ""
|
||||
}
|
||||
}
|
||||
{
|
||||
// ...
|
||||
}
|
||||
]
|
||||
],
|
||||
"file_upload": {
|
||||
"image": {
|
||||
"enabled": true,
|
||||
"number_limits": 3,
|
||||
"transfer_methods": [
|
||||
"remote_url",
|
||||
"local_file"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
Reference in New Issue
Block a user