@glodon-aiot/dataset-annotation 3.14.0-alpha.32 → 3.14.0-alpha.34

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 (26) hide show
  1. package/dist/es/components/VLMAnnotation/RegionItem.mjs +1 -1
  2. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.mjs +193 -0
  3. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +300 -237
  4. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +158 -56
  5. package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +424 -397
  6. package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/AIErrorTooltip.less.mjs +4 -0
  7. package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/index.mjs +24 -0
  8. package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +1 -1
  9. package/dist/es/components/VLMAnnotation/constants.mjs +1 -1
  10. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +217 -167
  11. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +114 -122
  12. package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +445 -0
  13. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +249 -113
  14. package/dist/es/components/VLMAnnotationDetail/index.mjs +219 -213
  15. package/dist/es/index.mjs +1 -1
  16. package/dist/lib/index.js +4 -4
  17. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.d.ts +16 -0
  18. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +2 -1
  19. package/dist/src/components/VLMAnnotation/components/AIErrorTooltip/index.d.ts +8 -0
  20. package/dist/src/components/VLMAnnotation/constants.d.ts +2 -2
  21. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +1 -0
  22. package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +21 -0
  23. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +11 -2
  24. package/package.json +2 -2
  25. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +0 -455
  26. /package/dist/es/components/VLMAnnotationDetail/{MarkVLMBoxModal → VLMDetail}/style.less.mjs +0 -0
@@ -0,0 +1,16 @@
1
+ import { fabric } from 'fabric';
2
+ interface UseAIButtonHoverParams {
3
+ canvas: fabric.Canvas | undefined;
4
+ ocrErrorRef: React.MutableRefObject<Set<string>>;
5
+ rectMapRef: React.MutableRefObject<Map<fabric.Rect, any>>;
6
+ onAIButtonHover?: (regionId: string | null, position: {
7
+ x: number;
8
+ y: number;
9
+ } | null) => void;
10
+ }
11
+ /**
12
+ * Hook for detecting hover on AI button
13
+ * @param params - AI button hover configuration parameters
14
+ */
15
+ export declare const useAIButtonHover: ({ canvas, ocrErrorRef, rectMapRef, onAIButtonHover, }: UseAIButtonHoverParams) => void;
16
+ export {};
@@ -21,6 +21,7 @@ interface UseDrawingModeParams {
21
21
  onRegionSelect?: (region: Region | null) => void;
22
22
  rectMapRef: React.MutableRefObject<Map<fabric.Rect, Region>>;
23
23
  textLayersMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Rect[]>>;
24
+ regionNameTextMapRef: React.MutableRefObject<Map<fabric.Rect, fabric.Text>>;
24
25
  setupBoundaryCheck: (rect: fabric.Rect) => (() => void) | undefined;
25
26
  }
26
27
  /**
@@ -28,7 +29,7 @@ interface UseDrawingModeParams {
28
29
  * @param params - Drawing mode configuration parameters
29
30
  * @returns stopDraw function to stop drawing
30
31
  */
31
- export declare const useDrawingMode: ({ canvas, drawingMode, draggable, setDrawingMode, canvasToImageCoords, labelDefinitions, onChange, cropRegionImage, updateRegionShapeAndImage, performOCRIfNeeded, createDeleteControl, createOCRControl, updateRegionNameText, onRegionChange, onRegionSelect, rectMapRef, textLayersMapRef, setupBoundaryCheck, }: UseDrawingModeParams) => {
32
+ export declare const useDrawingMode: ({ canvas, drawingMode, draggable, setDrawingMode, canvasToImageCoords, labelDefinitions, onChange, cropRegionImage, updateRegionShapeAndImage, performOCRIfNeeded, createDeleteControl, createOCRControl, updateRegionNameText, onRegionChange, onRegionSelect, rectMapRef, textLayersMapRef, regionNameTextMapRef, setupBoundaryCheck, }: UseDrawingModeParams) => {
32
33
  stopDraw: () => void;
33
34
  };
34
35
  export {};
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ interface AIErrorTooltipProps {
3
+ visible: boolean;
4
+ x: number;
5
+ y: number;
6
+ }
7
+ declare const AIErrorTooltip: React.FC<AIErrorTooltipProps>;
8
+ export default AIErrorTooltip;
@@ -84,13 +84,13 @@ export declare const DELETE_ICON_SIZE = 24;
84
84
  /** 删除控件 X 轴偏移(像素) */
85
85
  export declare const DELETE_CONTROL_OFFSET_X = 20;
86
86
  /** 删除控件 Y 轴偏移(像素) */
87
- export declare const DELETE_CONTROL_OFFSET_Y = 24;
87
+ export declare const DELETE_CONTROL_OFFSET_Y = 8;
88
88
  /** AI图标大小(像素) */
89
89
  export declare const AI_ICON_SIZE = 24;
90
90
  /** AI控件 X 轴偏移(像素) */
91
91
  export declare const AI_CONTROL_OFFSET_X = 20;
92
92
  /** AI控件 Y 轴偏移(像素) */
93
- export declare const AI_CONTROL_OFFSET_Y = 24;
93
+ export declare const AI_CONTROL_OFFSET_Y = 8;
94
94
  /** AI控件与删除控件之间的间距(像素) */
95
95
  export declare const AI_DELETE_CONTROL_SPACING = 40;
96
96
  /** 区域名称文本颜色 */
@@ -3,6 +3,7 @@ interface QAGenerationConfigProps {
3
3
  visionId?: string;
4
4
  datasetId?: string;
5
5
  afterChangeTemplates?: () => void;
6
+ onActiveIndexChange?: (index: number) => void;
6
7
  }
7
8
  export interface QAGenerationConfigRef {
8
9
  hasUnsavedChanges: () => boolean;
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ import { IPagination, ISample } from '@glodon-aiot/apis';
3
+ export interface VLMDetailRef {
4
+ handleModalCancel: () => Promise<void>;
5
+ }
6
+ interface VLMDetailProps {
7
+ visible: boolean;
8
+ selectSampleId?: string;
9
+ datasetId?: string;
10
+ versionId?: string;
11
+ onClose: VoidFunction;
12
+ onSave: (record: ISample) => Promise<boolean>;
13
+ filterMode?: string;
14
+ onFilterModeChange?: (mode: string) => void;
15
+ externalSamples?: ISample[];
16
+ externalPagination?: IPagination;
17
+ externalCurrentIndex?: number;
18
+ externalFilterMode?: string;
19
+ }
20
+ declare const VLMDetail: React.ForwardRefExoticComponent<VLMDetailProps & React.RefAttributes<VLMDetailRef>>;
21
+ export default VLMDetail;
@@ -1,9 +1,9 @@
1
1
  import { default as React, Dispatch, SetStateAction } from 'react';
2
- import { ISample } from '@glodon-aiot/apis';
2
+ import { IPagination, ISample } from '@glodon-aiot/apis';
3
3
  interface ImageDetailModalProps {
4
4
  isVlmModalVisible: boolean;
5
5
  setIsVlmModalVisible: Dispatch<SetStateAction<boolean>>;
6
- record: ISample;
6
+ record?: ISample;
7
7
  onNextClick: VoidFunction;
8
8
  onPrevClick: VoidFunction;
9
9
  listLoading?: boolean;
@@ -12,6 +12,15 @@ interface ImageDetailModalProps {
12
12
  ocrMarkTmpl?: string;
13
13
  handleMarkClick: (sampleId?: string) => void;
14
14
  updateSampleList: () => void;
15
+ filterMode?: string;
16
+ onFilterModeChange?: (mode: string) => void;
17
+ samples?: ISample[];
18
+ onSave?: (record: ISample) => Promise<boolean>;
19
+ initialMode?: 'preview' | 'annotation';
20
+ selectSampleId?: string;
21
+ onClose: VoidFunction;
22
+ pagination?: IPagination;
23
+ currentIndex?: number;
15
24
  }
16
25
  declare const VlmModal: React.FC<ImageDetailModalProps>;
17
26
  export default VlmModal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glodon-aiot/dataset-annotation",
3
- "version": "3.14.0-alpha.32",
3
+ "version": "3.14.0-alpha.34",
4
4
  "module": "./dist/es/index.mjs",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "dependencies": {
38
38
  "@ant-design/icons": "^5.3.4",
39
39
  "@aws-crypto/sha256-js": "^3.0.0",
40
- "@glodon-aiot/apis": "^3.14.0-alpha.32",
40
+ "@glodon-aiot/apis": "^3.14.0-alpha.34",
41
41
  "@glodon-aiot/minio": "^0.1.6",
42
42
  "@reduxjs/toolkit": "^1.9.5",
43
43
  "@types/fabric": "^5.3.2",
@@ -1,455 +0,0 @@
1
- var Ge = Object.defineProperty, $e = Object.defineProperties;
2
- var Pe = Object.getOwnPropertyDescriptors;
3
- var Ie = Object.getOwnPropertySymbols;
4
- var je = Object.prototype.hasOwnProperty, Be = Object.prototype.propertyIsEnumerable;
5
- var be = (w, u, o) => u in w ? Ge(w, u, { enumerable: !0, configurable: !0, writable: !0, value: o }) : w[u] = o, U = (w, u) => {
6
- for (var o in u || (u = {}))
7
- je.call(u, o) && be(w, o, u[o]);
8
- if (Ie)
9
- for (var o of Ie(u))
10
- Be.call(u, o) && be(w, o, u[o]);
11
- return w;
12
- }, P = (w, u) => $e(w, Pe(u));
13
- var z = (w, u, o) => new Promise((x, g) => {
14
- var J = (q) => {
15
- try {
16
- r(o.next(q));
17
- } catch (E) {
18
- g(E);
19
- }
20
- }, R = (q) => {
21
- try {
22
- r(o.throw(q));
23
- } catch (E) {
24
- g(E);
25
- }
26
- }, r = (q) => q.done ? x(q.value) : Promise.resolve(q.value).then(J, R);
27
- r((o = o.apply(w, u)).next());
28
- });
29
- import { jsx as l, jsxs as B, Fragment as Ee } from "react/jsx-runtime";
30
- import { Modal as ke, Space as Ae, Button as te, message as N, Tabs as de, Spin as Fe } from "antd";
31
- import { useContext as Qe, useRef as j, useState as m, useEffect as W } from "react";
32
- import "./style.less.mjs";
33
- import Ke from "../../DataEmpty/index.mjs";
34
- import Oe from "../../../DatasetContext/index.mjs";
35
- import He from "./AttributeDetail/index.mjs";
36
- import We from "./QADetail/index.mjs";
37
- import Je from "../../VLMAnnotation/index.mjs";
38
- import Xe from "axios";
39
- const {
40
- TabPane: K
41
- } = de, lt = (w) => {
42
- const {
43
- visible: u,
44
- selectSampleId: o,
45
- datasetId: x,
46
- versionId: g,
47
- // vmlMarkTmpl,
48
- onClose: J,
49
- onSave: R
50
- } = w, {
51
- services: {
52
- cvforceDatahub: r
53
- },
54
- token: q,
55
- apiUrl: E
56
- } = Qe(Oe), F = j(null);
57
- j(null), j({});
58
- const [i, I] = m(), C = j(void 0), [Ye, fe] = m(0), [y, G] = m([]), [ne, M] = m(-1), [f, T] = m({
59
- current: 1,
60
- pageSize: 100
61
- // 与主列表保持一致
62
- }), [ue, ge] = m(0), [he, pe] = m(0), [b, ie] = m(() => o ? "" : "nocode"), [me, O] = m(), [oe, xe] = m([]), [h, X] = m("textAnnotation"), [Y, Q] = m(), [Z, L] = m(!1), _ = j(0), re = j(0), [se, De] = m(!1), [ye, ee] = m(!1), [ae, ce] = m(!1), [Se, Ce] = m(!1), $ = j(null), D = j(null), [Ve, Le] = m(() => Date.now()), [ze, Ne] = m(() => Date.now());
63
- W(() => {
64
- u && (!x || !g || r == null || r.getDatasetsIdVersionsVidConfigs(x, g).then((e) => {
65
- xe(e || []), (e == null ? void 0 : e.length) > 0 ? X("textAnnotation") : X("attributeDefinition");
66
- }));
67
- }, [u]), W(() => {
68
- const e = f.current || 1, t = f.pageSize || 100, n = f.type;
69
- if (!x || !g)
70
- return;
71
- const a = ++_.current;
72
- ce(!0);
73
- const p = y || [], s = o || me;
74
- r == null || r.getDatasetsIdVersionsVidSamples(x, g, {
75
- labels: b ? [b] : void 0,
76
- pageNo: e,
77
- pageSize: t
78
- }).then((k) => {
79
- if (a !== _.current)
80
- return;
81
- const d = k.recordList || [], c = e === 1 && !n ? d : n === "prev" ? [...d, ...p] : n === "next" ? [...p, ...d] : d;
82
- G(c), T(P(U({}, f), {
83
- current: e,
84
- pageSize: t,
85
- total: k.totalResults,
86
- type: void 0
87
- }));
88
- let v = 0, S = c[0];
89
- if (n === "next" && d.length)
90
- v = p.length, S = d[0];
91
- else if (n === "prev" && d.length)
92
- v = d.length - 1, S = d[d.length - 1];
93
- else if (s) {
94
- const A = c.findIndex((H) => H.id === s);
95
- if (A !== -1)
96
- v = A, S = c[A];
97
- else {
98
- r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, g, s).then((H) => {
99
- a === _.current && H && (G([H, ...c]), I(H), M(0), fe(c.length + 1), O(void 0));
100
- });
101
- return;
102
- }
103
- }
104
- S && (I(S), M(v), fe(c.length), me && O(void 0));
105
- }).finally(() => {
106
- a === _.current && ce(!1);
107
- }), V();
108
- }, [f.current, b, x, g]);
109
- const V = () => {
110
- !x || !g || r == null || r.getDatasetsIdVersionsVidLabelcount(x, g).then((e) => {
111
- const t = e.find((a) => a.id === "allcodeid"), n = e.find((a) => a.id === "nocodeid");
112
- ge(t ? t.count : 0), pe(n ? n.count : 0);
113
- });
114
- }, le = () => {
115
- y && G((e) => {
116
- var k, d, c, v;
117
- const t = C.current || i, n = [...e];
118
- let a;
119
- if (t) {
120
- const S = n.findIndex((A) => A.id === t.id);
121
- S > -1 && n.splice(S, 1, t);
122
- }
123
- const p = !t || (k = t.labels) != null && k.length && b === "hascode" || !((d = t.labels) != null && d.length) && b === "nocode" || b === "" ? ne + 1 : ne;
124
- if (t && ((c = t.labels) != null && c.length && b === "nocode" || !((v = t.labels) != null && v.length) && b === "hascode")) {
125
- const S = n.findIndex((A) => A.id === t.id);
126
- S > -1 && (n.splice(S, 1), a = [...n], T((A) => P(U({}, A), {
127
- total: A.total ? A.total - 1 : A.total
128
- })));
129
- }
130
- const s = a || n;
131
- if (p >= s.length) {
132
- const S = (f.current - 1) * f.pageSize + p;
133
- f.total && S >= f.total ? N.error("已经是最后一个了") : T({
134
- current: f.current + 1,
135
- pageSize: f.pageSize,
136
- type: "next"
137
- });
138
- } else
139
- setTimeout(() => {
140
- M(p);
141
- const S = s[p];
142
- I(S);
143
- }, 0);
144
- return s;
145
- });
146
- }, ve = () => {
147
- var s, k;
148
- if (!y)
149
- return;
150
- const e = C.current || i, t = [...y];
151
- let n;
152
- if (e && y) {
153
- const d = t.findIndex((c) => c.id === e.id);
154
- if (d > -1 && t.splice(d, 1, e), (s = e.labels) != null && s.length && b === "nocode" || !((k = e.labels) != null && k.length) && b === "hascode") {
155
- const c = t.findIndex((v) => v.id === e.id);
156
- c > -1 && (t.splice(c, 1), n = [...t], T((v) => P(U({}, v), {
157
- total: v.total ? v.total - 1 : v.total
158
- })));
159
- }
160
- }
161
- const a = n || t, p = ne - 1;
162
- if (p < 0)
163
- (f.current - 1) * f.pageSize + p < 0 ? N.error("已经是第一个了") : T({
164
- current: f.current - 1,
165
- pageSize: f.pageSize,
166
- type: "prev"
167
- });
168
- else {
169
- M(p);
170
- const d = a[p];
171
- I(d);
172
- }
173
- n && G(n);
174
- };
175
- W(() => {
176
- if (!u || !x || !g || !i)
177
- return;
178
- const e = ++re.current;
179
- Ce(!0), r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, g, i.id).then((t) => {
180
- e === re.current && I(t);
181
- }).finally(() => {
182
- e === re.current && Ce(!1);
183
- });
184
- }, [u, i == null ? void 0 : i.id]);
185
- const Re = () => z(void 0, null, function* () {
186
- h === "attributeDefinition" && $.current && !(yield $.current.checkDirtyAndConfirm()) || h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()) || J();
187
- });
188
- W(() => {
189
- F.current && (F.current.width = F.current.offsetWidth, F.current.height = F.current.offsetHeight);
190
- }, [F.current]);
191
- const qe = () => z(void 0, null, function* () {
192
- if (Z)
193
- return;
194
- if (L(!0), h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm())) {
195
- L(!1);
196
- return;
197
- }
198
- const e = C.current || i;
199
- if (!e) {
200
- L(!1);
201
- return;
202
- }
203
- console.log("onPrevClick sampleToUse", e), h === "textAnnotation" && Y ? (ee(!0), R(e).then((t) => {
204
- t ? (Q(void 0), ve(), V()) : N.error("保存失败");
205
- }).finally(() => {
206
- ee(!1), L(!1);
207
- })) : (ve(), L(!1));
208
- }), Me = () => z(void 0, null, function* () {
209
- if (Z)
210
- return;
211
- if (L(!0), h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm())) {
212
- L(!1);
213
- return;
214
- }
215
- const e = C.current || i;
216
- if (!e) {
217
- L(!1);
218
- return;
219
- }
220
- console.log("onNextClick sampleToUse", e), h === "textAnnotation" && Y ? (ee(!0), R(e).then((t) => {
221
- t ? (Q(void 0), le(), V()) : N.error("保存失败");
222
- }).finally(() => {
223
- ee(!1), L(!1);
224
- })) : (le(), L(!1));
225
- });
226
- W(() => {
227
- C.current = i;
228
- }, [i]);
229
- const Te = (e) => (console.log("ocrRecognize apiUrl", E), Xe.post(`${E}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
230
- pages: [{
231
- image: e,
232
- no: 0
233
- }]
234
- }, {
235
- headers: {
236
- Authorization: `Bearer ${q}`
237
- }
238
- }).then((t) => (console.log("ocrRecognize res", t.data.data), t.data.data.pages[0].layout.filter((a) => a.content))).catch((t) => {
239
- console.error("ocrRecognize error", t);
240
- })), Ue = () => z(void 0, null, function* () {
241
- const e = C.current || i;
242
- !e || !x || !g || ke.confirm({
243
- title: "确认要删除此数据吗?",
244
- content: "删除后不可恢复,请慎重操作",
245
- onOk: () => z(void 0, null, function* () {
246
- console.log("handleDeleteClick currentSample", e);
247
- try {
248
- yield r == null ? void 0 : r.delDatasetsIdVersionsVidSamplesId(x, g, e.id), N.success("删除成功"), o ? J() : G((t) => {
249
- var d;
250
- const n = t.findIndex((c) => c.id === e.id);
251
- if (n === -1)
252
- return t;
253
- const a = [...t.slice(0, n), ...t.slice(n + 1)], p = f.pageSize || 1, s = Math.max(((d = f.total) != null ? d : t.length) - 1, 0), k = a.length === 0 && s > f.current * p;
254
- if (T((c) => U(P(U({}, c), {
255
- total: s
256
- }), k ? {
257
- current: c.current + 1,
258
- pageSize: p,
259
- type: "next"
260
- } : {
261
- type: k ? "next" : void 0
262
- })), a.length) {
263
- const c = Math.min(n, a.length - 1);
264
- M(c), I(a[c]);
265
- } else
266
- M(-1), I(void 0);
267
- return a;
268
- }), V();
269
- } catch (t) {
270
- N.error("删除失败");
271
- }
272
- })
273
- });
274
- }), we = () => z(void 0, null, function* () {
275
- if (!x || !g || !(i != null && i.id))
276
- return;
277
- const e = yield r == null ? void 0 : r.getDatasetsIdVersionsVidSsamplesSid(x, g, i.id);
278
- e && (I(e), C.current = e);
279
- });
280
- return /* @__PURE__ */ l(ke, {
281
- title: "标注",
282
- width: "100%",
283
- wrapClassName: "vlm-modal-wrap",
284
- className: "vlm-modal",
285
- open: u,
286
- destroyOnClose: !0,
287
- onCancel: () => Re(),
288
- maskClosable: !1,
289
- keyboard: !1,
290
- centered: !0,
291
- footer: h !== "attributeDefinition" ? /* @__PURE__ */ B("div", {
292
- style: {
293
- display: "flex",
294
- justifyContent: "space-between",
295
- alignItems: "center"
296
- },
297
- children: [/* @__PURE__ */ l("div", {
298
- style: {
299
- flex: 1
300
- }
301
- }), /* @__PURE__ */ B(Ae, {
302
- size: 24,
303
- children: [!o && (y == null ? void 0 : y.length) > 0 && /* @__PURE__ */ l(te, {
304
- type: "default",
305
- disabled: Se || ae || ye || Z,
306
- onClick: qe,
307
- children: "上一张"
308
- }, "prev"), !o && (y == null ? void 0 : y.length) > 0 && /* @__PURE__ */ l(te, {
309
- type: "default",
310
- disabled: Se || ae || ye || Z,
311
- onClick: Me,
312
- children: "下一张"
313
- }, "next")]
314
- }), /* @__PURE__ */ l("div", {
315
- style: {
316
- flex: 1,
317
- display: "flex",
318
- justifyContent: "flex-end"
319
- },
320
- children: /* @__PURE__ */ l(Ae, {
321
- children: h === "textAnnotation" && (y == null ? void 0 : y.length) > 0 ? /* @__PURE__ */ B(Ee, {
322
- children: [/* @__PURE__ */ l(te, {
323
- disabled: !i,
324
- type: "primary",
325
- onClick: () => {
326
- const e = C.current || i;
327
- e && (console.log("save currentSample", e), R(e).then((t) => z(void 0, null, function* () {
328
- t ? (N.success("保存成功"), Q(void 0), o ? yield we() : le(), V()) : N.error("保存失败");
329
- })));
330
- },
331
- children: "保存标注"
332
- }, "save"), /* @__PURE__ */ l(te, {
333
- type: "default",
334
- onClick: Ue,
335
- children: "删除数据"
336
- })]
337
- }) : null
338
- })
339
- })]
340
- }) : null,
341
- children: /* @__PURE__ */ B("div", {
342
- className: "vlm-records-content",
343
- children: [/* @__PURE__ */ l("div", {
344
- className: "records-content-tabs-container",
345
- children: !o && /* @__PURE__ */ B(de, {
346
- className: "records-content-tabs",
347
- activeKey: b,
348
- onChange: (e) => z(void 0, null, function* () {
349
- var n, a, p;
350
- let t = !1;
351
- if (!(h === "attributeDefinition" && $.current && (t = !!((a = (n = $.current).hasUnsavedChanges) != null && a.call(n)), !(yield $.current.checkDirtyAndConfirm()))) && !(h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()))) {
352
- if (h === "textAnnotation" && Y) {
353
- const s = C.current || i;
354
- if (s && R) {
355
- if (!(yield R(s))) {
356
- N.error("保存失败,已阻止切换筛选");
357
- return;
358
- }
359
- I(s), C.current = s, Q(void 0), V == null || V(), !o && b === "nocode" && ((p = s == null ? void 0 : s.labels) != null && p.length) && (G([]), I(s), M(-1), O(s.id), T(P(U({}, f), {
360
- current: 1,
361
- total: void 0,
362
- type: void 0
363
- })), ie("hascode"));
364
- }
365
- }
366
- t && Le(Date.now()), Ne(Date.now()), h !== "attributeDefinition" && (ce(!0), G([]), I(void 0), M(-1), O(void 0)), T(P(U({}, f), {
367
- current: 1,
368
- total: void 0,
369
- type: void 0
370
- })), ie(e);
371
- }
372
- }),
373
- children: [/* @__PURE__ */ l(K, {
374
- tab: `全部(${ue})`
375
- }, ""), /* @__PURE__ */ l(K, {
376
- tab: `未标注(${he})`
377
- }, "nocode"), /* @__PURE__ */ l(K, {
378
- tab: `已标注(${ue - he})`
379
- }, "hascode")]
380
- })
381
- }), y != null && y.length ? /* @__PURE__ */ B("div", {
382
- className: "sample-detail",
383
- children: [/* @__PURE__ */ l("div", {
384
- className: "content-mode-buttons",
385
- children: /* @__PURE__ */ B(de, {
386
- activeKey: h,
387
- onChange: (e) => z(void 0, null, function* () {
388
- var t;
389
- if (!(h === "attributeDefinition" && $.current && !(yield $.current.checkDirtyAndConfirm())) && !(h === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()))) {
390
- if (h === "textAnnotation" && R && Y && (C.current || i)) {
391
- const n = C.current || i;
392
- if (!(yield R(n))) {
393
- N.error("保存失败,已阻止切换页签");
394
- return;
395
- }
396
- I(n), C.current = n, Q(void 0), V == null || V(), !o && b === "nocode" && ((t = n == null ? void 0 : n.labels) != null && t.length) && (G([]), I(n), M(-1), O(n.id), T(P(U({}, f), {
397
- current: 1,
398
- total: void 0,
399
- type: void 0
400
- })), ie("hascode"));
401
- }
402
- e === "textAnnotation" && (i != null && i.id) && (yield we()), X(e);
403
- }
404
- }),
405
- children: [/* @__PURE__ */ l(K, {
406
- tab: "属性定义",
407
- disabled: se
408
- }, "attributeDefinition"), /* @__PURE__ */ l(K, {
409
- tab: "文本标注",
410
- disabled: se
411
- }, "textAnnotation"), /* @__PURE__ */ l(K, {
412
- tab: "QA生成",
413
- disabled: se
414
- }, "qaGeneration")]
415
- })
416
- }), h === "textAnnotation" && i && /* @__PURE__ */ l("div", {
417
- className: "container",
418
- children: /* @__PURE__ */ l(Je, {
419
- sample: i,
420
- labelDefinitions: oe,
421
- onChange: (e) => {
422
- console.log("VLMAnnotation onChange", e), C.current = e, Q(e);
423
- },
424
- ocrRecognize: Te
425
- })
426
- }), h === "attributeDefinition" && /* @__PURE__ */ l(He, {
427
- ref: $,
428
- datasetId: x,
429
- versionId: g,
430
- onAttributesChange: (e) => {
431
- xe(e), e.length > 0 && oe.length === 0 && X("textAnnotation");
432
- },
433
- onLoadingChange: (e) => {
434
- De(e);
435
- }
436
- }, `attribute-${Ve}`), h === "qaGeneration" && /* @__PURE__ */ l(We, {
437
- ref: D,
438
- sample: i,
439
- labels: oe,
440
- datasetId: x,
441
- visionId: g
442
- }, `qa-${ze}`)]
443
- }) : ae ? /* @__PURE__ */ l("div", {
444
- style: {
445
- padding: "48px 0",
446
- textAlign: "center"
447
- },
448
- children: /* @__PURE__ */ l(Fe, {})
449
- }) : /* @__PURE__ */ l(Ke, {})]
450
- })
451
- });
452
- };
453
- export {
454
- lt as default
455
- };