Add APIs for Knowledge Base Tag Management and Dataset Binding (#20023)
Co-authored-by: lizb <lizb@sugon.com>
This commit is contained in:
@@ -2349,6 +2349,316 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
Okay, I will translate the Chinese text in your document while keeping all formatting and code content unchanged.
|
||||
|
||||
<Heading
|
||||
url='/datasets/tags'
|
||||
method='POST'
|
||||
title='Create New Knowledge Base Type Tag'
|
||||
name='#create_new_knowledge_tag'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Request Body
|
||||
<Properties>
|
||||
<Property name='name' type='string'>
|
||||
(text) New tag name, required, maximum length 50
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="POST"
|
||||
label="/datasets/tags"
|
||||
targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag1"}'`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.apiBaseUrl}/datasets/tags' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{"name": "testtag1"}'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
|
||||
"name": "testtag1",
|
||||
"type": "knowledge",
|
||||
"binding_count": 0
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/tags'
|
||||
method='GET'
|
||||
title='Get Knowledge Base Type Tags'
|
||||
name='#get_knowledge_type_tags'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Request Body
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="GET"
|
||||
label="/datasets/tags"
|
||||
targetCode={`curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request GET '${props.apiBaseUrl}/datasets/tags' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
[
|
||||
{
|
||||
"id": "39d6934c-ed36-463d-b4a7-377fa1503dc0",
|
||||
"name": "testtag1",
|
||||
"type": "knowledge",
|
||||
"binding_count": "0"
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/tags'
|
||||
method='PATCH'
|
||||
title='Modify Knowledge Base Type Tag Name'
|
||||
name='#modify_knowledge_tag_name'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Request Body
|
||||
<Properties>
|
||||
<Property name='name' type='string'>
|
||||
(text) Modified tag name, required, maximum length 50
|
||||
</Property>
|
||||
<Property name='tag_id' type='string'>
|
||||
(text) Tag ID, required
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="PATCH"
|
||||
label="/datasets/tags"
|
||||
targetCode={`curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request PATCH '${props.apiBaseUrl}/datasets/tags' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{"name": "testtag2", "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"id": "eddb66c2-04a1-4e3a-8cb2-75abd01e12a6",
|
||||
"name": "tag-renamed",
|
||||
"type": "knowledge",
|
||||
"binding_count": 0
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
|
||||
<Heading
|
||||
url='/datasets/tags'
|
||||
method='DELETE'
|
||||
title='Delete Knowledge Base Type Tag'
|
||||
name='#delete_knowledge_tag'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Request Body
|
||||
<Properties>
|
||||
<Property name='tag_id' type='string'>
|
||||
(text) Tag ID, required
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="DELETE"
|
||||
label="/datasets/tags"
|
||||
targetCode={`curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{ "tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request DELETE '${props.apiBaseUrl}/datasets/tags' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{"tag_id": "e1a0a3db-ee34-4e04-842a-81555d5316fd"}'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
|
||||
{"result": "success"}
|
||||
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/tags/binding'
|
||||
method='POST'
|
||||
title='Bind Dataset to Knowledge Base Type Tag'
|
||||
name='#bind_dataset_to_knowledge_tag'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Request Body
|
||||
<Properties>
|
||||
<Property name='tag_ids' type='list'>
|
||||
(list) List of Tag IDs, required
|
||||
</Property>
|
||||
<Property name='target_id' type='string'>
|
||||
(text) Dataset ID, required
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="POST"
|
||||
label="/datasets/tags/binding"
|
||||
targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.apiBaseUrl}/datasets/tags/binding' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{"tag_ids": ["65cc29be-d072-4e26-adf4-2f727644da29","1e5348f3-d3ff-42b8-a1b7-0a86d518001a"], "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{"result": "success"}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/tags/unbinding'
|
||||
method='POST'
|
||||
title='Unbind Dataset and Knowledge Base Type Tag'
|
||||
name='#unbind_dataset_and_knowledge_tag'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Request Body
|
||||
<Properties>
|
||||
<Property name='tag_id' type='string'>
|
||||
(text) Tag ID, required
|
||||
</Property>
|
||||
<Property name='target_id' type='string'>
|
||||
(text) Dataset ID, required
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="POST"
|
||||
label="/datasets/tags/unbinding"
|
||||
targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.apiBaseUrl}/datasets/tags/unbinding' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{"tag_id": "1e5348f3-d3ff-42b8-a1b7-0a86d518001a", "target_id": "a932ea9f-fae1-4b2c-9b65-71c56e2cacd6"}'
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{"result": "success"}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
<Heading
|
||||
url='/datasets/<uuid:dataset_id>/tags'
|
||||
method='POST'
|
||||
title='Query Tags Bound to a Dataset'
|
||||
name='#query_dataset_tags'
|
||||
/>
|
||||
<Row>
|
||||
<Col>
|
||||
### Path
|
||||
<Properties>
|
||||
<Property name='dataset_id' type='string'>
|
||||
(text) Dataset ID
|
||||
</Property>
|
||||
</Properties>
|
||||
</Col>
|
||||
<Col sticky>
|
||||
<CodeGroup
|
||||
title="Request"
|
||||
tag="POST"
|
||||
label="/datasets/<uuid:dataset_id>/tags"
|
||||
targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.apiBaseUrl}/datasets/<uuid:dataset_id>/tags' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
```
|
||||
</CodeGroup>
|
||||
<CodeGroup title="Response">
|
||||
```json {{ title: 'Response' }}
|
||||
{
|
||||
"data":
|
||||
[
|
||||
{"id": "4a601f4f-f8a2-4166-ae7c-58c3b252a524",
|
||||
"name": "123"
|
||||
},
|
||||
...
|
||||
],
|
||||
"total": 3
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
<hr className='ml-0 mr-0' />
|
||||
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
|
||||
Reference in New Issue
Block a user