@glodon-aiot/dataset-annotation 3.9.0-beta.9 → 3.10.0-alpha.11

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.
Files changed (98) hide show
  1. package/dist/es/DatasetContext/index.mjs +6 -3
  2. package/dist/es/components/Iconfont/index.mjs +2 -2
  3. package/dist/es/components/PicZipImportModal/config.mjs +41 -0
  4. package/dist/es/components/PicZipImportModal/index.mjs +317 -301
  5. package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +4 -0
  6. package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +4 -0
  7. package/dist/es/components/VLMAnnotation/RegionItem.mjs +95 -0
  8. package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +83 -0
  9. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +75 -0
  10. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +115 -0
  11. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +42 -0
  12. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +55 -0
  13. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +51 -0
  14. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +47 -0
  15. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +220 -0
  16. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +106 -0
  17. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +68 -0
  18. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +38 -0
  19. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +141 -0
  20. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +72 -0
  21. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +102 -0
  22. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +103 -0
  23. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +156 -0
  24. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +4 -0
  25. package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +507 -0
  26. package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +4 -0
  27. package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +33 -0
  28. package/dist/es/components/VLMAnnotation/components/DragButton.mjs +18 -0
  29. package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +16 -0
  30. package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +30 -0
  31. package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +40 -0
  32. package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +44 -0
  33. package/dist/es/components/VLMAnnotation/constants.mjs +50 -0
  34. package/dist/es/components/VLMAnnotation/index.mjs +242 -0
  35. package/dist/es/components/VLMAnnotation/style.less.mjs +4 -0
  36. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +345 -0
  37. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +4 -0
  38. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +240 -0
  39. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +201 -0
  40. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +4 -0
  41. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +399 -0
  42. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +4 -0
  43. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +139 -0
  44. package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +4 -0
  45. package/dist/es/components/VLMAnnotationDetail/index.mjs +446 -0
  46. package/dist/es/components/VLMAnnotationDetail/style.less.mjs +4 -0
  47. package/dist/es/constant.mjs +3 -3
  48. package/dist/es/createVlmtasetAnnotation/index.mjs +131 -0
  49. package/dist/es/featuresConfig.mjs +13 -9
  50. package/dist/es/index.mjs +11 -7
  51. package/dist/lib/index.js +4 -3
  52. package/dist/src/DatasetContext/index.d.ts +2 -0
  53. package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
  54. package/dist/src/components/PicZipImportModal/config.d.ts +20 -0
  55. package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +4 -0
  56. package/dist/src/components/VLMAnnotation/RegionItem.d.ts +4 -0
  57. package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +4 -0
  58. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +12 -0
  59. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +38 -0
  60. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +18 -0
  61. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +7 -0
  62. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +13 -0
  63. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +21 -0
  64. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +31 -0
  65. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +11 -0
  66. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +28 -0
  67. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +13 -0
  68. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +37 -0
  69. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +12 -0
  70. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +15 -0
  71. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +32 -0
  72. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +25 -0
  73. package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +4 -0
  74. package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +32 -0
  75. package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +7 -0
  76. package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +6 -0
  77. package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +7 -0
  78. package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +4 -0
  79. package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +4 -0
  80. package/dist/src/components/VLMAnnotation/constants.d.ts +97 -0
  81. package/dist/src/components/VLMAnnotation/index.d.ts +6 -0
  82. package/dist/src/components/VLMAnnotation/types.d.ts +172 -0
  83. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +14 -0
  84. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/ImageDetail/index.d.ts +16 -0
  85. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +12 -0
  86. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +21 -0
  87. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LableEditor.d.ts +16 -0
  88. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/index.d.ts +19 -0
  89. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +12 -0
  90. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +12 -0
  91. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +12 -0
  92. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +16 -0
  93. package/dist/src/components/VLMAnnotationDetail/index.d.ts +6 -0
  94. package/dist/src/constant.d.ts +1 -1
  95. package/dist/src/createVlmtasetAnnotation/index.d.ts +16 -0
  96. package/dist/src/featuresConfig.d.ts +4 -0
  97. package/dist/src/index.d.ts +3 -0
  98. package/package.json +2 -2
@@ -0,0 +1,399 @@
1
+ var we = Object.defineProperty, ve = Object.defineProperties;
2
+ var ke = Object.getOwnPropertyDescriptors;
3
+ var le = Object.getOwnPropertySymbols;
4
+ var Ie = Object.prototype.hasOwnProperty, be = Object.prototype.propertyIsEnumerable;
5
+ var de = (x, c, o) => c in x ? we(x, c, { enumerable: !0, configurable: !0, writable: !0, value: o }) : x[c] = o, j = (x, c) => {
6
+ for (var o in c || (c = {}))
7
+ Ie.call(c, o) && de(x, o, c[o]);
8
+ if (le)
9
+ for (var o of le(c))
10
+ be.call(c, o) && de(x, o, c[o]);
11
+ return x;
12
+ }, B = (x, c) => ve(x, ke(c));
13
+ var M = (x, c, o) => new Promise((f, l) => {
14
+ var H = (z) => {
15
+ try {
16
+ r(o.next(z));
17
+ } catch (U) {
18
+ l(U);
19
+ }
20
+ }, D = (z) => {
21
+ try {
22
+ r(o.throw(z));
23
+ } catch (U) {
24
+ l(U);
25
+ }
26
+ }, r = (z) => z.done ? f(z.value) : Promise.resolve(z.value).then(H, D);
27
+ r((o = o.apply(x, c)).next());
28
+ });
29
+ import { jsx as a, jsxs as R, Fragment as Ae } from "react/jsx-runtime";
30
+ import { Modal as Ve, Space as fe, Button as J, message as V, Tabs as ee } from "antd";
31
+ import { useContext as De, useRef as E, useState as v, useEffect as K } from "react";
32
+ import "./style.less.mjs";
33
+ import ze from "../../DataEmpty/index.mjs";
34
+ import Te from "../../../DatasetContext/index.mjs";
35
+ import Me from "./AttributeDetail/index.mjs";
36
+ import Ne from "./QADetail/index.mjs";
37
+ import Le from "../../VLMAnnotation/index.mjs";
38
+ import qe from "axios";
39
+ const {
40
+ TabPane: Q
41
+ } = ee, Oe = (x) => {
42
+ const {
43
+ visible: c,
44
+ selectSampleId: o,
45
+ datasetId: f,
46
+ versionId: l,
47
+ // vmlMarkTmpl,
48
+ onClose: H,
49
+ onSave: D
50
+ } = x, {
51
+ services: {
52
+ cvforceDatahub: r
53
+ },
54
+ token: z,
55
+ apiUrl: U
56
+ } = De(Te), G = E(null);
57
+ E(null), E({});
58
+ const [n, T] = v(), k = E(void 0), [Re, te] = v(0), [h, $] = v([]), [X, q] = v(-1), [u, N] = v({
59
+ current: 1,
60
+ pageSize: 100
61
+ // 与主列表保持一致
62
+ }), [ne, ie] = v(0), [oe, re] = v(0), [I, ue] = v(() => o ? "" : "nocode"), [Y, se] = v([]), [g, O] = v("textAnnotation"), [W, P] = v(), [Z, he] = v(!1), F = E(null), b = E(null), [ge, pe] = v(() => Date.now());
63
+ K(() => {
64
+ c && (!f || !l || r == null || r.getDatasetsIdVersionsVidConfigs(f, l).then((e) => {
65
+ se(e || []), (e == null ? void 0 : e.length) > 0 ? O("textAnnotation") : O("attributeDefinition");
66
+ }));
67
+ }, [c]), K(() => {
68
+ const e = u.current || 1, t = u.pageSize || 100, i = u.type;
69
+ if (!f || !l)
70
+ return;
71
+ const d = h || [];
72
+ r == null || r.getDatasetsIdVersionsVidSamples(f, l, {
73
+ labels: I ? [I] : void 0,
74
+ pageNo: e,
75
+ pageSize: t
76
+ }).then((s) => {
77
+ const p = s.recordList || [], C = e === 1 && !i ? p : i === "prev" ? [...p, ...d] : i === "next" ? [...d, ...p] : p;
78
+ $(C), N(B(j({}, u), {
79
+ current: e,
80
+ pageSize: t,
81
+ total: s.totalResults,
82
+ type: void 0
83
+ }));
84
+ let S = 0, y = C[0];
85
+ if (i === "next" && p.length)
86
+ S = d.length, y = p[0];
87
+ else if (i === "prev" && p.length)
88
+ S = p.length - 1, y = p[p.length - 1];
89
+ else if (o) {
90
+ const w = C.findIndex((m) => m.id === o);
91
+ if (w !== -1)
92
+ S = w, y = C[w];
93
+ else {
94
+ r == null || r.getDatasetsIdVersionsVidSsamplesSid(f, l, o).then((m) => {
95
+ m && ($([m, ...C]), T(m), q(0), te(C.length + 1));
96
+ });
97
+ return;
98
+ }
99
+ }
100
+ y && (T(y), q(S), te(C.length));
101
+ }), A();
102
+ }, [u.current, I, f, l]);
103
+ const A = () => {
104
+ !f || !l || r == null || r.getDatasetsIdVersionsVidLabelcount(f, l).then((e) => {
105
+ const t = e.find((d) => d.id === "allcodeid"), i = e.find((d) => d.id === "nocodeid");
106
+ ie(t ? t.count : 0), re(i ? i.count : 0);
107
+ });
108
+ }, _ = () => {
109
+ h && $((e) => {
110
+ var C, S, y, w;
111
+ const t = k.current || n, i = [...e];
112
+ let d;
113
+ if (t) {
114
+ const m = i.findIndex((L) => L.id === t.id);
115
+ m > -1 && i.splice(m, 1, t);
116
+ }
117
+ const s = !t || (C = t.labels) != null && C.length && I === "hascode" || !((S = t.labels) != null && S.length) && I === "nocode" || I === "" ? X + 1 : X;
118
+ if (t && ((y = t.labels) != null && y.length && I === "nocode" || !((w = t.labels) != null && w.length) && I === "hascode")) {
119
+ const m = i.findIndex((L) => L.id === t.id);
120
+ m > -1 && (i.splice(m, 1), d = [...i], N((L) => B(j({}, L), {
121
+ total: L.total ? L.total - 1 : L.total
122
+ })));
123
+ }
124
+ const p = d || i;
125
+ if (s >= p.length) {
126
+ const m = (u.current - 1) * u.pageSize + s;
127
+ u.total && m >= u.total ? V.error("已经是最后一个了") : N({
128
+ current: u.current + 1,
129
+ pageSize: u.pageSize,
130
+ type: "next"
131
+ });
132
+ } else
133
+ setTimeout(() => {
134
+ q(s);
135
+ const m = p[s];
136
+ T(m);
137
+ }, 200);
138
+ return p;
139
+ });
140
+ }, ae = () => {
141
+ var p, C;
142
+ if (!h)
143
+ return;
144
+ const e = k.current || n, t = [...h];
145
+ let i;
146
+ if (e && h) {
147
+ const S = t.findIndex((y) => y.id === e.id);
148
+ if (S > -1 && t.splice(S, 1, e), (p = e.labels) != null && p.length && I === "nocode" || !((C = e.labels) != null && C.length) && I === "hascode") {
149
+ const y = t.findIndex((w) => w.id === e.id);
150
+ y > -1 && (t.splice(y, 1), i = [...t], N((w) => B(j({}, w), {
151
+ total: w.total ? w.total - 1 : w.total
152
+ })));
153
+ }
154
+ }
155
+ const d = i || t, s = X - 1;
156
+ if (s < 0)
157
+ (u.current - 1) * u.pageSize + s < 0 ? V.error("已经是第一个了") : N({
158
+ current: u.current - 1,
159
+ pageSize: u.pageSize,
160
+ type: "prev"
161
+ });
162
+ else {
163
+ q(s);
164
+ const S = d[s];
165
+ T(S);
166
+ }
167
+ i && $(i);
168
+ };
169
+ K(() => {
170
+ c && f && l && n && (r == null || r.getDatasetsIdVersionsVidSsamplesSid(f, l, n.id).then((e) => {
171
+ T(e);
172
+ }));
173
+ }, [c, n == null ? void 0 : n.id]);
174
+ const me = () => M(void 0, null, function* () {
175
+ g === "attributeDefinition" && F.current && !(yield F.current.checkDirtyAndConfirm()) || g === "qaGeneration" && b.current && !(yield b.current.checkDirtyAndConfirm()) || H();
176
+ });
177
+ K(() => {
178
+ G.current && (G.current.width = G.current.offsetWidth, G.current.height = G.current.offsetHeight);
179
+ }, [G.current]);
180
+ const xe = () => M(void 0, null, function* () {
181
+ if (g === "qaGeneration" && b.current && !(yield b.current.checkDirtyAndConfirm()))
182
+ return;
183
+ const e = k.current || n;
184
+ e && (console.log("onPrevClick sampleToUse", e), g === "textAnnotation" && W ? D(e).then((t) => {
185
+ t ? (P(void 0), ae(), A()) : V.error("保存失败");
186
+ }) : ae());
187
+ }), Ce = () => M(void 0, null, function* () {
188
+ if (g === "qaGeneration" && b.current && !(yield b.current.checkDirtyAndConfirm()))
189
+ return;
190
+ const e = k.current || n;
191
+ e && (console.log("onNextClick sampleToUse", e), g === "textAnnotation" && W ? D(e).then((t) => {
192
+ t ? (P(void 0), _(), A()) : V.error("保存失败");
193
+ }) : _());
194
+ });
195
+ K(() => {
196
+ k.current = n;
197
+ }, [n]);
198
+ const Se = (e) => (console.log("ocrRecognize apiUrl", U), qe.post(`${U}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
199
+ pages: [{
200
+ image: e,
201
+ no: 0
202
+ }]
203
+ }, {
204
+ headers: {
205
+ Authorization: `Bearer ${z}`
206
+ }
207
+ }).then((t) => (console.log("ocrRecognize res", t.data.data), t.data.data.pages[0].layout.filter((d) => d.content))).catch((t) => {
208
+ console.error("ocrRecognize error", t);
209
+ })), ye = () => M(void 0, null, function* () {
210
+ const e = k.current || n;
211
+ if (!(!e || !f || !l)) {
212
+ console.log("handleDeleteClick currentSample", e);
213
+ try {
214
+ yield r == null ? void 0 : r.delDatasetsIdVersionsVidSamplesId(f, l, e.id), V.success("删除成功"), o ? H() : $((t) => {
215
+ const i = t.findIndex((s) => s.id === e.id);
216
+ if (i === -1)
217
+ return t;
218
+ const d = [...t.slice(0, i), ...t.slice(i + 1)];
219
+ if (N((s) => B(j({}, s), {
220
+ total: s.total ? s.total - 1 : s.total
221
+ })), d.length) {
222
+ const s = Math.min(i, d.length - 1);
223
+ q(s), T(d[s]);
224
+ } else
225
+ q(-1), T(void 0), N({
226
+ current: u.current + 1,
227
+ pageSize: u.pageSize,
228
+ type: "next"
229
+ });
230
+ return d;
231
+ }), A();
232
+ } catch (t) {
233
+ V.error("删除失败");
234
+ }
235
+ }
236
+ }), ce = () => M(void 0, null, function* () {
237
+ if (!f || !l || !(n != null && n.id))
238
+ return;
239
+ const e = yield r == null ? void 0 : r.getDatasetsIdVersionsVidSsamplesSid(f, l, n.id);
240
+ e && (T(e), k.current = e);
241
+ });
242
+ return /* @__PURE__ */ a(Ve, {
243
+ title: "标注",
244
+ width: "100%",
245
+ wrapClassName: "vlm-modal-wrap",
246
+ className: "vlm-modal",
247
+ open: c,
248
+ destroyOnClose: !0,
249
+ onCancel: () => me(),
250
+ maskClosable: !1,
251
+ keyboard: !1,
252
+ centered: !0,
253
+ footer: g !== "attributeDefinition" ? /* @__PURE__ */ R("div", {
254
+ style: {
255
+ display: "flex",
256
+ justifyContent: "space-between",
257
+ alignItems: "center"
258
+ },
259
+ children: [/* @__PURE__ */ a("div", {
260
+ style: {
261
+ flex: 1
262
+ }
263
+ }), /* @__PURE__ */ R(fe, {
264
+ size: 24,
265
+ children: [!o && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ a(J, {
266
+ type: "default",
267
+ onClick: xe,
268
+ children: "上一张"
269
+ }, "prev"), !o && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ a(J, {
270
+ type: "default",
271
+ onClick: Ce,
272
+ children: "下一张"
273
+ }, "next")]
274
+ }), /* @__PURE__ */ a("div", {
275
+ style: {
276
+ flex: 1,
277
+ display: "flex",
278
+ justifyContent: "flex-end"
279
+ },
280
+ children: /* @__PURE__ */ a(fe, {
281
+ children: g === "textAnnotation" && (h == null ? void 0 : h.length) > 0 ? /* @__PURE__ */ R(Ae, {
282
+ children: [/* @__PURE__ */ a(J, {
283
+ disabled: !n,
284
+ type: "primary",
285
+ onClick: () => {
286
+ const e = k.current || n;
287
+ e && (console.log("save currentSample", e), D(e).then((t) => M(void 0, null, function* () {
288
+ t ? (V.success("保存成功"), P(void 0), o ? yield ce() : _(), A()) : V.error("保存失败");
289
+ })));
290
+ },
291
+ children: "保存标注"
292
+ }, "save"), /* @__PURE__ */ a(J, {
293
+ type: "default",
294
+ onClick: ye,
295
+ children: "删除数据"
296
+ })]
297
+ }) : null
298
+ })
299
+ })]
300
+ }) : null,
301
+ children: /* @__PURE__ */ R("div", {
302
+ className: "vlm-records-content",
303
+ children: [/* @__PURE__ */ a("div", {
304
+ className: "records-content-tabs-container",
305
+ children: !o && /* @__PURE__ */ R(ee, {
306
+ className: "records-content-tabs",
307
+ activeKey: I,
308
+ onChange: (e) => M(void 0, null, function* () {
309
+ if (!(g === "qaGeneration" && b.current && !(yield b.current.checkDirtyAndConfirm()))) {
310
+ if (g === "textAnnotation" && W) {
311
+ const t = k.current || n;
312
+ if (t && D) {
313
+ if (!(yield D(t))) {
314
+ V.error("保存失败,已阻止切换筛选");
315
+ return;
316
+ }
317
+ P(void 0), A == null || A();
318
+ }
319
+ }
320
+ pe(Date.now()), $([]), T(void 0), q(-1), N(B(j({}, u), {
321
+ current: 1,
322
+ total: void 0,
323
+ type: void 0
324
+ })), ue(e);
325
+ }
326
+ }),
327
+ children: [/* @__PURE__ */ a(Q, {
328
+ tab: `全部(${ne})`
329
+ }, ""), /* @__PURE__ */ a(Q, {
330
+ tab: `未标注(${oe})`
331
+ }, "nocode"), /* @__PURE__ */ a(Q, {
332
+ tab: `已标注(${ne - oe})`
333
+ }, "hascode")]
334
+ })
335
+ }), h != null && h.length ? /* @__PURE__ */ R("div", {
336
+ className: "sample-detail",
337
+ children: [/* @__PURE__ */ a("div", {
338
+ className: "content-mode-buttons",
339
+ children: /* @__PURE__ */ R(ee, {
340
+ activeKey: g,
341
+ onChange: (e) => M(void 0, null, function* () {
342
+ if (!(g === "attributeDefinition" && F.current && !(yield F.current.checkDirtyAndConfirm())) && !(g === "qaGeneration" && b.current && !(yield b.current.checkDirtyAndConfirm()))) {
343
+ if (g === "textAnnotation" && D && W && (k.current || n)) {
344
+ const t = k.current || n;
345
+ if (!(yield D(t))) {
346
+ V.error("保存失败,已阻止切换页签");
347
+ return;
348
+ }
349
+ P(void 0), A == null || A();
350
+ }
351
+ e === "textAnnotation" && (n != null && n.id) && (yield ce()), O(e);
352
+ }
353
+ }),
354
+ children: [/* @__PURE__ */ a(Q, {
355
+ tab: "属性定义",
356
+ disabled: Z
357
+ }, "attributeDefinition"), /* @__PURE__ */ a(Q, {
358
+ tab: "文本标注",
359
+ disabled: Z
360
+ }, "textAnnotation"), /* @__PURE__ */ a(Q, {
361
+ tab: "QA生成",
362
+ disabled: Z
363
+ }, "qaGeneration")]
364
+ })
365
+ }), g === "textAnnotation" && n && /* @__PURE__ */ a("div", {
366
+ className: "container",
367
+ children: /* @__PURE__ */ a(Le, {
368
+ sample: n,
369
+ labelDefinitions: Y,
370
+ onChange: (e) => {
371
+ console.log("VLMAnnotation onChange", e), k.current = e, P(e);
372
+ },
373
+ ocrRecognize: Se,
374
+ coordinateType: "center"
375
+ })
376
+ }), g === "attributeDefinition" && /* @__PURE__ */ a(Me, {
377
+ ref: F,
378
+ datasetId: f,
379
+ versionId: l,
380
+ onAttributesChange: (e) => {
381
+ se(e), e.length > 0 && Y.length === 0 && O("textAnnotation");
382
+ },
383
+ onLoadingChange: (e) => {
384
+ he(e);
385
+ }
386
+ }), g === "qaGeneration" && /* @__PURE__ */ a(Ne, {
387
+ ref: b,
388
+ sample: n,
389
+ labels: Y,
390
+ datasetId: f,
391
+ visionId: l
392
+ }, `${(n == null ? void 0 : n.id) || "qa"}-${ge}`)]
393
+ }) : /* @__PURE__ */ a(ze, {})]
394
+ })
395
+ });
396
+ };
397
+ export {
398
+ Oe as default
399
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };
@@ -0,0 +1,139 @@
1
+ var k = (h, r, a) => new Promise((c, o) => {
2
+ var m = (l) => {
3
+ try {
4
+ s(a.next(l));
5
+ } catch (d) {
6
+ o(d);
7
+ }
8
+ }, i = (l) => {
9
+ try {
10
+ s(a.throw(l));
11
+ } catch (d) {
12
+ o(d);
13
+ }
14
+ }, s = (l) => l.done ? c(l.value) : Promise.resolve(l.value).then(m, i);
15
+ s((a = a.apply(h, r)).next());
16
+ });
17
+ import { jsxs as p, jsx as e } from "react/jsx-runtime";
18
+ import { useRef as v, useState as u, useContext as R, useEffect as O } from "react";
19
+ import { Modal as N, Button as f, Space as b, message as g } from "antd";
20
+ import "./style.less.mjs";
21
+ import { useKeyPress as M } from "ahooks";
22
+ import j from "../../../DatasetContext/index.mjs";
23
+ import D from "../../VLMAnnotation/index.mjs";
24
+ const q = (h) => {
25
+ const {
26
+ isVlmModalVisible: r,
27
+ setIsVlmModalVisible: a,
28
+ record: c,
29
+ onNextClick: o,
30
+ onPrevClick: m,
31
+ datasetId: i,
32
+ versionId: s,
33
+ ocrMarkTmpl: l,
34
+ handleMarkClick: d,
35
+ updateSampleList: V
36
+ } = h;
37
+ v(null);
38
+ const y = v({});
39
+ u("annotation");
40
+ const [t, x] = u();
41
+ u();
42
+ const {
43
+ services: {
44
+ cvforceDatahub: n
45
+ },
46
+ featuresConfig: {
47
+ datasetManager: C
48
+ } = {
49
+ datasetManager: !1
50
+ }
51
+ } = R(j);
52
+ M("rightarrow", () => {
53
+ o();
54
+ }), M("leftarrow", () => {
55
+ m();
56
+ }), O(() => {
57
+ r && i && s && (n == null || n.getDatasetsIdVersionsVidSsamplesSid(i, s, c.id).then((S) => {
58
+ x(S);
59
+ }));
60
+ }, [r, c]);
61
+ const I = () => {
62
+ a(!1);
63
+ }, w = () => {
64
+ N.confirm({
65
+ title: "确认要删除此数据吗?",
66
+ content: "删除后不可恢复,请慎重操作",
67
+ onOk: () => {
68
+ !i || !s || !(t != null && t.id) || n == null || n.delDatasetsIdVersionsVidSamplesId(i, s, t.id).then(() => {
69
+ g.success("删除成功"), a(!1), V();
70
+ }).catch(() => g.error("删除失败"));
71
+ }
72
+ });
73
+ };
74
+ return /* @__PURE__ */ p(N, {
75
+ title: /* @__PURE__ */ p("div", {
76
+ className: "vlm-sample-detail-title",
77
+ children: [/* @__PURE__ */ e("span", {
78
+ children: "详情"
79
+ }), /* @__PURE__ */ p("div", {
80
+ className: "title-buttons",
81
+ children: [/* @__PURE__ */ e(f, {
82
+ className: "select-prev",
83
+ onClick: () => m(),
84
+ children: "上一张"
85
+ }), /* @__PURE__ */ e(f, {
86
+ className: "select-next",
87
+ onClick: () => o(),
88
+ children: "下一张"
89
+ })]
90
+ })]
91
+ }),
92
+ width: "100%",
93
+ wrapClassName: "vlm-modal-wrap",
94
+ className: "vlm-modal",
95
+ open: r,
96
+ destroyOnClose: !0,
97
+ onCancel: () => I(),
98
+ maskClosable: !1,
99
+ centered: !0,
100
+ footer: null,
101
+ children: [/* @__PURE__ */ e("div", {
102
+ className: "vlm-detail",
103
+ children: /* @__PURE__ */ e("div", {
104
+ className: "detail-content",
105
+ children: /* @__PURE__ */ e("div", {
106
+ className: "select-main",
107
+ ref: y,
108
+ children: t && /* @__PURE__ */ e(D, {
109
+ sample: t,
110
+ labelDefinitions: [],
111
+ hideRightSide: !0,
112
+ readOnly: !0,
113
+ ocrRecognize: () => k(void 0, null, function* () {
114
+ return [];
115
+ }),
116
+ coordinateType: "center"
117
+ })
118
+ })
119
+ })
120
+ }), /* @__PURE__ */ e("div", {
121
+ className: "vlm-mark-action",
122
+ children: /* @__PURE__ */ p(b, {
123
+ children: [/* @__PURE__ */ e(f, {
124
+ type: "primary",
125
+ onClick: () => d(t == null ? void 0 : t.id),
126
+ children: "标注"
127
+ }), C && C.delete && /* @__PURE__ */ e(f, {
128
+ danger: !0,
129
+ type: "ghost",
130
+ onClick: w,
131
+ children: "删除数据"
132
+ })]
133
+ })
134
+ })]
135
+ });
136
+ };
137
+ export {
138
+ q as default
139
+ };
@@ -0,0 +1,4 @@
1
+ const t = "";
2
+ export {
3
+ t as default
4
+ };