From b072a5a3a7967740f773470d2900b27d7430d875 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Thu, 6 Mar 2025 18:15:40 +0800 Subject: [PATCH] feat: metadata api doc --- .../datasets/template/template.en.mdx | 224 +++++++++++++++- .../datasets/template/template.zh.mdx | 248 ++++++++++++++++++ 2 files changed, 458 insertions(+), 14 deletions(-) diff --git a/web/app/(commonLayout)/datasets/template/template.en.mdx b/web/app/(commonLayout)/datasets/template/template.en.mdx index 6b294cbdd8..5469999d53 100644 --- a/web/app/(commonLayout)/datasets/template/template.en.mdx +++ b/web/app/(commonLayout)/datasets/template/template.en.mdx @@ -1546,12 +1546,12 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi - ### POST + ### Params Knowledge ID @@ -1561,8 +1561,8 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi ### Request Body - - type (string) metadata type, required - - name (string) metadata name, required + - type (string) Metadata type, required + - name (string) Metadata name, required @@ -1571,23 +1571,219 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi title="Request" tag="POST" label="/datasets/{dataset_id}/metadata" - targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{\"segment\": {\"content\": \"1\",\"answer\": \"1\", \"keywords\": [\"a\"], \"enabled\": false}}'`} + targetCode={`curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/metadata' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json'\\\n--data-raw '{"type": "string", "name": "test"}'`} > ```bash {{ title: 'cURL' }} - curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "segment": { - "content": "1", - "answer": "1", - } - }' ``` ```json {{ title: 'Response' }} { - "doc_form": "text_model" + "id": "abc", + "type": "string", + "name": "test", + } + ``` + + + + +
+ + + + + ### Params + + + Knowledge ID + + + Metadata ID + + + + ### Request Body + + + - name (string) Metadata name, required + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + ```json {{ title: 'Response' }} + { + "id": "abc", + "type": "string", + "name": "test", + } + ``` + + + + +
+ + + + + ### Params + + + Knowledge ID + + + Metadata ID + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + + +
+ + + + + ### Params + + + Knowledge ID + + + disable/enable + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + + +
+ + + + + ### Params + + + Knowledge ID + + + + ### Request Body + + + - document_id (string) Document ID + - metadata_list (list) Metadata list + - id (string) Metadata ID + - value (string) Metadata value + - name (string) Metadata name + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + + +
+ + + + + ### Params + + + Knowledge ID + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + ```json {{ title: 'Response' }} + { + "doc_metadata": [ + { + "id": "", + "name": "name", + "type": "string", + "use_count": 0, + }, + ... + ], + "built_in_field_enabled": true } ``` diff --git a/web/app/(commonLayout)/datasets/template/template.zh.mdx b/web/app/(commonLayout)/datasets/template/template.zh.mdx index 0e5857c446..ece1a132d7 100644 --- a/web/app/(commonLayout)/datasets/template/template.zh.mdx +++ b/web/app/(commonLayout)/datasets/template/template.zh.mdx @@ -1547,6 +1547,254 @@ import { Row, Col, Properties, Property, Heading, SubProperty, PropertyInstructi +
+ + + + + ### Params + + + 知识库 ID + + + + ### Request Body + + + - type (string) 元数据类型,必填 + - name (string) 元数据名称,必填 + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + ```json {{ title: 'Response' }} + { + "id": "abc", + "type": "string", + "name": "test", + } + ``` + + + + +
+ + + + + ### Params + + + 知识库 ID + + + 元数据 ID + + + + ### Request Body + + + - name (string) 元数据名称,必填 + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + ```json {{ title: 'Response' }} + { + "id": "abc", + "type": "string", + "name": "test", + } + ``` + + + + +
+ + + + + ### Params + + + 知识库 ID + + + 元数据 ID + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + + +
+ + + + + ### Params + + + 知识库 ID + + + disable/enable + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + + +
+ + + + + ### Params + + + 知识库 ID + + + + ### Request Body + + + - document_id (string) 文档 ID + - metadata_list (list) 元数据列表 + - id (string) 元数据 ID + - type (string) 元数据类型 + - name (string) 元数据名称 + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + + +
+ + + + + ### Query + + + 知识库 ID + + + + + + ```bash {{ title: 'cURL' }} + ``` + + + ```json {{ title: 'Response' }} + { + "doc_metadata": [ + { + "id": "", + "name": "name", + "type": "string", + "use_count": 0, + }, + ... + ], + "built_in_field_enabled": true + } + ``` + + +