dataset.api
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
syntax = "v1"
// 后台接口
@server(
prefix: v1
group: dataset
middleware: LogRequest
jwt: SystemAuth
)
service Core {
@doc "知识库-详情"
@handler chatDatasetGet
get /chat/dataset/:id (ChatDatasetGetRequest) returns (ChatDatasetGetResponse)
@doc "知识库-保存"
@handler chatDatasetSave
post /chat/dataset (ChatDatasetSaveRequest) returns (ChatDatasetSaveResponse)
@doc "知识库-删除"
@handler chatDatasetDelete
delete /chat/dataset/:id (ChatDatasetDeleteRequest) returns (ChatDatasetDeleteResponse)
@doc "知识库-更新"
@handler chatDatasetUpdate
put /chat/dataset/:id (ChatDatasetUpdateRequest) returns (ChatDatasetUpdateResponse)
@doc "知识库-重命名"
@handler chatDatasetRename
post /chat/dataset/rename (ChatDatasetRenameRequest) returns (ChatDatasetRenameResponse)
@doc "知识库-搜索"
@handler chatDatasetSearch
post /chat/dataset/search (ChatDatasetSearchRequest) returns (ChatDatasetSearchResponse)
@doc "知识库-添加文件"
@handler chatDatasetAddFiles
post /chat/dataset/add_files (ChatDatasetAddFilesRequest) returns (ChatDatasetAddFilesResponse)
@doc "知识库-移除文件"
@handler chatDatasetRemvoeFiles
post /chat/dataset/remove_files (ChatDatasetAddFilesRequest) returns (ChatDatasetAddFilesResponse)
}
type (
ChatDatasetGetRequest {
Id int64 `path:"id"`
}
ChatDatasetGetResponse {
ChatDataset ChatDatasetItem `json:"dataset"`
Documents []ChatDocumentItem `json:"documents"`
}
ChatDatasetSaveRequest {
Name string `json:"name"` // 名称
DocumentIds []int64 `json:"documentIds"` // 文档ID列表
}
ChatDatasetSaveResponse {
ChatDataset ChatDatasetItem `json:"dataset"`
}
ChatDatasetDeleteRequest {
Id int64 `path:"id"`
}
ChatDatasetDeleteResponse {}
ChatDatasetUpdateRequest {
Id int64 `path:"id"`
ChatDataset ChatDatasetItem `json:"dataset"`
}
ChatDatasetUpdateResponse {}
ChatDatasetSearchRequest {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Name string `json:"name,optional"` // 文件名匹配
Status int `json:"status,optional,option=0|1|2"`// 1:启用 2:禁用
}
ChatDatasetSearchResponse{
List []ChatDatasetItem `json:"list"`
Total int64 `json:"total"`
}
ChatDatasetItem {
Id int64 `json:"id,optional,omitempty"`
Name *string `json:"name,optional,omitempty"` // 名称
Desc *string `json:"desc,optional,omitempty"` // 描述
Status *int `json:"status,optional,omitempty"`// 状态 1:启用 2:禁用
CreatedAt int64 `json:"createdAt,optional,omitempty"` // 创建时间
UpdatedAt int64 `json:"updatedAt,optional,omitempty"` // 更新时间
FileNumber *int `json:"fileNumber,optional,omitempty"` // 文件数量
}
)
// 知识库重命名
type(
ChatDatasetRenameRequest{
Id int64 `json:"id"` // 文档ID
Name string `json:"name"` // 新名称
}
ChatDatasetRenameResponse{
ChatDataset ChatDatasetItem `json:"dataset"`
}
)
// 知识库添加新文档
type(
ChatDatasetAddFilesRequest{
Id int64 `json:"id"` // 文档ID
DocumentIds []int64 `json:"documentIds"` // 文档ID列表
}
ChatDatasetAddFilesResponse{
}
)