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