From e5bdc1438a9786e3491ecd7f3becd3190670a654 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC=E5=93=A5?=
<62788572+safejob@users.noreply.github.com>
Date: Sun, 27 Apr 2025 16:13:36 +0800
Subject: [PATCH] fix: annotation update need use http put method and
annotation-reply api doc parms wrong (#18891)
---
api/controllers/service_api/app/annotation.py | 2 +-
.../develop/template/template.zh.mdx | 32 ++++++++-----------
.../template/template_advanced_chat.en.mdx | 32 ++++++++-----------
.../template/template_advanced_chat.zh.mdx | 32 ++++++++-----------
4 files changed, 43 insertions(+), 55 deletions(-)
diff --git a/api/controllers/service_api/app/annotation.py b/api/controllers/service_api/app/annotation.py
index 522a96b791..c50f551faf 100644
--- a/api/controllers/service_api/app/annotation.py
+++ b/api/controllers/service_api/app/annotation.py
@@ -79,7 +79,7 @@ class AnnotationListApi(Resource):
class AnnotationUpdateDeleteApi(Resource):
@validate_app_token(fetch_user_arg=FetchUserArg(fetch_from=WhereisUserArg.JSON))
@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:
raise Forbidden()
diff --git a/web/app/components/develop/template/template.zh.mdx b/web/app/components/develop/template/template.zh.mdx
index 24abb481e3..447dc08396 100755
--- a/web/app/components/develop/template/template.zh.mdx
+++ b/web/app/components/develop/template/template.zh.mdx
@@ -643,13 +643,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
```json {{ title: 'Response' }}
{
- {
- "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
- "question": "What is your name?",
- "answer": "I am Dify.",
- "hit_count": 0,
- "created_at": 1735625869
- }
+ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
+ "question": "What is your name?",
+ "answer": "I am Dify.",
+ "hit_count": 0,
+ "created_at": 1735625869
}
```
@@ -683,10 +681,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
title="Request"
tag="PUT"
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' }}
- 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 'Content-Type: application/json' \
--data-raw '{
@@ -699,13 +697,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
```json {{ title: 'Response' }}
{
- {
- "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
- "question": "What is your name?",
- "answer": "I am Dify.",
- "hit_count": 0,
- "created_at": 1735625869
- }
+ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
+ "question": "What is your name?",
+ "answer": "I am Dify.",
+ "hit_count": 0,
+ "created_at": 1735625869
}
```
@@ -763,10 +759,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
动作,只能是 'enable' 或 'disable'
-
+
指定的嵌入模型提供商, 必须先在系统内设定好接入的模型,对应的是provider字段
-
+
指定的嵌入模型,对应的是model字段
diff --git a/web/app/components/develop/template/template_advanced_chat.en.mdx b/web/app/components/develop/template/template_advanced_chat.en.mdx
index f645133030..0d10af6a71 100644
--- a/web/app/components/develop/template/template_advanced_chat.en.mdx
+++ b/web/app/components/develop/template/template_advanced_chat.en.mdx
@@ -1337,13 +1337,11 @@ Chat applications support session persistence, allowing previous chat history to
```json {{ title: 'Response' }}
{
- {
- "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
- "question": "What is your name?",
- "answer": "I am Dify.",
- "hit_count": 0,
- "created_at": 1735625869
- }
+ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
+ "question": "What is your name?",
+ "answer": "I am Dify.",
+ "hit_count": 0,
+ "created_at": 1735625869
}
```
@@ -1377,10 +1375,10 @@ Chat applications support session persistence, allowing previous chat history to
title="Request"
tag="PUT"
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' }}
- 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 'Content-Type: application/json' \
--data-raw '{
@@ -1393,13 +1391,11 @@ Chat applications support session persistence, allowing previous chat history to
```json {{ title: 'Response' }}
{
- {
- "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
- "question": "What is your name?",
- "answer": "I am Dify.",
- "hit_count": 0,
- "created_at": 1735625869
- }
+ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
+ "question": "What is your name?",
+ "answer": "I am Dify.",
+ "hit_count": 0,
+ "created_at": 1735625869
}
```
@@ -1457,10 +1453,10 @@ Chat applications support session persistence, allowing previous chat history to
Action, can only be 'enable' or 'disable'
-
+
Specified embedding model provider, must be set up in the system first, corresponding to the provider field(Optional)
-
+
Specified embedding model, corresponding to the model field(Optional)
diff --git a/web/app/components/develop/template/template_advanced_chat.zh.mdx b/web/app/components/develop/template/template_advanced_chat.zh.mdx
index 240044a25d..e634130a4b 100755
--- a/web/app/components/develop/template/template_advanced_chat.zh.mdx
+++ b/web/app/components/develop/template/template_advanced_chat.zh.mdx
@@ -1361,13 +1361,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
```json {{ title: 'Response' }}
{
- {
- "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
- "question": "What is your name?",
- "answer": "I am Dify.",
- "hit_count": 0,
- "created_at": 1735625869
- }
+ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
+ "question": "What is your name?",
+ "answer": "I am Dify.",
+ "hit_count": 0,
+ "created_at": 1735625869
}
```
@@ -1401,10 +1399,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
title="Request"
tag="PUT"
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' }}
- 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 'Content-Type: application/json' \
--data-raw '{
@@ -1417,13 +1415,11 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
```json {{ title: 'Response' }}
{
- {
- "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
- "question": "What is your name?",
- "answer": "I am Dify.",
- "hit_count": 0,
- "created_at": 1735625869
- }
+ "id": "69d48372-ad81-4c75-9c46-2ce197b4d402",
+ "question": "What is your name?",
+ "answer": "I am Dify.",
+ "hit_count": 0,
+ "created_at": 1735625869
}
```
@@ -1481,10 +1477,10 @@ import { Row, Col, Properties, Property, Heading, SubProperty } from '../md.tsx'
动作,只能是 'enable' 或 'disable'
-
+
指定的嵌入模型提供商, 必须先在系统内设定好接入的模型,对应的是provider字段
-
+
指定的嵌入模型,对应的是model字段