fix: annotation update need use http put method and annotation-reply api doc parms wrong (#18891)

This commit is contained in:
小马哥 2025-04-27 16:13:36 +08:00 committed by GitHub
parent e3daef19e7
commit e5bdc1438a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 43 additions and 55 deletions

View File

@ -79,7 +79,7 @@ class AnnotationListApi(Resource):
class AnnotationUpdateDeleteApi(Resource): class AnnotationUpdateDeleteApi(Resource):
@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON)) @validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON))
@marshal_with(annotation_fields) @marshal_with(annotation_fields)
def post(self, app_model: App, end_user: EndUser, annotation_id): def put(self, app_model: App, end_user: EndUser, annotation_id):
if not current_user.is_editor: if not current_user.is_editor:
raise Forbidden() raise Forbidden()

View File

@ -643,13 +643,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
{ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
"id": "69d48372-ad81-4c75-9c46-2ce197b4d402", "question": "What is your name?",
"question": "What is your name?", "answer": "I am Dify.",
"answer": "I am Dify.", "hit_count": 0,
"hit_count": 0, "created_at": 1735625869
"created_at": 1735625869
}
} }
``` ```
</CodeGroup> </CodeGroup>
@ -683,10 +681,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`}
> >
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_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 '{
@ -699,13 +697,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
{ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
"id": "69d48372-ad81-4c75-9c46-2ce197b4d402", "question": "What is your name?",
"question": "What is your name?", "answer": "I am Dify.",
"answer": "I am Dify.", "hit_count": 0,
"hit_count": 0, "created_at": 1735625869
"created_at": 1735625869
}
} }
``` ```
</CodeGroup> </CodeGroup>
@ -763,10 +759,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<Property name='action' type='string' key='action'> <Property name='action' type='string' key='action'>
动作,只能是 'enable' 或 'disable' 动作,只能是 'enable' 或 'disable'
</Property> </Property>
<Property name='embedding_model_provider' type='string' key='embedding_model_provider'> <Property name='embedding_provider_name' type='string' key='embedding_provider_name'>
指定的嵌入模型提供商, 必须先在系统内设定好接入的模型对应的是provider字段 指定的嵌入模型提供商, 必须先在系统内设定好接入的模型对应的是provider字段
</Property> </Property>
<Property name='embedding_model' type='string' key='embedding_model'> <Property name='embedding_model_name' type='string' key='embedding_model_name'>
指定的嵌入模型对应的是model字段 指定的嵌入模型对应的是model字段
</Property> </Property>
<Property name='score_threshold' type='number' key='score_threshold'> <Property name='score_threshold' type='number' key='score_threshold'>

View File

@ -1337,13 +1337,11 @@ Chat applications support session persistence, allowing previous chat history to
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
{ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
"id": "69d48372-ad81-4c75-9c46-2ce197b4d402", "question": "What is your name?",
"question": "What is your name?", "answer": "I am Dify.",
"answer": "I am Dify.", "hit_count": 0,
"hit_count": 0, "created_at": 1735625869
"created_at": 1735625869
}
} }
``` ```
</CodeGroup> </CodeGroup>
@ -1377,10 +1375,10 @@ Chat applications support session persistence, allowing previous chat history to
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request POST '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`}
> >
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST '${props.apiBaseUrl}/apps/annotations/{annotation_id}' \ curl --location --request PUT '${props.apiBaseUrl}/apps/annotations/{annotation_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 '{
@ -1393,13 +1391,11 @@ Chat applications support session persistence, allowing previous chat history to
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
{ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
"id": "69d48372-ad81-4c75-9c46-2ce197b4d402", "question": "What is your name?",
"question": "What is your name?", "answer": "I am Dify.",
"answer": "I am Dify.", "hit_count": 0,
"hit_count": 0, "created_at": 1735625869
"created_at": 1735625869
}
} }
``` ```
</CodeGroup> </CodeGroup>
@ -1457,10 +1453,10 @@ Chat applications support session persistence, allowing previous chat history to
<Property name='action' type='string' key='action'> <Property name='action' type='string' key='action'>
Action, can only be 'enable' or 'disable' Action, can only be 'enable' or 'disable'
</Property> </Property>
<Property name='embedding_model_provider' type='string' key='embedding_model_provider'> <Property name='embedding_provider_name' type='string' key='embedding_provider_name'>
Specified embedding model provider, must be set up in the system first, corresponding to the provider field(Optional) Specified embedding model provider, must be set up in the system first, corresponding to the provider field(Optional)
</Property> </Property>
<Property name='embedding_model' type='string' key='embedding_model'> <Property name='embedding_model_name' type='string' key='embedding_model_name'>
Specified embedding model, corresponding to the model field(Optional) Specified embedding model, corresponding to the model field(Optional)
</Property> </Property>
<Property name='score_threshold' type='number' key='score_threshold'> <Property name='score_threshold' type='number' key='score_threshold'>

View File

@ -1361,13 +1361,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
{ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
"id": "69d48372-ad81-4c75-9c46-2ce197b4d402", "question": "What is your name?",
"question": "What is your name?", "answer": "I am Dify.",
"answer": "I am Dify.", "hit_count": 0,
"hit_count": 0, "created_at": 1735625869
"created_at": 1735625869
}
} }
``` ```
</CodeGroup> </CodeGroup>
@ -1401,10 +1399,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
title="Request" title="Request"
tag="PUT" tag="PUT"
label="/apps/annotations/{annotation_id}" label="/apps/annotations/{annotation_id}"
targetCode={`curl --location --request POST '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`} targetCode={`curl --location --request PUT '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \\\n--header 'Authorization: Bearer {api_key}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"question": "What is your name?","answer": "I am Dify."}'`}
> >
```bash {{ title: 'cURL' }} ```bash {{ title: 'cURL' }}
curl --location --request POST '${props.appDetail.api_base_url}/apps/annotations/{annotation_id}' \ curl --location --request PUT '${props.appDetail.api_base_url}/apps/annotations/{annotation_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 '{
@ -1417,13 +1415,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<CodeGroup title="Response"> <CodeGroup title="Response">
```json {{ title: 'Response' }} ```json {{ title: 'Response' }}
{ {
{ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
"id": "69d48372-ad81-4c75-9c46-2ce197b4d402", "question": "What is your name?",
"question": "What is your name?", "answer": "I am Dify.",
"answer": "I am Dify.", "hit_count": 0,
"hit_count": 0, "created_at": 1735625869
"created_at": 1735625869
}
} }
``` ```
</CodeGroup> </CodeGroup>
@ -1481,10 +1477,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
<Property name='action' type='string' key='action'> <Property name='action' type='string' key='action'>
动作,只能是 'enable' 或 'disable' 动作,只能是 'enable' 或 'disable'
</Property> </Property>
<Property name='embedding_model_provider' type='string' key='embedding_model_provider'> <Property name='embedding_provider_name' type='string' key='embedding_provider_name'>
指定的嵌入模型提供商, 必须先在系统内设定好接入的模型对应的是provider字段 指定的嵌入模型提供商, 必须先在系统内设定好接入的模型对应的是provider字段
</Property> </Property>
<Property name='embedding_model' type='string' key='embedding_model'> <Property name='embedding_model_name' type='string' key='embedding_model_name'>
指定的嵌入模型对应的是model字段 指定的嵌入模型对应的是model字段
</Property> </Property>
<Property name='score_threshold' type='number' key='score_threshold'> <Property name='score_threshold' type='number' key='score_threshold'>