mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: Upgrade duckduckgo-search to version 5.1.0 & update document segment api parameter error (#2938)
This commit is contained in:
parent
cc754122fc
commit
c7d003d551
|
@ -197,11 +197,11 @@ class DatasetSegmentApi(DatasetApiResource):
|
|||
|
||||
# validate args
|
||||
parser = reqparse.RequestParser()
|
||||
parser.add_argument('segments', type=dict, required=False, nullable=True, location='json')
|
||||
parser.add_argument('segment', type=dict, required=False, nullable=True, location='json')
|
||||
args = parser.parse_args()
|
||||
|
||||
SegmentService.segment_create_args_validate(args, document)
|
||||
segment = SegmentService.update_segment(args, segment, document, dataset)
|
||||
SegmentService.segment_create_args_validate(args['segment'], document)
|
||||
segment = SegmentService.update_segment(args['segment'], segment, document, dataset)
|
||||
return {
|
||||
'data': marshal(segment, segment_fields),
|
||||
'doc_form': document.doc_form
|
||||
|
|
|
@ -67,7 +67,7 @@ yfinance~=0.2.35
|
|||
pydub~=0.25.1
|
||||
gmpy2~=2.1.5
|
||||
numexpr~=2.9.0
|
||||
duckduckgo-search==4.4.3
|
||||
duckduckgo-search==5.1.0
|
||||
arxiv==2.1.0
|
||||
yarl~=1.9.4
|
||||
twilio==9.0.0
|
||||
|
|
|
@ -935,7 +935,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
|
|||
|
||||
### Request Body
|
||||
<Properties>
|
||||
<Property name='segments' type='object list' key='segments'>
|
||||
<Property name='segment' type='object list' key='segment'>
|
||||
- <code>content</code> (text) text content/question content,required
|
||||
- <code>answer</code> (text) Answer content, not required, passed if the Knowledge is in qa mode
|
||||
- <code>keywords</code> (list) keyword, not required
|
||||
|
@ -948,13 +948,13 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
|
|||
title="Request"
|
||||
tag="POST"
|
||||
label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
|
||||
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 '{\"segments\": {\"content\": \"1\",\"answer\": \"1\", \"keywords\": [\"a\"], \"enabled\": false}}'`}
|
||||
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}}'`}
|
||||
>
|
||||
```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 '{
|
||||
"segments": {
|
||||
"segment": {
|
||||
"content": "1",
|
||||
"answer": "1",
|
||||
"keywords": ["a"],
|
||||
|
|
|
@ -935,7 +935,7 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
|
|||
|
||||
### Request Body
|
||||
<Properties>
|
||||
<Property name='segments' type='object list' key='segments'>
|
||||
<Property name='segment' type='object list' key='segment'>
|
||||
- <code>content</code> (text) 文本内容/问题内容,必填
|
||||
- <code>answer</code> (text) 答案内容,非必填,如果知识库的模式为qa模式则传值
|
||||
- <code>keywords</code> (list) 关键字,非必填
|
||||
|
@ -948,14 +948,14 @@ import { Row, Col, Properties, Property, Heading, SubProperty, Paragraph } from
|
|||
title="Request"
|
||||
tag="POST"
|
||||
label="/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}"
|
||||
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 '{\"segments\": {\"content\": \"1\",\"answer\": \"1\", \"keywords\": [\"a\"], \"enabled\": false}}'`}
|
||||
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}}'`}
|
||||
>
|
||||
```bash {{ title: 'cURL' }}
|
||||
curl --location --request POST '${props.apiBaseUrl}/datasets/{dataset_id}/documents/{document_id}/segments/{segment_id}' \
|
||||
--header 'Authorization: Bearer {api_key}' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data-raw '{
|
||||
"segments": {
|
||||
"segment": {
|
||||
"content": "1",
|
||||
"answer": "1",
|
||||
"keywords": ["a"],
|
||||
|
|
Loading…
Reference in New Issue
Block a user