mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-31 02:42:59 +00:00 
			
		
		
		
	fix: knowledge api doc (#2174)
This commit is contained in:
		
							parent
							
								
									784da52ea6
								
							
						
					
					
						commit
						2fe938b7da
					
				| @ -144,23 +144,18 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from | |||||||
| 
 | 
 | ||||||
|     ### Request Body |     ### Request Body | ||||||
|     <Properties> |     <Properties> | ||||||
|       <Property name='original_document_id' type='string' key='original_document_id'> |       <Property name='data' type='multipart/form-data json string' key='data'> | ||||||
|         Source document ID (optional) |         - original_document_id Source document ID (optional) | ||||||
|           - Used to re-upload the document or modify the document cleaning and segmentation configuration. The missing information is copied from the source document |           - Used to re-upload the document or modify the document cleaning and segmentation configuration. The missing information is copied from the source document | ||||||
|           - The source document cannot be an archived document |           - The source document cannot be an archived document | ||||||
|           - When original_document_id is passed in, the update operation is performed on behalf of the document. process_rule is a fillable item. If not filled in, the segmentation method of the source document will be used by defaul |           - When original_document_id is passed in, the update operation is performed on behalf of the document. process_rule is a fillable item. If not filled in, the segmentation method of the source document will be used by defaul | ||||||
|           - When original_document_id is not passed in, the new operation is performed on behalf of the document, and process_rule is required |           - When original_document_id is not passed in, the new operation is performed on behalf of the document, and process_rule is required | ||||||
|       </Property> | 
 | ||||||
|       <Property name='file' type='multipart/form-data' key='file'> |         - indexing_technique Index mode | ||||||
|         Files that need to be uploaded. |  | ||||||
|       </Property> |  | ||||||
|       <Property name='indexing_technique' type='string' key='indexing_technique'> |  | ||||||
|         Index mode |  | ||||||
|           - <code>high_quality</code> High quality: embedding using embedding model, built as vector database index |           - <code>high_quality</code> High quality: embedding using embedding model, built as vector database index | ||||||
|           - <code>economy</code> Economy: Build using inverted index of Keyword Table Index |           - <code>economy</code> Economy: Build using inverted index of Keyword Table Index | ||||||
|       </Property> | 
 | ||||||
|       <Property name='process_rule' type='object' key='process_rule'> |         - process_rule Processing rules | ||||||
|         Processing rules |  | ||||||
|           - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom |           - <code>mode</code> (string) Cleaning, segmentation mode, automatic / custom | ||||||
|           - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty) |           - <code>rules</code> (object) Custom rules (in automatic mode, this field is empty) | ||||||
|             - <code>pre_processing_rules</code> (array[object]) Preprocessing rules |             - <code>pre_processing_rules</code> (array[object]) Preprocessing rules | ||||||
| @ -173,6 +168,9 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from | |||||||
|               - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n |               - <code>separator</code> Custom segment identifier, currently only allows one delimiter to be set. Default is \n | ||||||
|               - <code>max_tokens</code> Maximum length (token) defaults to 1000 |               - <code>max_tokens</code> Maximum length (token) defaults to 1000 | ||||||
|       </Property> |       </Property> | ||||||
|  |       <Property name='file' type='multipart/form-data' key='file'> | ||||||
|  |         Files that need to be uploaded. | ||||||
|  |       </Property> | ||||||
|     </Properties> |     </Properties> | ||||||
|   </Col> |   </Col> | ||||||
|   <Col sticky> |   <Col sticky> | ||||||
| @ -180,7 +178,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from | |||||||
|       title="Request" |       title="Request" | ||||||
|       tag="POST" |       tag="POST" | ||||||
|       label="/datasets/{dataset_id}/document/create_by_file" |       label="/datasets/{dataset_id}/document/create_by_file" | ||||||
|       targetCode={`curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`} |       targetCode={`curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`} | ||||||
|     > |     > | ||||||
|     ```bash {{ title: 'cURL' }} |     ```bash {{ title: 'cURL' }} | ||||||
|     curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \ |     curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \ | ||||||
|  | |||||||
| @ -142,25 +142,20 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from | |||||||
|       </Property> |       </Property> | ||||||
|     </Properties> |     </Properties> | ||||||
| 
 | 
 | ||||||
|     ### Request Body |     ### Request Bodys | ||||||
|     <Properties> |     <Properties> | ||||||
|       <Property name='original_document_id' type='string' key='original_document_id'> |       <Property name='data' type='multipart/form-data json string' key='data'> | ||||||
|         源文档 ID (选填) |         - original_document_id 源文档 ID (选填) | ||||||
|           - 用于重新上传文档或修改文档清洗、分段配置,缺失的信息从源文档复制 |           - 用于重新上传文档或修改文档清洗、分段配置,缺失的信息从源文档复制 | ||||||
|           - 源文档不可为归档的文档 |           - 源文档不可为归档的文档 | ||||||
|           - 当传入 <code>original_document_id</code> 时,代表文档进行更新操作,<code>process_rule</code> 为可填项目,不填默认使用源文档的分段方式 |           - 当传入 <code>original_document_id</code> 时,代表文档进行更新操作,<code>process_rule</code> 为可填项目,不填默认使用源文档的分段方式 | ||||||
|           - 未传入 <code>original_document_id</code> 时,代表文档进行新增操作,<code>process_rule</code> 为必填 |           - 未传入 <code>original_document_id</code> 时,代表文档进行新增操作,<code>process_rule</code> 为必填 | ||||||
|       </Property> | 
 | ||||||
|       <Property name='file' type='multipart/form-data' key='file'> |         - indexing_technique 索引方式 | ||||||
|         需要上传的文件。 |  | ||||||
|       </Property> |  | ||||||
|       <Property name='indexing_technique' type='string' key='indexing_technique'> |  | ||||||
|         索引方式 |  | ||||||
|           - <code>high_quality</code> 高质量:使用  embedding 模型进行嵌入,构建为向量数据库索引 |           - <code>high_quality</code> 高质量:使用  embedding 模型进行嵌入,构建为向量数据库索引 | ||||||
|           - <code>economy</code> 经济:使用 Keyword Table Index 的倒排索引进行构建 |           - <code>economy</code> 经济:使用 Keyword Table Index 的倒排索引进行构建 | ||||||
|       </Property> | 
 | ||||||
|       <Property name='process_rule' type='object' key='process_rule'> |         - process_rule 处理规则 | ||||||
|         处理规则 |  | ||||||
|           - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 |           - <code>mode</code> (string) 清洗、分段模式 ,automatic 自动 / custom 自定义 | ||||||
|           - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空) |           - <code>rules</code> (object) 自定义规则(自动模式下,该字段为空) | ||||||
|             - <code>pre_processing_rules</code> (array[object]) 预处理规则 |             - <code>pre_processing_rules</code> (array[object]) 预处理规则 | ||||||
| @ -173,6 +168,9 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from | |||||||
|               - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n |               - <code>separator</code> 自定义分段标识符,目前仅允许设置一个分隔符。默认为 \n | ||||||
|               - <code>max_tokens</code> 最大长度 (token) 默认为 1000 |               - <code>max_tokens</code> 最大长度 (token) 默认为 1000 | ||||||
|       </Property> |       </Property> | ||||||
|  |       <Property name='file' type='multipart/form-data' key='file'> | ||||||
|  |         需要上传的文件。 | ||||||
|  |       </Property> | ||||||
|     </Properties> |     </Properties> | ||||||
|   </Col> |   </Col> | ||||||
|   <Col sticky> |   <Col sticky> | ||||||
| @ -180,7 +178,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from | |||||||
|       title="Request" |       title="Request" | ||||||
|       tag="POST" |       tag="POST" | ||||||
|       label="/datasets/{dataset_id}/document/create_by_file" |       label="/datasets/{dataset_id}/document/create_by_file" | ||||||
|       targetCode={`curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"name":"Dify","indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`} |       targetCode={`curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \\\n--header 'Authorization: Bearer {api_key}' \\\n--form 'data="{"indexing_technique":"high_quality","process_rule":{"rules":{"pre_processing_rules":[{"id":"remove_extra_spaces","enabled":true},{"id":"remove_urls_emails","enabled":true}],"segmentation":{"separator":"###","max_tokens":500}},"mode":"custom"}}";type=text/plain' \\\n--form 'file=@"/path/to/file"'`} | ||||||
|     > |     > | ||||||
|     ```bash {{ title: 'cURL' }} |     ```bash {{ title: 'cURL' }} | ||||||
|     curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \ |     curl --location POST '${props.apiBaseUrl}/datasets/{dataset_id}/document/create_by_file' \ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zxhlyh
						zxhlyh