intellif-aihub 0.1.16__py3-none-any.whl → 0.1.18__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of intellif-aihub might be problematic. Click here for more details.
- aihub/__init__.py +1 -1
- aihub/client.py +1 -1
- aihub/models/task_center.py +33 -5
- aihub/models/user_system.py +40 -1
- aihub/services/task_center.py +64 -22
- {intellif_aihub-0.1.16.dist-info → intellif_aihub-0.1.18.dist-info}/METADATA +1 -1
- {intellif_aihub-0.1.16.dist-info → intellif_aihub-0.1.18.dist-info}/RECORD +10 -10
- {intellif_aihub-0.1.16.dist-info → intellif_aihub-0.1.18.dist-info}/WHEEL +0 -0
- {intellif_aihub-0.1.16.dist-info → intellif_aihub-0.1.18.dist-info}/licenses/LICENSE +0 -0
- {intellif_aihub-0.1.16.dist-info → intellif_aihub-0.1.18.dist-info}/top_level.txt +0 -0
aihub/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.18"
|
aihub/client.py
CHANGED
|
@@ -105,7 +105,7 @@ class Client:
|
|
|
105
105
|
self._http = httpx.Client(
|
|
106
106
|
base_url=base_url.rstrip("/"),
|
|
107
107
|
timeout=timeout,
|
|
108
|
-
headers={"Authorization": f"Bearer {token}"},
|
|
108
|
+
headers={"Authorization": f"Bearer {token}", "User-Agent": "aihub_sdk"},
|
|
109
109
|
# event_hooks={"response": [self._raise_for_status]},
|
|
110
110
|
)
|
|
111
111
|
self.artifact = artifact.ArtifactService(self._http)
|
aihub/models/task_center.py
CHANGED
|
@@ -9,6 +9,7 @@ from pydantic import BaseModel, Field, field_serializer, field_validator
|
|
|
9
9
|
|
|
10
10
|
class TaskCenterPriorityEnum(Enum):
|
|
11
11
|
"""任务优先级枚举"""
|
|
12
|
+
|
|
12
13
|
low = "low"
|
|
13
14
|
medium = "medium"
|
|
14
15
|
high = "high"
|
|
@@ -19,6 +20,7 @@ class LabelProjectTypeEnum(Enum):
|
|
|
19
20
|
任务类型枚举
|
|
20
21
|
1 - 目标检测 2 - 语义分割 3 - 图片分类 4 - 实例分割 5 - 视频标注 6 - 人类偏好文本标注 7- 敏感预料文本标注 8 - 文本标注 9 - 关键点标注
|
|
21
22
|
"""
|
|
23
|
+
|
|
22
24
|
OBJECT_DETECTION = 1
|
|
23
25
|
SEGMENTATION = 2
|
|
24
26
|
IMAGE_CLASSIFICATION = 3
|
|
@@ -32,6 +34,7 @@ class LabelProjectTypeEnum(Enum):
|
|
|
32
34
|
|
|
33
35
|
class CreateTaskOtherInfo(BaseModel):
|
|
34
36
|
"""创建任务附加信息"""
|
|
37
|
+
|
|
35
38
|
label_project_type: LabelProjectTypeEnum = Field(LabelProjectTypeEnum.IMAGE_CLASSIFICATION, description="标注枚举")
|
|
36
39
|
dataset_id: int = Field(alias="dataset_id", description="数据集ID")
|
|
37
40
|
dataset_version_id: int = Field(alias="dataset_version_id", description="数据集版本ID")
|
|
@@ -43,25 +46,29 @@ class CreateTaskOtherInfo(BaseModel):
|
|
|
43
46
|
|
|
44
47
|
class ProjectInfo(BaseModel):
|
|
45
48
|
"""项目信息"""
|
|
49
|
+
|
|
46
50
|
label_project_id: int = Field(alias="label_project_id", description="项目ID")
|
|
47
51
|
label_project_name: str = Field(alias="label_project_name", description="项目名称")
|
|
48
52
|
|
|
49
53
|
|
|
50
54
|
class TaskDetailOtherInfo(BaseModel):
|
|
51
55
|
"""任务详情附加信息"""
|
|
56
|
+
|
|
52
57
|
label_project_type: LabelProjectTypeEnum = Field(LabelProjectTypeEnum.IMAGE_CLASSIFICATION, description="标注枚举")
|
|
53
58
|
dataset_id: Optional[int] = Field(default=None, alias="dataset_id", description="数据集ID")
|
|
54
59
|
dataset_version_id: Optional[int] = Field(default=None, alias="dataset_version_id", description="数据集版本ID")
|
|
55
60
|
doc_id: int = Field(alias="doc_id", description="文档中心文档ID")
|
|
56
61
|
doc_type: str = Field(alias="doc_type", default="doc_center", description="文档类型")
|
|
57
|
-
label_projects: Optional[List[ProjectInfo]] = Field(
|
|
58
|
-
|
|
62
|
+
label_projects: Optional[List[ProjectInfo]] = Field(
|
|
63
|
+
alias="label_projects", default=None, description="关联标注项目列表"
|
|
64
|
+
)
|
|
59
65
|
|
|
60
66
|
model_config = {"use_enum_values": True}
|
|
61
67
|
|
|
62
68
|
|
|
63
69
|
class CreateTaskReq(BaseModel):
|
|
64
70
|
"""创建标注任务请求"""
|
|
71
|
+
|
|
65
72
|
name: str = Field(description="任务名称")
|
|
66
73
|
description: Optional[str] = Field(None, description="任务描述")
|
|
67
74
|
task_priority: Optional[str] = Field(None, alias="task_priority", description="优先级")
|
|
@@ -79,11 +86,13 @@ class CreateTaskReq(BaseModel):
|
|
|
79
86
|
|
|
80
87
|
class CreateTaskResp(BaseModel):
|
|
81
88
|
"""创建标注任务返回"""
|
|
89
|
+
|
|
82
90
|
id: int = Field(alias="id", description="任务ID")
|
|
83
91
|
|
|
84
92
|
|
|
85
93
|
class LabelTaskDetail(BaseModel):
|
|
86
94
|
"""任务详情"""
|
|
95
|
+
|
|
87
96
|
name: str = Field(description="任务名称")
|
|
88
97
|
description: Optional[str] = Field(default=None, alias="description", description="任务描述")
|
|
89
98
|
task_priority: Optional[str] = Field(default=None, alias="task_priority", description="优先级")
|
|
@@ -119,6 +128,25 @@ class LabelTaskDetail(BaseModel):
|
|
|
119
128
|
# 如果已经是对象,直接返回
|
|
120
129
|
return value
|
|
121
130
|
else:
|
|
122
|
-
raise ValueError(
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
raise ValueError(f"other_info 必须是字符串、字典或 TaskDetailOtherInfo 对象,得到: {type(value)}")
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class LabelValidateStage(Enum):
|
|
135
|
+
"""任务验收阶段"""
|
|
136
|
+
|
|
137
|
+
TEN_PERCENT = "标注阶段(10%)"
|
|
138
|
+
"""10%阶段"""
|
|
139
|
+
FIFTY_PERCENT = "标注阶段(50%)"
|
|
140
|
+
"""50%阶段"""
|
|
141
|
+
HUNDRED_PERCENT = "标注阶段(100%)"
|
|
142
|
+
"""100%阶段(已交付)"""
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class LabelValidateReq(BaseModel):
|
|
146
|
+
"""任务验收"""
|
|
147
|
+
|
|
148
|
+
label_project_id: int = Field(alias="label_project_id", description="项目ID")
|
|
149
|
+
stage: LabelValidateStage = Field(alias="stage", description="阶段")
|
|
150
|
+
passed: bool = Field(alias="passed", description="是否通过")
|
|
151
|
+
note: str = Field(alias="note", description="备注")
|
|
152
|
+
model_config = {"use_enum_values": True}
|
aihub/models/user_system.py
CHANGED
|
@@ -9,8 +9,10 @@ from pydantic import BaseModel, Field
|
|
|
9
9
|
# COMMON
|
|
10
10
|
# ======================================================================
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
class Role(BaseModel):
|
|
13
14
|
"""角色"""
|
|
15
|
+
|
|
14
16
|
id: int = Field(description="角色ID")
|
|
15
17
|
name: str = Field(description="角色名称")
|
|
16
18
|
role_type: int = Field(alias="role_type", description="角色类型,1-管理员,2-普通")
|
|
@@ -19,6 +21,7 @@ class Role(BaseModel):
|
|
|
19
21
|
|
|
20
22
|
class Menu(BaseModel):
|
|
21
23
|
"""菜单"""
|
|
24
|
+
|
|
22
25
|
id: int = Field(description="菜单ID")
|
|
23
26
|
name: str = Field(description="菜单名称")
|
|
24
27
|
parent: int = Field(description="父级菜单ID")
|
|
@@ -27,6 +30,7 @@ class Menu(BaseModel):
|
|
|
27
30
|
|
|
28
31
|
class TreeMenu(BaseModel):
|
|
29
32
|
"""菜单(树形)"""
|
|
33
|
+
|
|
30
34
|
id: int = Field(description="菜单ID")
|
|
31
35
|
name: str = Field(description="菜单名称")
|
|
32
36
|
parent: int = Field(description="父级菜单ID")
|
|
@@ -37,6 +41,7 @@ class TreeMenu(BaseModel):
|
|
|
37
41
|
|
|
38
42
|
class TagBrief(BaseModel):
|
|
39
43
|
"""标签"""
|
|
44
|
+
|
|
40
45
|
id: int = Field(description="标签ID")
|
|
41
46
|
name: str = Field(description="标签名称")
|
|
42
47
|
|
|
@@ -45,20 +50,24 @@ class TagBrief(BaseModel):
|
|
|
45
50
|
# ------------------------------- AUTH ---------------------------------
|
|
46
51
|
# ======================================================================
|
|
47
52
|
|
|
53
|
+
|
|
48
54
|
class LoginRequest(BaseModel):
|
|
49
55
|
"""登录请求"""
|
|
56
|
+
|
|
50
57
|
username: str = Field(alias="username", description="用户名")
|
|
51
58
|
password: str = Field(alias="password", description="密码")
|
|
52
59
|
|
|
53
60
|
|
|
54
61
|
class LoginResponse(BaseModel):
|
|
55
62
|
"""登录返回"""
|
|
63
|
+
|
|
56
64
|
id: int = Field(alias="id", description="用户ID")
|
|
57
65
|
token: str = Field(alias="token", description="JWT Token")
|
|
58
66
|
|
|
59
67
|
|
|
60
68
|
class SignupRequest(BaseModel):
|
|
61
69
|
"""注册请求"""
|
|
70
|
+
|
|
62
71
|
username: str = Field(alias="username", description="用户名")
|
|
63
72
|
password: str = Field(alias="password", description="密码")
|
|
64
73
|
nickname: str = Field(alias="nickname", description="昵称")
|
|
@@ -68,6 +77,7 @@ class SignupRequest(BaseModel):
|
|
|
68
77
|
|
|
69
78
|
class SignupResponse(BaseModel):
|
|
70
79
|
"""注册返回"""
|
|
80
|
+
|
|
71
81
|
id: int = Field(alias="id", description="用户ID")
|
|
72
82
|
|
|
73
83
|
|
|
@@ -76,16 +86,19 @@ class SignupResponse(BaseModel):
|
|
|
76
86
|
# ======================================================================
|
|
77
87
|
class ListMenusRequest(BaseModel):
|
|
78
88
|
"""查询菜单列表请求"""
|
|
89
|
+
|
|
79
90
|
need_roles: Optional[bool] = Field(None, alias="need_roles", description="是否同时返回菜单绑定的角色信息")
|
|
80
91
|
|
|
81
92
|
|
|
82
93
|
class ListMenusResponse(BaseModel):
|
|
83
94
|
"""查询菜单列表返回"""
|
|
95
|
+
|
|
84
96
|
menus: List[TreeMenu] = Field(alias="menus", description="菜单树列表")
|
|
85
97
|
|
|
86
98
|
|
|
87
99
|
class CreateMenuRequest(BaseModel):
|
|
88
100
|
"""创建菜单请求"""
|
|
101
|
+
|
|
89
102
|
name: str = Field(alias="name", description="菜单名称")
|
|
90
103
|
parent: int = Field(alias="parent", description="父级菜单ID")
|
|
91
104
|
auth: str = Field(alias="auth", description="权限")
|
|
@@ -94,11 +107,13 @@ class CreateMenuRequest(BaseModel):
|
|
|
94
107
|
|
|
95
108
|
class CreateMenuResponse(BaseModel):
|
|
96
109
|
"""创建菜单返回"""
|
|
110
|
+
|
|
97
111
|
id: int = Field(alias="id", description="菜单ID")
|
|
98
112
|
|
|
99
113
|
|
|
100
114
|
class UpdateMenuRequest(BaseModel):
|
|
101
115
|
"""更新菜单请求"""
|
|
116
|
+
|
|
102
117
|
name: Optional[str] = Field(None, alias="name", description="菜单名称")
|
|
103
118
|
parent: Optional[int] = Field(None, alias="parent", description="父级菜单ID")
|
|
104
119
|
auth: str = Field(alias="auth", description="权限")
|
|
@@ -107,16 +122,19 @@ class UpdateMenuRequest(BaseModel):
|
|
|
107
122
|
|
|
108
123
|
class GetMenuRolesResponse(BaseModel):
|
|
109
124
|
"""获取菜单角色返回"""
|
|
125
|
+
|
|
110
126
|
role_ids: List[int] = Field(alias="role_ids", description="菜单绑定的角色ID")
|
|
111
127
|
|
|
112
128
|
|
|
113
129
|
class SetMenuRolesRequest(BaseModel):
|
|
114
130
|
"""设置菜单角色请求"""
|
|
131
|
+
|
|
115
132
|
role_ids: List[int] = Field(alias="role_ids", description="绑定的角色列表")
|
|
116
133
|
|
|
117
134
|
|
|
118
135
|
class SearchMenusRequest(BaseModel):
|
|
119
136
|
"""搜索菜单请求"""
|
|
137
|
+
|
|
120
138
|
page_size: int = Field(20, alias="page_size", description="单页条数")
|
|
121
139
|
page_num: int = Field(1, alias="page_num", description="页码")
|
|
122
140
|
name: Optional[str] = Field(None, description="名称过滤")
|
|
@@ -127,6 +145,7 @@ class SearchMenusRequest(BaseModel):
|
|
|
127
145
|
|
|
128
146
|
class SearchMenusResponse(BaseModel):
|
|
129
147
|
"""搜索菜单返回"""
|
|
148
|
+
|
|
130
149
|
total: int = Field(description="总数")
|
|
131
150
|
page_size: int = Field(alias="page_size", description="单页条数")
|
|
132
151
|
page_num: int = Field(alias="page_num", description="当前页")
|
|
@@ -140,6 +159,7 @@ class SearchMenusResponse(BaseModel):
|
|
|
140
159
|
|
|
141
160
|
class CreateRoleRequest(BaseModel):
|
|
142
161
|
"""创建角色请求"""
|
|
162
|
+
|
|
143
163
|
id: Optional[int] = Field(None, description="自定义ID")
|
|
144
164
|
name: str = Field(description="角色名称")
|
|
145
165
|
role_type: int = Field(alias="role_type", description="角色类型")
|
|
@@ -148,11 +168,13 @@ class CreateRoleRequest(BaseModel):
|
|
|
148
168
|
|
|
149
169
|
class CreateRoleResponse(BaseModel):
|
|
150
170
|
"""创建角色返回"""
|
|
171
|
+
|
|
151
172
|
id: int = Field(description="角色ID")
|
|
152
173
|
|
|
153
174
|
|
|
154
175
|
class UpdateRoleRequest(BaseModel):
|
|
155
176
|
"""更新角色请求"""
|
|
177
|
+
|
|
156
178
|
name: Optional[str] = Field(None, description="角色名称")
|
|
157
179
|
role_type: Optional[int] = Field(None, alias="role_type", description="角色类型")
|
|
158
180
|
menu_ids: Optional[List[int]] = Field(None, alias="menu_ids", description="菜单列表")
|
|
@@ -160,16 +182,19 @@ class UpdateRoleRequest(BaseModel):
|
|
|
160
182
|
|
|
161
183
|
class GetRoleMenusResponse(BaseModel):
|
|
162
184
|
"""获取角色菜单返回"""
|
|
185
|
+
|
|
163
186
|
menu_ids: List[int] = Field(alias="menu_ids", description="菜单ID")
|
|
164
187
|
|
|
165
188
|
|
|
166
189
|
class SetRoleMenusRequest(BaseModel):
|
|
167
190
|
"""设置角色菜单请求"""
|
|
191
|
+
|
|
168
192
|
menu_ids: List[int] = Field(alias="menu_ids", description="菜单ID")
|
|
169
193
|
|
|
170
194
|
|
|
171
195
|
class ListRolesRequest(BaseModel):
|
|
172
196
|
"""查询角色列表请求"""
|
|
197
|
+
|
|
173
198
|
page_size: int = Field(20, alias="page_size", description="单页条数")
|
|
174
199
|
page_num: int = Field(1, alias="page_num", description="页码")
|
|
175
200
|
role_type: Optional[int] = Field(None, alias="role_type", description="角色类型过滤")
|
|
@@ -177,6 +202,7 @@ class ListRolesRequest(BaseModel):
|
|
|
177
202
|
|
|
178
203
|
class ListRolesResponse(BaseModel):
|
|
179
204
|
"""查询角色列表返回"""
|
|
205
|
+
|
|
180
206
|
total: int = Field(description="总数")
|
|
181
207
|
page_size: int = Field(alias="page_size", description="单页条数")
|
|
182
208
|
page_num: int = Field(alias="page_num", description="当前页")
|
|
@@ -185,6 +211,7 @@ class ListRolesResponse(BaseModel):
|
|
|
185
211
|
|
|
186
212
|
class SearchRolesRequest(BaseModel):
|
|
187
213
|
"""搜索角色请求"""
|
|
214
|
+
|
|
188
215
|
page_size: int = Field(20, alias="page_size", description="单页条数")
|
|
189
216
|
page_num: int = Field(1, alias="page_num", description="页码")
|
|
190
217
|
name: Optional[str] = Field(None, description="名字过滤")
|
|
@@ -194,6 +221,7 @@ class SearchRolesRequest(BaseModel):
|
|
|
194
221
|
|
|
195
222
|
class SearchRolesResponse(BaseModel):
|
|
196
223
|
"""搜索角色返回"""
|
|
224
|
+
|
|
197
225
|
total: int = Field(description="总数")
|
|
198
226
|
page_size: int = Field(alias="page_size", description="单页条数")
|
|
199
227
|
page_num: int = Field(alias="page_num", description="当前页")
|
|
@@ -204,8 +232,10 @@ class SearchRolesResponse(BaseModel):
|
|
|
204
232
|
# ------------------------------- USER ---------------------------------
|
|
205
233
|
# ======================================================================
|
|
206
234
|
|
|
235
|
+
|
|
207
236
|
class User(BaseModel):
|
|
208
237
|
"""用户信息"""
|
|
238
|
+
|
|
209
239
|
id: int = Field(description="用户ID")
|
|
210
240
|
username: str = Field(description="用户名")
|
|
211
241
|
nickname: str = Field(description="昵称")
|
|
@@ -218,6 +248,7 @@ class User(BaseModel):
|
|
|
218
248
|
|
|
219
249
|
class ListUsersRequest(BaseModel):
|
|
220
250
|
"""查询用户列表请求"""
|
|
251
|
+
|
|
221
252
|
page_size: int = Field(20, alias="page_size", description="单页条数")
|
|
222
253
|
page_num: int = Field(1, alias="page_num", description="页码")
|
|
223
254
|
search_key: Optional[str] = Field(None, alias="search_key", description="搜索关键字")
|
|
@@ -225,6 +256,7 @@ class ListUsersRequest(BaseModel):
|
|
|
225
256
|
|
|
226
257
|
class ListUsersResponse(BaseModel):
|
|
227
258
|
"""查询用户列表返回"""
|
|
259
|
+
|
|
228
260
|
total: int = Field(description="总数")
|
|
229
261
|
page_size: int = Field(alias="page_size", description="单页条数")
|
|
230
262
|
page_num: int = Field(alias="page_num", description="当前页")
|
|
@@ -233,6 +265,7 @@ class ListUsersResponse(BaseModel):
|
|
|
233
265
|
|
|
234
266
|
class CreateUserRequest(BaseModel):
|
|
235
267
|
"""创建用户请求"""
|
|
268
|
+
|
|
236
269
|
id: int = Field(description="用户id")
|
|
237
270
|
username: str = Field(description="用户名")
|
|
238
271
|
password: str = Field(description="密码")
|
|
@@ -247,11 +280,13 @@ class CreateUserRequest(BaseModel):
|
|
|
247
280
|
|
|
248
281
|
class CreateUserResponse(BaseModel):
|
|
249
282
|
"""创建用户返回"""
|
|
283
|
+
|
|
250
284
|
id: int = Field(description="用户ID")
|
|
251
285
|
|
|
252
286
|
|
|
253
287
|
class UpdateUserRequest(BaseModel):
|
|
254
288
|
"""更新用户请求"""
|
|
289
|
+
|
|
255
290
|
username: Optional[str] = Field(None, description="用户名")
|
|
256
291
|
nickname: Optional[str] = Field(None, description="昵称")
|
|
257
292
|
email: Optional[str] = Field(None, description="邮箱")
|
|
@@ -263,16 +298,19 @@ class UpdateUserRequest(BaseModel):
|
|
|
263
298
|
|
|
264
299
|
class SetUserRolesRequest(BaseModel):
|
|
265
300
|
"""设置用户角色请求"""
|
|
301
|
+
|
|
266
302
|
role_ids: List[int] = Field(alias="role_ids", description="角色列表")
|
|
267
303
|
|
|
268
304
|
|
|
269
305
|
class GetUserMenusResponse(BaseModel):
|
|
270
306
|
"""获取用户菜单返回"""
|
|
307
|
+
|
|
271
308
|
menus: List[TreeMenu] = Field(description="菜单树")
|
|
272
309
|
|
|
273
310
|
|
|
274
311
|
class SearchUsersRequest(BaseModel):
|
|
275
312
|
"""搜索用户请求"""
|
|
313
|
+
|
|
276
314
|
page_size: int = Field(20, alias="page_size", description="单页条数")
|
|
277
315
|
page_num: int = Field(1, alias="page_num", description="当前页")
|
|
278
316
|
username: Optional[str] = Field(None, description="用户名过滤")
|
|
@@ -286,6 +324,7 @@ class SearchUsersRequest(BaseModel):
|
|
|
286
324
|
|
|
287
325
|
class SearchUsersResponse(BaseModel):
|
|
288
326
|
"""搜索用户返回"""
|
|
327
|
+
|
|
289
328
|
total: int = Field(description="总数")
|
|
290
329
|
page_size: int = Field(alias="page_size", description="单页条数")
|
|
291
330
|
page_num: int = Field(alias="page_num", description="当前页")
|
|
@@ -293,4 +332,4 @@ class SearchUsersResponse(BaseModel):
|
|
|
293
332
|
|
|
294
333
|
|
|
295
334
|
# 此行放在文件末尾,否则序列化报错
|
|
296
|
-
TreeMenu.
|
|
335
|
+
TreeMenu.model_rebuild()
|
aihub/services/task_center.py
CHANGED
|
@@ -13,6 +13,7 @@ from __future__ import annotations
|
|
|
13
13
|
import datetime
|
|
14
14
|
|
|
15
15
|
import httpx
|
|
16
|
+
from loguru import logger
|
|
16
17
|
|
|
17
18
|
from .tag_resource_management import TagResourceManagementService
|
|
18
19
|
from .user_system import UserSystemService
|
|
@@ -25,6 +26,8 @@ from ..models.task_center import (
|
|
|
25
26
|
LabelProjectTypeEnum,
|
|
26
27
|
TaskCenterPriorityEnum,
|
|
27
28
|
LabelTaskDetail,
|
|
29
|
+
LabelValidateReq,
|
|
30
|
+
LabelValidateStage,
|
|
28
31
|
)
|
|
29
32
|
from ..models.user_system import SearchUsersRequest
|
|
30
33
|
|
|
@@ -71,16 +74,16 @@ class TaskCenterService:
|
|
|
71
74
|
return self._TaskCenter
|
|
72
75
|
|
|
73
76
|
def create_label_task(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
77
|
+
self,
|
|
78
|
+
name: str,
|
|
79
|
+
dataset_version_name: str,
|
|
80
|
+
feishu_doc_name: str,
|
|
81
|
+
task_receiver_name: str,
|
|
82
|
+
estimated_delivery_at: str,
|
|
83
|
+
project_name: str,
|
|
84
|
+
label_type: LabelProjectTypeEnum = LabelProjectTypeEnum.IMAGE_CLASSIFICATION,
|
|
85
|
+
description: str = "",
|
|
86
|
+
task_priority: TaskCenterPriorityEnum = TaskCenterPriorityEnum.low,
|
|
84
87
|
) -> int:
|
|
85
88
|
"""创建标注任务
|
|
86
89
|
|
|
@@ -109,9 +112,7 @@ task_priority="low", estimated_delivery_at= "2025-08-01")
|
|
|
109
112
|
"""
|
|
110
113
|
# 获取接收者ID
|
|
111
114
|
user_service = UserSystemService(self._http)
|
|
112
|
-
task_receiver_id = user_service.search_one(
|
|
113
|
-
payload=SearchUsersRequest(nickname=task_receiver_name)
|
|
114
|
-
)
|
|
115
|
+
task_receiver_id = user_service.search_one(payload=SearchUsersRequest(nickname=task_receiver_name))
|
|
115
116
|
|
|
116
117
|
# 获取项目ID
|
|
117
118
|
tag_service = TagResourceManagementService(self._http)
|
|
@@ -129,9 +130,7 @@ task_priority="low", estimated_delivery_at= "2025-08-01")
|
|
|
129
130
|
from .dataset_management import DatasetManagementService
|
|
130
131
|
|
|
131
132
|
dataset_service = DatasetManagementService(self._http)
|
|
132
|
-
dataset_version = dataset_service.get_dataset_version_by_name(
|
|
133
|
-
version_name=dataset_version_name
|
|
134
|
-
)
|
|
133
|
+
dataset_version = dataset_service.get_dataset_version_by_name(version_name=dataset_version_name)
|
|
135
134
|
|
|
136
135
|
dataset_id = dataset_version.dataset_id
|
|
137
136
|
dataset_version_id = dataset_version.id
|
|
@@ -169,6 +168,41 @@ task_priority="low", estimated_delivery_at= "2025-08-01")
|
|
|
169
168
|
|
|
170
169
|
return self.create(task_req)
|
|
171
170
|
|
|
171
|
+
def validate_label_project(
|
|
172
|
+
self,
|
|
173
|
+
task_id: int,
|
|
174
|
+
label_project_name: str,
|
|
175
|
+
stage: LabelValidateStage,
|
|
176
|
+
passed: bool,
|
|
177
|
+
note: str = "",
|
|
178
|
+
) -> None:
|
|
179
|
+
"""验证标注项目
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
label_project_name (str): 标注项目名称
|
|
183
|
+
stage (LabelValidateStage): 验收的标注阶段
|
|
184
|
+
passed (bool): 是否验收通过
|
|
185
|
+
note (str)
|
|
186
|
+
task_id (int): 任务ID
|
|
187
|
+
"""
|
|
188
|
+
task_item = self.task_center.get(task_id)
|
|
189
|
+
|
|
190
|
+
for project_info in task_item.other_info.label_projects:
|
|
191
|
+
if project_info.label_project_name == label_project_name:
|
|
192
|
+
label_project_id = project_info.label_project_id
|
|
193
|
+
break
|
|
194
|
+
else:
|
|
195
|
+
raise APIError(f"未找到标注项目: {label_project_name}")
|
|
196
|
+
|
|
197
|
+
req = LabelValidateReq(
|
|
198
|
+
label_project_id=label_project_id,
|
|
199
|
+
note=note,
|
|
200
|
+
passed=passed,
|
|
201
|
+
stage=stage,
|
|
202
|
+
)
|
|
203
|
+
self.task_center.validate_label_project(task_id=task_id, payload=req)
|
|
204
|
+
logger.info(f"标注项目: {label_project_name} 完成了: {stage}, 验收结果: {passed}")
|
|
205
|
+
|
|
172
206
|
|
|
173
207
|
class _TaskCenter:
|
|
174
208
|
def __init__(self, http: httpx.Client):
|
|
@@ -180,9 +214,7 @@ class _TaskCenter:
|
|
|
180
214
|
json=payload.model_dump(),
|
|
181
215
|
)
|
|
182
216
|
if resp.status_code != 200:
|
|
183
|
-
raise APIError(
|
|
184
|
-
message="API Error", status=resp.status_code, detail=resp.json()
|
|
185
|
-
)
|
|
217
|
+
raise APIError(message="API Error", status=resp.status_code, detail=resp.json())
|
|
186
218
|
wrapper = APIWrapper[CreateTaskResp].model_validate(resp.json())
|
|
187
219
|
|
|
188
220
|
return wrapper.data.id
|
|
@@ -192,8 +224,18 @@ class _TaskCenter:
|
|
|
192
224
|
f"{_BASE}/tasks/{task_id}",
|
|
193
225
|
)
|
|
194
226
|
if resp.status_code != 200:
|
|
195
|
-
raise APIError(
|
|
196
|
-
message="API Error", status=resp.status_code, detail=resp.json()
|
|
197
|
-
)
|
|
227
|
+
raise APIError(message="API Error", status=resp.status_code, detail=resp.text)
|
|
198
228
|
wrapper = APIWrapper[LabelTaskDetail].model_validate(resp.json())
|
|
199
229
|
return wrapper.data
|
|
230
|
+
|
|
231
|
+
def validate_label_project(self, task_id: int, payload: LabelValidateReq) -> None:
|
|
232
|
+
resp = self._http.post(
|
|
233
|
+
f"{_BASE}/tasks/{task_id}/label_validate",
|
|
234
|
+
json=payload.model_dump(),
|
|
235
|
+
)
|
|
236
|
+
if resp.status_code != 200:
|
|
237
|
+
raise APIError(message="API Error", status=resp.status_code, detail=resp.text)
|
|
238
|
+
wrapper = APIWrapper[CreateTaskResp].model_validate(resp.json())
|
|
239
|
+
if wrapper.code != 0:
|
|
240
|
+
raise APIError(f"backend code {wrapper.code}: {wrapper.msg}")
|
|
241
|
+
return
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
aihub/__init__.py,sha256=
|
|
2
|
-
aihub/client.py,sha256=
|
|
1
|
+
aihub/__init__.py,sha256=6BiuMUkhwQp6bzUZSF8np8F1NwCltEtK0sPBF__tepU,23
|
|
2
|
+
aihub/client.py,sha256=Fu3jlEy21T4nJDV5EXTDujy1_B3Pf6CSTyPwkj3PPuE,5574
|
|
3
3
|
aihub/exceptions.py,sha256=l2cMAvipTqQOio3o11fXsCCSCevbuK4PTsxofkobFjk,500
|
|
4
4
|
aihub/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
aihub/models/artifact.py,sha256=F-r7DJY9A09yIQJqWol6gLRu6y7NGjRa6-BxkMEluxU,4655
|
|
@@ -13,8 +13,8 @@ aihub/models/model_center.py,sha256=DNMchrN0pYDcTMHApWNNVMrARF_i9Ng5xlAwHX5isYw,
|
|
|
13
13
|
aihub/models/model_training_platform.py,sha256=2zir5i-XvuxKKVYr4wuNYUC7nwMzetdtCRoysZ1W_Tc,11725
|
|
14
14
|
aihub/models/quota_schedule_management.py,sha256=LdXwKkpJd0jUFSHtTHUlFLlH-NUSmgywWtxwFg57CNk,12368
|
|
15
15
|
aihub/models/tag_resource_management.py,sha256=-FgiKyDIG7bZagzVRf-8rXWuqH9GyciDadxz5W2f3I8,2195
|
|
16
|
-
aihub/models/task_center.py,sha256=
|
|
17
|
-
aihub/models/user_system.py,sha256=
|
|
16
|
+
aihub/models/task_center.py,sha256=uxGZ5t2KM4aAu7Z93Zard-gbiDPwJCiezMRgIGd9Rtk,6149
|
|
17
|
+
aihub/models/user_system.py,sha256=58f4w5g_SHUhX4vvJK6RXChCr6IDjX4i957suWYaxg8,12249
|
|
18
18
|
aihub/models/workflow_center.py,sha256=4xtI1WZ38ceXJ8gwDBj-QNjOiRlLO_8kGiQybdudJPY,20121
|
|
19
19
|
aihub/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
aihub/services/artifact.py,sha256=lfOrgOT2AlH1w-75NLcQGOhVWdhmJcWD1gESPpUzqUw,11257
|
|
@@ -28,7 +28,7 @@ aihub/services/model_training_platform.py,sha256=38o6HJnyi3htFzpX7qj6UhzdqTchcXL
|
|
|
28
28
|
aihub/services/quota_schedule_management.py,sha256=UYOMwjXxJTgkpN6Rv5GzlcejtpZfu23PXlSKr0WihTY,9586
|
|
29
29
|
aihub/services/reporter.py,sha256=ot93SmhxgwDJOzlHSCwlxDOuSydTWUEUQ-Ctp97wJBQ,669
|
|
30
30
|
aihub/services/tag_resource_management.py,sha256=Bm_inSIzZbTc-e4LU9kvwtsPpM_yLwm8xzdrALjb6uY,2666
|
|
31
|
-
aihub/services/task_center.py,sha256=
|
|
31
|
+
aihub/services/task_center.py,sha256=ljy4lhyqVe2lnytp1h72mliqXUbSvEELT9KmxxPKdKc,8003
|
|
32
32
|
aihub/services/user_system.py,sha256=IqWL4bnsKyyzuGT5l6adnw0qNXlH9PSo1-C_pFyOSzA,18868
|
|
33
33
|
aihub/services/workflow_center.py,sha256=caKxOlba0J1s1RUK6RUm1ndJSwAcZXEakRanu3sGKPU,17468
|
|
34
34
|
aihub/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -36,8 +36,8 @@ aihub/utils/di.py,sha256=vFUzno5WbRKu6-pj8Hnz9IqT7xb9UDZQ4qpOFH1YAtM,11812
|
|
|
36
36
|
aihub/utils/download.py,sha256=ZZVbcC-PnN3PumV7ZiJ_-srkt4HPPovu2F6Faa2RrPE,1830
|
|
37
37
|
aihub/utils/http.py,sha256=AmfHHNjptuuSFx2T1twWCnerR_hLN_gd0lUs8z36ERA,547
|
|
38
38
|
aihub/utils/s3.py,sha256=ISIBP-XdBPkURpXnN56ZnIWokOOg2SRUh_qvxJk-G1Q,2187
|
|
39
|
-
intellif_aihub-0.1.
|
|
40
|
-
intellif_aihub-0.1.
|
|
41
|
-
intellif_aihub-0.1.
|
|
42
|
-
intellif_aihub-0.1.
|
|
43
|
-
intellif_aihub-0.1.
|
|
39
|
+
intellif_aihub-0.1.18.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
40
|
+
intellif_aihub-0.1.18.dist-info/METADATA,sha256=XQqYqji6SA8pj_BondfV-zZLv5JjqgMqAJjc1l5FOuU,2949
|
|
41
|
+
intellif_aihub-0.1.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
42
|
+
intellif_aihub-0.1.18.dist-info/top_level.txt,sha256=vIvTtSIN73xv46BpYM-ctVGnyOiUQ9EWP_6ngvdIlvw,6
|
|
43
|
+
intellif_aihub-0.1.18.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|