@glodon-aiot/dataset-annotation 3.16.0-alpha.37 → 3.16.0-alpha.39

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