@glodon-aiot/dataset-annotation 3.14.0-alpha.33 → 3.15.0-alpha.2

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 (119) hide show
  1. package/dist/es/DatasetContext/index.mjs +3 -6
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +91 -94
  3. package/dist/es/components/DetectionAnnotation/components/LabelMaker/Drawable.mjs +28 -37
  4. package/dist/es/components/DetectionAnnotation/components/LabelMaker/RectLabel.mjs +101 -145
  5. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +195 -256
  6. package/dist/es/components/DetectionAnnotation/index.mjs +424 -456
  7. package/dist/es/components/Iconfont/index.mjs +2 -2
  8. package/dist/es/components/OcrAnnotation/MarkKVOCRModal/KVOCRLabelMaker/index.mjs +1 -1
  9. package/dist/es/components/OcrAnnotation/MarkOCRBoxModal/OCRBoxMaker/index.mjs +1 -1
  10. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +45 -43
  11. package/dist/es/components/PicZipImportModal/index.mjs +293 -308
  12. package/dist/es/components/PreLabelOCR/index.mjs +1 -1
  13. package/dist/es/constant.mjs +3 -3
  14. package/dist/es/featuresConfig.mjs +9 -13
  15. package/dist/es/index.mjs +7 -11
  16. package/dist/lib/index.js +3 -4
  17. package/dist/src/DatasetContext/index.d.ts +0 -2
  18. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +0 -1
  19. package/dist/src/constant.d.ts +1 -1
  20. package/dist/src/featuresConfig.d.ts +0 -4
  21. package/dist/src/index.d.ts +0 -3
  22. package/package.json +2 -2
  23. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +0 -129
  24. package/dist/es/components/DetectionAnnotation/components/ImageModal/style.less.mjs +0 -4
  25. package/dist/es/components/PicZipImportModal/config.mjs +0 -47
  26. package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +0 -4
  27. package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +0 -4
  28. package/dist/es/components/VLMAnnotation/RegionItem.mjs +0 -170
  29. package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +0 -94
  30. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.mjs +0 -193
  31. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +0 -116
  32. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +0 -115
  33. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +0 -42
  34. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +0 -55
  35. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +0 -51
  36. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +0 -62
  37. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +0 -484
  38. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.mjs +0 -100
  39. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +0 -106
  40. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +0 -101
  41. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.mjs +0 -103
  42. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +0 -38
  43. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +0 -173
  44. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +0 -72
  45. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +0 -218
  46. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +0 -98
  47. package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +0 -156
  48. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/ai.svg.mjs +0 -4
  49. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +0 -4
  50. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/error.svg.mjs +0 -4
  51. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/loading.svg.mjs +0 -4
  52. package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/star.svg.mjs +0 -4
  53. package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +0 -678
  54. package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +0 -4
  55. package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +0 -33
  56. package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/AIErrorTooltip.less.mjs +0 -4
  57. package/dist/es/components/VLMAnnotation/components/AIErrorTooltip/index.mjs +0 -24
  58. package/dist/es/components/VLMAnnotation/components/DragButton.mjs +0 -18
  59. package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +0 -16
  60. package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +0 -30
  61. package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +0 -40
  62. package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +0 -44
  63. package/dist/es/components/VLMAnnotation/constants.mjs +0 -57
  64. package/dist/es/components/VLMAnnotation/index.mjs +0 -279
  65. package/dist/es/components/VLMAnnotation/style.less.mjs +0 -4
  66. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +0 -343
  67. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +0 -4
  68. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +0 -240
  69. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +0 -201
  70. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +0 -4
  71. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +0 -455
  72. package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +0 -4
  73. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +0 -149
  74. package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +0 -4
  75. package/dist/es/components/VLMAnnotationDetail/index.mjs +0 -449
  76. package/dist/es/components/VLMAnnotationDetail/style.less.mjs +0 -4
  77. package/dist/es/createVlmtasetAnnotation/index.mjs +0 -131
  78. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +0 -34
  79. package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
  80. package/dist/src/components/PicZipImportModal/config.d.ts +0 -23
  81. package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +0 -4
  82. package/dist/src/components/VLMAnnotation/RegionItem.d.ts +0 -4
  83. package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +0 -4
  84. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useAIButtonHover.d.ts +0 -16
  85. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +0 -13
  86. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +0 -38
  87. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +0 -18
  88. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +0 -7
  89. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +0 -13
  90. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +0 -22
  91. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +0 -35
  92. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRControl.d.ts +0 -16
  93. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +0 -11
  94. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +0 -29
  95. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionBoundaryCheck.d.ts +0 -31
  96. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +0 -13
  97. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +0 -41
  98. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +0 -12
  99. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +0 -16
  100. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +0 -32
  101. package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +0 -25
  102. package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +0 -4
  103. package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +0 -32
  104. package/dist/src/components/VLMAnnotation/components/AIErrorTooltip/index.d.ts +0 -8
  105. package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +0 -7
  106. package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +0 -6
  107. package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +0 -7
  108. package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +0 -4
  109. package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +0 -4
  110. package/dist/src/components/VLMAnnotation/constants.d.ts +0 -113
  111. package/dist/src/components/VLMAnnotation/index.d.ts +0 -6
  112. package/dist/src/components/VLMAnnotation/types.d.ts +0 -187
  113. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +0 -14
  114. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +0 -12
  115. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +0 -12
  116. package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +0 -12
  117. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +0 -17
  118. package/dist/src/components/VLMAnnotationDetail/index.d.ts +0 -6
  119. package/dist/src/createVlmtasetAnnotation/index.d.ts +0 -16
@@ -1,201 +0,0 @@
1
- var D = (f, u, i) => new Promise((m, a) => {
2
- var h = (n) => {
3
- try {
4
- d(i.next(n));
5
- } catch (o) {
6
- a(o);
7
- }
8
- }, l = (n) => {
9
- try {
10
- d(i.throw(n));
11
- } catch (o) {
12
- a(o);
13
- }
14
- }, d = (n) => n.done ? m(n.value) : Promise.resolve(n.value).then(h, l);
15
- d((i = i.apply(f, u)).next());
16
- });
17
- import { jsx as e, jsxs as r, Fragment as b } from "react/jsx-runtime";
18
- import { forwardRef as z, useState as g, useRef as O, useContext as _, useImperativeHandle as j, useEffect as S } from "react";
19
- import "./style.less.mjs";
20
- import { Row as E, Col as G, Table as K, Spin as B, Input as R } from "antd";
21
- import F from "./QAGenerationConfig.mjs";
22
- import H from "../../../Iconfont/index.mjs";
23
- import { LoadingOutlined as V } from "@ant-design/icons";
24
- import J from "../../../../DatasetContext/index.mjs";
25
- const M = z((f, u) => {
26
- var w, A;
27
- const {
28
- sample: i,
29
- visionId: m,
30
- labels: a,
31
- datasetId: h
32
- } = f, [l, d] = g([]), [n, o] = g([]), [L, p] = g(!1), v = O(null), {
33
- services: {
34
- cvforceDatahub: N
35
- }
36
- } = _(J);
37
- j(u, () => ({
38
- checkDirtyAndConfirm: () => D(void 0, null, function* () {
39
- return v.current ? yield v.current.checkDirtyAndConfirm() : !0;
40
- })
41
- })), S(() => {
42
- const t = (i == null ? void 0 : i.labels) || [];
43
- if (t.length && (a != null && a.length)) {
44
- const s = t.map((c, I) => {
45
- var Q, q;
46
- const x = {
47
- id: (Q = c.id) != null ? Q : String(I),
48
- regionId: (q = c.id) != null ? q : String(I),
49
- shape: c.shape
50
- }, T = c.content || {};
51
- return a.forEach((C) => {
52
- x[C.id] = T[C.id] || "-";
53
- }), x;
54
- });
55
- d(s);
56
- } else
57
- d([]), o([]);
58
- }, [i == null ? void 0 : i.labels, a]), S(() => {
59
- l.length && y();
60
- }, [l]);
61
- const k = [{
62
- title: "序号",
63
- key: "index",
64
- width: 80,
65
- fixed: "left",
66
- render: (t, s, c) => c + 1
67
- }, ...(a || []).map((t) => ({
68
- title: t.name,
69
- dataIndex: t.id,
70
- key: t.id,
71
- width: 150,
72
- render: (s) => /* @__PURE__ */ e("span", {
73
- children: s || "-"
74
- })
75
- }))], y = () => {
76
- p(!0), !(!h || !m || !(i != null && i.id)) && (N == null || N.postGenerateVlmKieQa(h, m, {
77
- sampleIds: [i.id]
78
- }).then((t) => {
79
- console.log("QA生成结果:", t), o(t), p(!1);
80
- }).catch((t) => {
81
- console.error("QA生成失败:", t), p(!1);
82
- }));
83
- };
84
- return /* @__PURE__ */ r("div", {
85
- className: "qa-detail",
86
- children: [/* @__PURE__ */ r(E, {
87
- className: "infos",
88
- gutter: 48,
89
- children: [/* @__PURE__ */ e(G, {
90
- span: 12,
91
- children: /* @__PURE__ */ r("div", {
92
- className: "info-item",
93
- children: [/* @__PURE__ */ e("div", {
94
- className: "info-item-header",
95
- children: /* @__PURE__ */ e("div", {
96
- className: "info-item-title",
97
- children: "标注信息预览"
98
- })
99
- }), /* @__PURE__ */ e("div", {
100
- className: "info-item-content table-wrapper",
101
- children: /* @__PURE__ */ e(K, {
102
- columns: k,
103
- dataSource: l,
104
- rowKey: "id",
105
- pagination: !1,
106
- size: "small",
107
- scroll: {
108
- y: "100%"
109
- }
110
- })
111
- })]
112
- })
113
- }), /* @__PURE__ */ e(G, {
114
- span: 12,
115
- children: /* @__PURE__ */ e(F, {
116
- ref: v,
117
- datasetId: h,
118
- visionId: m,
119
- afterChangeTemplates: () => {
120
- l.length && y();
121
- }
122
- })
123
- })]
124
- }), /* @__PURE__ */ r("div", {
125
- className: "qa-result",
126
- children: [/* @__PURE__ */ r("div", {
127
- className: "info-item-header",
128
- children: [/* @__PURE__ */ e("div", {
129
- className: "info-item-title",
130
- children: "QA生成结果预览"
131
- }), L ? /* @__PURE__ */ e(B, {
132
- indicator: /* @__PURE__ */ e(V, {
133
- spin: !0,
134
- style: {
135
- fontSize: 16
136
- }
137
- })
138
- }) : /* @__PURE__ */ e(H, {
139
- type: "icon-finish",
140
- style: {
141
- fontSize: 16,
142
- color: "#9c24f2"
143
- }
144
- })]
145
- }), /* @__PURE__ */ e("div", {
146
- className: "result",
147
- children: n.length > 0 ? /* @__PURE__ */ e(b, {
148
- children: (A = (w = n[0]) == null ? void 0 : w.qas) != null && A.length ? n[0].qas.map((t, s) => /* @__PURE__ */ r("div", {
149
- className: "result-item-container",
150
- style: {
151
- borderBottom: s === n[0].qas.length - 1 ? "none" : "1px solid #D8D8D8"
152
- },
153
- children: [/* @__PURE__ */ e("div", {
154
- className: "result-item-header",
155
- children: /* @__PURE__ */ e("div", {
156
- className: "result-item-title",
157
- children: t.name
158
- })
159
- }), /* @__PURE__ */ r("div", {
160
- className: "result-item-content",
161
- children: [/* @__PURE__ */ e("div", {
162
- className: "label",
163
- children: "问题"
164
- }), /* @__PURE__ */ e("div", {
165
- className: "value",
166
- children: /* @__PURE__ */ e(R.TextArea, {
167
- value: t.q,
168
- readOnly: !0,
169
- rows: 2
170
- })
171
- })]
172
- }), /* @__PURE__ */ r("div", {
173
- className: "result-item-content",
174
- children: [/* @__PURE__ */ e("div", {
175
- className: "label",
176
- children: "回答"
177
- }), /* @__PURE__ */ e("div", {
178
- className: "value",
179
- children: /* @__PURE__ */ e(R.TextArea, {
180
- value: t.a,
181
- readOnly: !0,
182
- rows: 2
183
- })
184
- })]
185
- })]
186
- }, s)) : /* @__PURE__ */ e("div", {
187
- className: "result-empty",
188
- children: "暂无结果"
189
- })
190
- }) : /* @__PURE__ */ e("div", {
191
- className: "result-empty",
192
- children: "暂无结果"
193
- })
194
- })]
195
- })]
196
- });
197
- });
198
- M.displayName = "QADetail";
199
- export {
200
- M as default
201
- };
@@ -1,4 +0,0 @@
1
- const t = "";
2
- export {
3
- t as default
4
- };
@@ -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
- };
@@ -1,4 +0,0 @@
1
- const t = "";
2
- export {
3
- t as default
4
- };