Skip to content

Commit d0e17d8

Browse files
feat: add knowledge openapi (#2562)
Co-authored-by: yanwencheng <416970882@qq.com>
1 parent 266888f commit d0e17d8

File tree

17 files changed

+14068
-5420
lines changed

17 files changed

+14068
-5420
lines changed

backend/api/handler/coze/knowledge_service.go

Lines changed: 199 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/api/middleware/openapi_auth.go

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,27 @@ import (
3838
const HeaderAuthorizationKey = "Authorization"
3939

4040
var needAuthPath = map[string]bool{
41-
"/v3/chat": true,
42-
"/v1/conversations": true,
43-
"/v1/conversation/create": true,
44-
"/v1/conversation/message/list": true,
45-
"/v1/files/upload": true,
46-
"/v1/workflow/run": true,
47-
"/v1/workflow/stream_run": true,
48-
"/v1/workflow/stream_resume": true,
49-
"/v1/workflow/get_run_history": true,
50-
"/v1/bot/get_online_info": true,
51-
"/v1/workflows/chat": true,
52-
"/v1/workflow/conversation/create": true,
53-
"/v3/chat/cancel": true,
54-
"/v1/conversation/retrieve": true,
55-
"/v3/chat/retrieve": true,
56-
"/v3/chat/message/list": true,
41+
"/v3/chat": true,
42+
"/v1/conversations": true,
43+
"/v1/conversation/create": true,
44+
"/v1/conversation/message/list": true,
45+
"/v1/files/upload": true,
46+
"/v1/workflow/run": true,
47+
"/v1/workflow/stream_run": true,
48+
"/v1/workflow/stream_resume": true,
49+
"/v1/workflow/get_run_history": true,
50+
"/v1/bot/get_online_info": true,
51+
"/v1/workflows/chat": true,
52+
"/v1/workflow/conversation/create": true,
53+
"/v3/chat/cancel": true,
54+
"/v1/conversation/retrieve": true,
55+
"/v3/chat/retrieve": true,
56+
"/v3/chat/message/list": true,
57+
"/open_api/knowledge/document/delete": true,
58+
"/open_api/knowledge/document/create": true,
59+
"/open_api/knowledge/document/update": true,
60+
"/open_api/knowledge/document/list": true,
61+
"/v1/datasets": true,
5762
}
5863

5964
var needAuthFunc = map[string]bool{
@@ -63,6 +68,10 @@ var needAuthFunc = map[string]bool{
6368

6469
"^/v1/workflows/[0-9]+$": true,
6570
"^/v1/apps/[0-9]+$": true,
71+
72+
"^/v1/datasets/[0-9]+$": true, // v1/datasets/:dataset_id
73+
"^/v1/datasets/[0-9]+/images$": true, // v1/datasets/:dataset_id/images
74+
"^/v1/datasets/[0-9]+/process$": true, // v1/datasets/:dataset_id/process
6675
}
6776

6877
func parseBearerAuthToken(authHeader string) string {

0 commit comments

Comments
 (0)