@glodon-aiot/dataset-annotation 3.18.0-alpha.11 → 3.18.0-alpha.13

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.
@@ -1,166 +1,168 @@
1
- var w = (F, d, r) => new Promise((V, N) => {
2
- var T = (u) => {
1
+ var L = (w, d, r) => new Promise((P, T) => {
2
+ var O = (u) => {
3
3
  try {
4
4
  m(r.next(u));
5
- } catch (f) {
6
- N(f);
5
+ } catch (y) {
6
+ T(y);
7
7
  }
8
- }, l = (u) => {
8
+ }, t = (u) => {
9
9
  try {
10
10
  m(r.throw(u));
11
- } catch (f) {
12
- N(f);
11
+ } catch (y) {
12
+ T(y);
13
13
  }
14
- }, m = (u) => u.done ? V(u.value) : Promise.resolve(u.value).then(T, l);
15
- m((r = r.apply(F, d)).next());
14
+ }, m = (u) => u.done ? P(u.value) : Promise.resolve(u.value).then(O, t);
15
+ m((r = r.apply(w, d)).next());
16
16
  });
17
- import { jsx as s, jsxs as C } from "react/jsx-runtime";
18
- import { useState as g, useContext as Z, useEffect as k } from "react";
19
- import { Form as y, Modal as $, Button as S, Space as z, Spin as ee, Select as G, Tooltip as M, Tag as te, Radio as q } from "antd";
17
+ import { jsx as l, jsxs as S } from "react/jsx-runtime";
18
+ import { useState as C, useContext as $, useEffect as k } from "react";
19
+ import { Form as v, Modal as ee, Button as N, Space as z, Spin as te, Select as A, Tooltip as G, Tag as le, Radio as M } from "antd";
20
20
  import "./style.less.mjs";
21
- import { detectionPreService as le, ocrPreService as ae } from "../constant.mjs";
21
+ import { detectionPreService as ae, ocrPreService as ne } from "../constant.mjs";
22
22
  import { PreLabelTaskStatus as p } from "@glodon-aiot/apis";
23
- import ne from "../../../DatasetContext/index.mjs";
24
- const be = (F) => {
23
+ import se from "../../../DatasetContext/index.mjs";
24
+ import re from "../../../Common/ArchiSlider/index.mjs";
25
+ import ie from "./components/PreLabelPreview/index.mjs";
26
+ const Se = (w) => {
25
27
  const {
26
28
  datasetId: d,
27
29
  versionId: r,
28
- isVisible: V,
29
- onClose: N,
30
- setIsTaskChange: T,
31
- record: l,
30
+ isVisible: P,
31
+ onClose: T,
32
+ setIsTaskChange: O,
33
+ record: t,
32
34
  datasetType: m
33
- } = F, [u, f] = g([]), [A, B] = g([]), [b] = y.useForm(), [a, E] = g(), [x, _] = g(), [h, I] = g(""), P = y.useWatch("service", b), [D, J] = g(!1), {
35
+ } = w, [u, y] = C([]), [q, B] = C([]), [b] = v.useForm(), [a, I] = C(), [x, W] = C(), [g, E] = C(""), h = v.useWatch("service", b), [_, D] = C(!1), {
34
36
  services: {
35
37
  cvforceDatahub: o,
36
- cvforceModelService: v
38
+ cvforceModelService: f
37
39
  },
38
40
  featuresConfig: {
39
- labelManager: se
41
+ labelManager: oe
40
42
  } = {
41
43
  labelManager: !1
42
44
  }
43
- } = Z(ne), W = m === "detection" ? le : ae, O = () => {
44
- N();
45
+ } = $(se), J = v.useWatch("confidence", b), H = m === "detection" ? ae : ne, V = () => {
46
+ T();
45
47
  };
46
48
  k(() => {
47
- Q(), U();
49
+ U(), X();
48
50
  }, []), k(() => {
49
- l && E(l), l != null && l.lastTaskResult && _(JSON.parse(l == null ? void 0 : l.lastTaskResult));
50
- }, [l]), k(() => {
51
- var e, t, n, i, c;
51
+ t && I(t), t != null && t.lastTaskResult && W(JSON.parse(t == null ? void 0 : t.lastTaskResult));
52
+ }, [t]), k(() => {
53
+ var e, n, s, i, c;
52
54
  b.setFieldsValue({
53
55
  service: {
54
56
  value: (e = a == null ? void 0 : a.params) == null ? void 0 : e.serviceId,
55
- label: (t = a == null ? void 0 : a.params) == null ? void 0 : t.serviceName
57
+ label: (n = a == null ? void 0 : a.params) == null ? void 0 : n.serviceName
56
58
  },
57
- data: ((n = a == null ? void 0 : a.params) == null ? void 0 : n.data) || "nolabel",
59
+ data: ((s = a == null ? void 0 : a.params) == null ? void 0 : s.data) || "nolabel",
58
60
  confidence: (c = (i = a == null ? void 0 : a.params) == null ? void 0 : i.confidence) != null ? c : 0.6
59
- }), I((a == null ? void 0 : a.state) || "PENDING");
61
+ }), E((a == null ? void 0 : a.state) || "PENDING"), console.log(a, "============");
60
62
  }, [a]), k(() => {
61
- !P || !P.value || m !== "ocr" && Promise.all([H(), K(P.value)]).then(([e, t]) => {
63
+ !h || !h.value || m !== "ocr" && Promise.all([K(), Q(h.value)]).then(([e, n]) => {
62
64
  if (!e)
63
65
  return;
64
- const n = e.filter((i) => {
65
- if (!(t != null && t.find((c) => c === i)))
66
+ const s = e.filter((i) => {
67
+ if (!(n != null && n.find((c) => c === i)))
66
68
  return i;
67
69
  });
68
- J(!!n.length), b.validateFields(["service"]);
70
+ D(!!s.length), b.validateFields(["service"]);
69
71
  });
70
- }, [P]);
71
- const H = () => {
72
+ }, [h]);
73
+ const K = () => {
72
74
  if (!(!d || !r))
73
- return o == null ? void 0 : o.getDatasetsIdVersionsVidLabelcount(d, r).then((e) => e.filter((n) => n.label !== "nocode").map((n) => n.label));
74
- }, K = (e) => v == null ? void 0 : v.getModelServiceById(e).then((t) => {
75
- const n = t.deployOptions.confidence;
76
- return n == null ? void 0 : n.map((c) => c.label);
77
- }), Q = () => {
78
- v == null || v.openModelServices({
79
- signName: W,
75
+ return o == null ? void 0 : o.getDatasetsIdVersionsVidLabelcount(d, r).then((e) => e.filter((s) => s.label !== "nocode").map((s) => s.label));
76
+ }, Q = (e) => f == null ? void 0 : f.getModelServiceById(e).then((n) => {
77
+ const s = n.deployOptions.confidence;
78
+ return s == null ? void 0 : s.map((c) => c.label);
79
+ }), U = () => {
80
+ f == null || f.openModelServices({
81
+ signName: H,
80
82
  state: "Running"
81
83
  }).then((e) => {
82
- const n = (e || []).map((i) => {
84
+ const s = (e || []).map((i) => {
83
85
  var c;
84
86
  return {
85
87
  label: i.name,
86
88
  value: i.id,
87
- confidence: ((c = i.deployOptions.confidence) == null ? void 0 : c.map((L) => L.label)) || []
89
+ confidence: ((c = i.deployOptions.confidence) == null ? void 0 : c.map((F) => F.label)) || []
88
90
  };
89
91
  });
90
- f(n);
92
+ y(s);
91
93
  });
92
- }, U = () => {
94
+ }, X = () => {
93
95
  !d || !r || o == null || o.getDatasetsIdVersionsVidSamples(d, r, {
94
96
  labels: "nocode",
95
97
  pageNo: 1,
96
98
  pageSize: 1
97
99
  }).then((e) => {
98
- const t = e.recordList || [];
100
+ const n = e.recordList || [];
99
101
  B([{
100
102
  label: "全部未标注数据",
101
103
  value: "nolabel",
102
- disabled: !t.length
104
+ disabled: !n.length
103
105
  }]);
104
106
  });
105
107
  }, R = () => {
106
108
  !d || !r || !(a != null && a.taskId) || o == null || o.delPreLabelTask(d, r, a.taskId).then((e) => {
107
- T((t) => !t), I("PENDING");
109
+ O((n) => !n), E("PENDING");
108
110
  });
109
- }, X = () => {
110
- R();
111
111
  }, Y = () => {
112
- R(), b.resetFields(), E(void 0);
112
+ R();
113
+ }, Z = () => {
114
+ R(), b.resetFields(), I(void 0);
113
115
  }, j = (e) => {
114
- var n, i;
116
+ var s, i;
115
117
  if (!d || !r || !e.service)
116
118
  return;
117
- const t = {
119
+ const n = {
118
120
  serviceId: e.service.value,
119
- serviceName: (n = u.find((c) => c.value === e.service.value)) == null ? void 0 : n.label,
121
+ serviceName: (s = u.find((c) => c.value === e.service.value)) == null ? void 0 : s.label,
120
122
  data: "nolabel",
121
123
  confidence: (i = e.confidence) != null ? i : 0.6
122
124
  };
123
- o == null || o.postPreLabelTask(d, r, t).then((c) => {
124
- T((L) => !L);
125
+ o == null || o.postPreLabelTask(d, r, n).then((c) => {
126
+ O((F) => !F);
125
127
  });
126
128
  };
127
- return /* @__PURE__ */ s($, {
129
+ return /* @__PURE__ */ l(ee, {
128
130
  title: "预标注设置",
129
131
  wrapClassName: "batch-ocr-modal-wrap",
130
132
  className: "batch-ocr-modal",
131
- open: V,
133
+ open: P,
132
134
  destroyOnClose: !0,
133
- onCancel: O,
134
- width: 700,
135
+ onCancel: V,
136
+ width: "100%",
135
137
  maskClosable: !1,
136
138
  centered: !0,
137
- footer: h === p.Pending ? [/* @__PURE__ */ s(S, {
138
- onClick: O,
139
+ footer: g === p.Pending ? [/* @__PURE__ */ l(N, {
140
+ onClick: V,
139
141
  children: "取消"
140
- }, "cancel"), /* @__PURE__ */ s(S, {
142
+ }, "cancel"), /* @__PURE__ */ l(N, {
141
143
  type: "primary",
142
144
  htmlType: "submit",
143
145
  form: "preLabelForm",
144
146
  onClick: j,
145
147
  children: "确定"
146
- }, "confirm")] : (l == null ? void 0 : l.state) === p.Started ? [/* @__PURE__ */ s(S, {
147
- onClick: X,
148
+ }, "confirm")] : (t == null ? void 0 : t.state) === p.Started ? [/* @__PURE__ */ l(N, {
149
+ onClick: Y,
148
150
  children: "终止"
149
- }, "abort"), /* @__PURE__ */ s(S, {
150
- onClick: O,
151
+ }, "abort"), /* @__PURE__ */ l(N, {
152
+ onClick: V,
151
153
  children: "返回"
152
- }, "cancel")] : [/* @__PURE__ */ s(S, {
153
- onClick: Y,
154
+ }, "cancel")] : [/* @__PURE__ */ l(N, {
155
+ onClick: Z,
154
156
  children: "新建任务"
155
- }, "abort"), /* @__PURE__ */ s(S, {
156
- onClick: O,
157
+ }, "abort"), /* @__PURE__ */ l(N, {
158
+ onClick: V,
157
159
  children: "返回"
158
160
  }, "cancel")],
159
- children: h === p.Started || h === p.Success ? /* @__PURE__ */ s("div", {
161
+ children: g === p.Started || g === p.Success ? /* @__PURE__ */ l("div", {
160
162
  style: {
161
163
  padding: "80px 0"
162
164
  },
163
- children: /* @__PURE__ */ C(z, {
165
+ children: /* @__PURE__ */ S(z, {
164
166
  className: "mark-status",
165
167
  direction: "vertical",
166
168
  align: "center",
@@ -168,85 +170,107 @@ const be = (F) => {
168
170
  width: "100%"
169
171
  },
170
172
  size: 24,
171
- children: [h === p.Started && /* @__PURE__ */ s(ee, {
173
+ children: [g === p.Started && /* @__PURE__ */ l(te, {
172
174
  size: "default"
173
- }), (h === p.Started || h === p.Success) && /* @__PURE__ */ C(z, {
175
+ }), (g === p.Started || g === p.Success) && /* @__PURE__ */ S(z, {
174
176
  style: {
175
177
  marginLeft: 14
176
178
  },
177
179
  size: 0,
178
- children: [/* @__PURE__ */ C("span", {
180
+ children: [/* @__PURE__ */ S("span", {
179
181
  children: ["已标注数据:", x.completeCount || 0, " 张,"]
180
- }), /* @__PURE__ */ C("span", {
182
+ }), /* @__PURE__ */ S("span", {
181
183
  children: ["共计:", x.allCount || 0, " 张"]
182
184
  })]
183
185
  })]
184
186
  })
185
- }) : /* @__PURE__ */ C(y, {
186
- onFinish: j,
187
- name: "preLabelForm",
188
- labelAlign: "right",
189
- labelCol: {
190
- style: {
191
- width: 80
192
- }
193
- },
194
- form: b,
195
- children: [/* @__PURE__ */ s(y.Item, {
196
- label: "选择服务",
197
- name: "service",
198
- rules: [{
199
- required: !0
200
- }, {
201
- validator: (e, t) => w(void 0, null, function* () {
202
- const n = b.getFieldValue("service");
203
- if (!n.value || !n.label)
204
- return Promise.reject(new Error("请选择服务"));
205
- })
206
- }, {
207
- validator: (e, t) => w(void 0, null, function* () {
208
- if (D && m === "detection")
209
- return Promise.reject(new Error("所选服务与当前数据集标签不符"));
210
- })
211
- }],
212
- children: /* @__PURE__ */ s(G, {
213
- labelInValue: !0,
214
- disabled: (l == null ? void 0 : l.state) === p.Started,
215
- children: u.map((e) => /* @__PURE__ */ s(G.Option, {
216
- value: e.value,
217
- disabled: e.disabled,
218
- children: /* @__PURE__ */ s(M, {
219
- title: e.confidence.length ? e.confidence.map((t) => /* @__PURE__ */ s(te, {
220
- children: t
221
- }, t)) : null,
222
- overlayClassName: "service-tag-tooltip",
223
- children: e.label
187
+ }) : /* @__PURE__ */ S("div", {
188
+ className: "pre-label-form-wrap",
189
+ children: [/* @__PURE__ */ l("div", {
190
+ className: "pre-label-form",
191
+ children: /* @__PURE__ */ S(v, {
192
+ onFinish: j,
193
+ name: "preLabelForm",
194
+ labelAlign: "right",
195
+ labelCol: {
196
+ style: {
197
+ width: 80
198
+ }
199
+ },
200
+ form: b,
201
+ children: [/* @__PURE__ */ l(v.Item, {
202
+ label: "选择服务",
203
+ name: "service",
204
+ rules: [{
205
+ required: !0
206
+ }, {
207
+ validator: (e, n) => L(void 0, null, function* () {
208
+ const s = b.getFieldValue("service");
209
+ if (!s.value || !s.label)
210
+ return Promise.reject(new Error("请选择服务"));
211
+ })
212
+ }, {
213
+ validator: (e, n) => L(void 0, null, function* () {
214
+ if (_ && m === "detection")
215
+ return Promise.reject(new Error("所选服务与当前数据集标签不符"));
216
+ })
217
+ }],
218
+ children: /* @__PURE__ */ l(A, {
219
+ labelInValue: !0,
220
+ disabled: (t == null ? void 0 : t.state) === p.Started,
221
+ children: u.map((e) => /* @__PURE__ */ l(A.Option, {
222
+ value: e.value,
223
+ disabled: e.disabled,
224
+ children: /* @__PURE__ */ l(G, {
225
+ title: e.confidence.length ? e.confidence.map((n) => /* @__PURE__ */ l(le, {
226
+ children: n
227
+ }, n)) : null,
228
+ overlayClassName: "service-tag-tooltip",
229
+ children: e.label
230
+ })
231
+ }, e.value))
224
232
  })
225
- }, e.value))
226
- })
227
- }), /* @__PURE__ */ s(y.Item, {
228
- label: "处理范围",
229
- name: "data",
230
- rules: [{
231
- required: !0,
232
- message: "请选择数据"
233
- }],
234
- initialValue: "nolabel",
235
- children: /* @__PURE__ */ s(q.Group, {
236
- disabled: (l == null ? void 0 : l.state) === p.Started,
237
- children: A.map((e) => /* @__PURE__ */ s(M, {
238
- title: e.disabled ? "该数据集下不存在未标注的数据" : "当前数据集版本下所有未标注的数据",
239
- children: /* @__PURE__ */ s(q, {
240
- value: e.value,
241
- disabled: e.disabled,
242
- children: e.label
233
+ }), /* @__PURE__ */ l(v.Item, {
234
+ label: "处理范围",
235
+ name: "data",
236
+ rules: [{
237
+ required: !0,
238
+ message: "请选择数据"
239
+ }],
240
+ initialValue: "nolabel",
241
+ children: /* @__PURE__ */ l(M.Group, {
242
+ disabled: (t == null ? void 0 : t.state) === p.Started,
243
+ children: q.map((e) => /* @__PURE__ */ l(G, {
244
+ title: e.disabled ? "该数据集下不存在未标注的数据" : "当前数据集版本下所有未标注的数据",
245
+ children: /* @__PURE__ */ l(M, {
246
+ value: e.value,
247
+ disabled: e.disabled,
248
+ children: e.label
249
+ })
250
+ }, e.value))
251
+ })
252
+ }), m === "ocr" && /* @__PURE__ */ l(v.Item, {
253
+ label: "置信度",
254
+ name: "confidence",
255
+ initialValue: 0.6,
256
+ children: /* @__PURE__ */ l(re, {
257
+ min: 0,
258
+ max: 1,
259
+ step: 0.01,
260
+ disabled: (t == null ? void 0 : t.state) === p.Started
243
261
  })
244
- }, e.value))
262
+ })]
245
263
  })
264
+ }), /* @__PURE__ */ l(ie, {
265
+ serviceId: h == null ? void 0 : h.value,
266
+ confidence: J,
267
+ datasetId: d,
268
+ versionId: r,
269
+ isVisible: P
246
270
  })]
247
271
  })
248
272
  });
249
273
  };
250
274
  export {
251
- be as default
275
+ Se as default
252
276
  };