@glodon-aiot/dataset-annotation 3.9.0-beta.9 → 3.10.0-alpha.10
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.
- package/dist/dataset-annotation.js +123598 -0
- package/dist/dataset-annotation.umd.cjs +1017 -0
- package/dist/es/DatasetContext/index.mjs +6 -3
- package/dist/es/components/Iconfont/index.mjs +2 -2
- package/dist/es/components/PicZipImportModal/config.mjs +41 -0
- package/dist/es/components/PicZipImportModal/index.mjs +317 -301
- package/dist/es/components/PicZipImportModal/pic_vlm_json_zip.svg.mjs +4 -0
- package/dist/es/components/PicZipImportModal/pic_vlm_zip.svg.mjs +4 -0
- package/dist/es/components/VLMAnnotation/RegionItem.mjs +95 -0
- package/dist/es/components/VLMAnnotation/TextAnnotationPanel.mjs +83 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.mjs +75 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.mjs +115 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.mjs +42 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.mjs +55 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.mjs +51 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.mjs +47 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.mjs +220 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.mjs +106 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.mjs +68 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.mjs +38 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.mjs +141 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.mjs +72 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.mjs +102 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.mjs +103 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.mjs +156 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/icons/del.png.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +507 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.mjs +33 -0
- package/dist/es/components/VLMAnnotation/components/DragButton.mjs +18 -0
- package/dist/es/components/VLMAnnotation/components/FitToScreenButton.mjs +16 -0
- package/dist/es/components/VLMAnnotation/components/RectangleButton.mjs +30 -0
- package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +40 -0
- package/dist/es/components/VLMAnnotation/components/ZoomControls.mjs +44 -0
- package/dist/es/components/VLMAnnotation/constants.mjs +50 -0
- package/dist/es/components/VLMAnnotation/index.mjs +242 -0
- package/dist/es/components/VLMAnnotation/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.mjs +345 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs +240 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.mjs +201 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/index.mjs +399 -0
- package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +139 -0
- package/dist/es/components/VLMAnnotationDetail/VlmModal/style.less.mjs +4 -0
- package/dist/es/components/VLMAnnotationDetail/index.mjs +446 -0
- package/dist/es/components/VLMAnnotationDetail/style.less.mjs +4 -0
- package/dist/es/constant.mjs +3 -3
- package/dist/es/createVlmtasetAnnotation/index.mjs +131 -0
- package/dist/es/featuresConfig.mjs +13 -9
- package/dist/es/index.mjs +11 -7
- package/dist/example/DatasetAnnotationDemo.d.ts +3 -0
- package/dist/example/DemoTabs.d.ts +3 -0
- package/dist/example/DetectionDatasetDemo.d.ts +5 -0
- package/dist/example/DetectionImageDemo.d.ts +5 -0
- package/dist/example/OcrDatasetDemo.d.ts +5 -0
- package/dist/example/OcrImageDemo.d.ts +5 -0
- package/dist/example/OcrkvcDatasetDemo.d.ts +5 -0
- package/dist/example/constant.local.d.ts +6 -0
- package/dist/example/index.d.ts +1 -0
- package/dist/lib/index.js +4 -3
- package/dist/src/DatasetContext/index.d.ts +2 -0
- package/dist/src/components/Iconfont/font_4439177_tgvowh6bmlb.d.ts +0 -0
- package/dist/src/components/PicZipImportModal/config.d.ts +20 -0
- package/dist/src/components/VLMAnnotation/ImageAnnotationDebugger.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/RegionItem.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/TextAnnotationPanel.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasDrag.d.ts +12 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasSetup.d.ts +38 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCanvasZoom.d.ts +18 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useCropRegionImage.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteControl.d.ts +13 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDeleteRegion.d.ts +21 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useDrawingMode.d.ts +31 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRLoadingIcon.d.ts +11 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useOCRRecognition.d.ts +28 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionHover.d.ts +13 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionLoader.d.ts +37 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionNameText.d.ts +12 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionSelection.d.ts +15 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useRegionUpdate.d.ts +32 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/hooks/useTextLayouts.d.ts +25 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/index.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/VLMLabelMaker/utils/coordinateUtils.d.ts +32 -0
- package/dist/src/components/VLMAnnotation/components/DragButton.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/components/FitToScreenButton.d.ts +6 -0
- package/dist/src/components/VLMAnnotation/components/RectangleButton.d.ts +7 -0
- package/dist/src/components/VLMAnnotation/components/Toolbar.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/components/ZoomControls.d.ts +4 -0
- package/dist/src/components/VLMAnnotation/constants.d.ts +97 -0
- package/dist/src/components/VLMAnnotation/index.d.ts +6 -0
- package/dist/src/components/VLMAnnotation/types.d.ts +172 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/AttributeDetail/index.d.ts +14 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/ImageDetail/index.d.ts +16 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +21 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LableEditor.d.ts +16 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/index.d.ts +19 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/index.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/index.d.ts +12 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +16 -0
- package/dist/src/components/VLMAnnotationDetail/index.d.ts +6 -0
- package/dist/src/constant.d.ts +1 -1
- package/dist/src/createVlmtasetAnnotation/index.d.ts +16 -0
- package/dist/src/featuresConfig.d.ts +4 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/utils/reactCompatibility.d.ts +5 -0
- package/package.json +2 -2
package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
var R = Object.defineProperty, G = Object.defineProperties;
|
|
2
|
+
var O = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var A = Object.getOwnPropertySymbols;
|
|
4
|
+
var $ = Object.prototype.hasOwnProperty, H = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var D = (d, r, a) => r in d ? R(d, r, { enumerable: !0, configurable: !0, writable: !0, value: a }) : d[r] = a, v = (d, r) => {
|
|
6
|
+
for (var a in r || (r = {}))
|
|
7
|
+
$.call(r, a) && D(d, a, r[a]);
|
|
8
|
+
if (A)
|
|
9
|
+
for (var a of A(r))
|
|
10
|
+
H.call(r, a) && D(d, a, r[a]);
|
|
11
|
+
return d;
|
|
12
|
+
}, N = (d, r) => G(d, O(r));
|
|
13
|
+
var y = (d, r, a) => new Promise((f, h) => {
|
|
14
|
+
var c = (l) => {
|
|
15
|
+
try {
|
|
16
|
+
n(a.next(l));
|
|
17
|
+
} catch (m) {
|
|
18
|
+
h(m);
|
|
19
|
+
}
|
|
20
|
+
}, p = (l) => {
|
|
21
|
+
try {
|
|
22
|
+
n(a.throw(l));
|
|
23
|
+
} catch (m) {
|
|
24
|
+
h(m);
|
|
25
|
+
}
|
|
26
|
+
}, n = (l) => l.done ? f(l.value) : Promise.resolve(l.value).then(c, p);
|
|
27
|
+
n((a = a.apply(d, r)).next());
|
|
28
|
+
});
|
|
29
|
+
import { jsxs as u, jsx as o } from "react/jsx-runtime";
|
|
30
|
+
import { Space as J, Button as x, Input as b, Modal as P, message as q } from "antd";
|
|
31
|
+
import { forwardRef as z, useState as Q, useContext as F, useRef as K, useImperativeHandle as W, useEffect as k } from "react";
|
|
32
|
+
import T from "../../../Iconfont/index.mjs";
|
|
33
|
+
import X from "../../../../DatasetContext/index.mjs";
|
|
34
|
+
const Y = z((d, r) => {
|
|
35
|
+
const {
|
|
36
|
+
visionId: a,
|
|
37
|
+
afterChangeTemplates: f,
|
|
38
|
+
datasetId: h
|
|
39
|
+
} = d, [c, p] = Q(!1), [n, l] = Q([]), {
|
|
40
|
+
services: {
|
|
41
|
+
cvforceDatahub: m
|
|
42
|
+
}
|
|
43
|
+
} = F(X), I = () => y(void 0, null, function* () {
|
|
44
|
+
if (!h || !a)
|
|
45
|
+
return;
|
|
46
|
+
const e = yield m == null ? void 0 : m.getDatasetsIdVersionsVid(h, a), t = (e == null ? void 0 : e.qaTemplate) || [];
|
|
47
|
+
return l(t), w.current = C(t), t;
|
|
48
|
+
}), w = K(""), C = (e) => {
|
|
49
|
+
const t = [...e].sort((s, i) => {
|
|
50
|
+
const g = String(s.id), B = String(i.id);
|
|
51
|
+
return g.localeCompare(B);
|
|
52
|
+
});
|
|
53
|
+
return JSON.stringify(t);
|
|
54
|
+
}, S = () => C(n) !== w.current, E = () => new Promise((e) => {
|
|
55
|
+
if (!S()) {
|
|
56
|
+
e(!0);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
P.confirm({
|
|
60
|
+
title: "提示",
|
|
61
|
+
content: "QA生成配置有未保存的更改,确定要离开吗?",
|
|
62
|
+
okText: "确定",
|
|
63
|
+
cancelText: "取消",
|
|
64
|
+
onOk: () => {
|
|
65
|
+
e(!0);
|
|
66
|
+
},
|
|
67
|
+
onCancel: () => {
|
|
68
|
+
e(!1);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
W(r, () => ({
|
|
73
|
+
hasUnsavedChanges: S,
|
|
74
|
+
checkDirtyAndConfirm: E
|
|
75
|
+
})), k(() => {
|
|
76
|
+
I();
|
|
77
|
+
}, [h, a]), k(() => {
|
|
78
|
+
const e = (t) => {
|
|
79
|
+
if (C(n) !== w.current)
|
|
80
|
+
return t.preventDefault(), t.returnValue = "", "";
|
|
81
|
+
};
|
|
82
|
+
return window.addEventListener("beforeunload", e), () => {
|
|
83
|
+
window.removeEventListener("beforeunload", e);
|
|
84
|
+
};
|
|
85
|
+
}, [n]);
|
|
86
|
+
const L = () => {
|
|
87
|
+
l([...n, {
|
|
88
|
+
id: Date.now(),
|
|
89
|
+
name: "",
|
|
90
|
+
q: "",
|
|
91
|
+
a: ""
|
|
92
|
+
}]), p(!0);
|
|
93
|
+
}, M = (e) => {
|
|
94
|
+
l(n.filter((t) => t.id !== e));
|
|
95
|
+
}, U = (e, t) => {
|
|
96
|
+
const s = n.map((i) => i.id === e ? N(v({}, i), {
|
|
97
|
+
name: t
|
|
98
|
+
}) : i);
|
|
99
|
+
l(s);
|
|
100
|
+
}, V = (e, t) => {
|
|
101
|
+
const s = n.map((i) => i.id === e ? N(v({}, i), {
|
|
102
|
+
q: t
|
|
103
|
+
}) : i);
|
|
104
|
+
l(s);
|
|
105
|
+
}, j = (e, t) => {
|
|
106
|
+
const s = n.map((i) => i.id === e ? N(v({}, i), {
|
|
107
|
+
a: t
|
|
108
|
+
}) : i);
|
|
109
|
+
l(s);
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */ u("div", {
|
|
112
|
+
className: "info-item",
|
|
113
|
+
children: [/* @__PURE__ */ u("div", {
|
|
114
|
+
className: "info-item-header",
|
|
115
|
+
children: [/* @__PURE__ */ o("div", {
|
|
116
|
+
className: "info-item-title",
|
|
117
|
+
children: "QA生成配置"
|
|
118
|
+
}), /* @__PURE__ */ u(J, {
|
|
119
|
+
style: {
|
|
120
|
+
height: 32
|
|
121
|
+
},
|
|
122
|
+
children: [/* @__PURE__ */ o(x, {
|
|
123
|
+
type: "text",
|
|
124
|
+
icon: c ? /* @__PURE__ */ o(T, {
|
|
125
|
+
type: "icon-queding",
|
|
126
|
+
className: "self-icon"
|
|
127
|
+
}) : /* @__PURE__ */ o(T, {
|
|
128
|
+
type: "icon-editing",
|
|
129
|
+
className: "self-icon"
|
|
130
|
+
}),
|
|
131
|
+
onClick: () => y(void 0, null, function* () {
|
|
132
|
+
if (c) {
|
|
133
|
+
if (n.filter((t) => {
|
|
134
|
+
var s, i, g;
|
|
135
|
+
return !((s = t.name) != null && s.trim()) || !((i = t.q) != null && i.trim()) || !((g = t.a) != null && g.trim());
|
|
136
|
+
}).length > 0) {
|
|
137
|
+
q.error("模版名称、问题模版、回答模版均不能为空");
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (console.log("生成问题和答案", n), !h || !a)
|
|
141
|
+
return;
|
|
142
|
+
try {
|
|
143
|
+
const t = n == null ? void 0 : n.map((s) => ({
|
|
144
|
+
id: s.id,
|
|
145
|
+
name: s.name,
|
|
146
|
+
q: s.q,
|
|
147
|
+
a: s.a
|
|
148
|
+
}));
|
|
149
|
+
yield m == null ? void 0 : m.patchDatasetsIdVersionsVid(h, a, {
|
|
150
|
+
qaTemplate: t
|
|
151
|
+
}), yield I();
|
|
152
|
+
} catch (t) {
|
|
153
|
+
q.error("保存失败");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
f && f();
|
|
157
|
+
}
|
|
158
|
+
p(!c);
|
|
159
|
+
})
|
|
160
|
+
}), /* @__PURE__ */ o(x, {
|
|
161
|
+
type: "text",
|
|
162
|
+
disabled: n.length >= 2,
|
|
163
|
+
icon: /* @__PURE__ */ o(T, {
|
|
164
|
+
type: "icon-tianjia",
|
|
165
|
+
className: `self-icon ${n.length >= 2 ? "disabled" : ""}`
|
|
166
|
+
}),
|
|
167
|
+
onClick: L
|
|
168
|
+
})]
|
|
169
|
+
})]
|
|
170
|
+
}), /* @__PURE__ */ o("div", {
|
|
171
|
+
className: "template-tips",
|
|
172
|
+
children: "*此配置对应全局,每个数据集/版本下都可自定义设置"
|
|
173
|
+
}), /* @__PURE__ */ o("div", {
|
|
174
|
+
className: "template-content",
|
|
175
|
+
children: n.map((e) => /* @__PURE__ */ u("div", {
|
|
176
|
+
className: "form-item-container " + (c ? "active" : ""),
|
|
177
|
+
children: [/* @__PURE__ */ u("div", {
|
|
178
|
+
className: "form-item",
|
|
179
|
+
children: [/* @__PURE__ */ u("div", {
|
|
180
|
+
className: "form-item-header",
|
|
181
|
+
children: [/* @__PURE__ */ o("div", {
|
|
182
|
+
className: "form-label",
|
|
183
|
+
children: "模版名称"
|
|
184
|
+
}), /* @__PURE__ */ o(x, {
|
|
185
|
+
type: "text",
|
|
186
|
+
icon: /* @__PURE__ */ o(T, {
|
|
187
|
+
type: "icon-shanchu",
|
|
188
|
+
className: `delete-btn ${!c || n.length <= 1 ? "disabled" : ""}`
|
|
189
|
+
}),
|
|
190
|
+
disabled: !c || n.length <= 1,
|
|
191
|
+
onClick: () => M(e.id)
|
|
192
|
+
})]
|
|
193
|
+
}), /* @__PURE__ */ o(b, {
|
|
194
|
+
showCount: !0,
|
|
195
|
+
maxLength: 32,
|
|
196
|
+
value: e.name,
|
|
197
|
+
onChange: (t) => U(e.id, t.target.value),
|
|
198
|
+
placeholder: "请输入模版名称",
|
|
199
|
+
disabled: !c,
|
|
200
|
+
style: {
|
|
201
|
+
marginBottom: 20
|
|
202
|
+
}
|
|
203
|
+
})]
|
|
204
|
+
}), /* @__PURE__ */ u("div", {
|
|
205
|
+
className: "form-item",
|
|
206
|
+
children: [/* @__PURE__ */ o("div", {
|
|
207
|
+
className: "form-label",
|
|
208
|
+
children: "问题模版"
|
|
209
|
+
}), /* @__PURE__ */ o(b.TextArea, {
|
|
210
|
+
showCount: !0,
|
|
211
|
+
maxLength: 2e3,
|
|
212
|
+
value: e.q,
|
|
213
|
+
onChange: (t) => V(e.id, t.target.value),
|
|
214
|
+
placeholder: "请输入问题模版",
|
|
215
|
+
disabled: !c,
|
|
216
|
+
rows: 2
|
|
217
|
+
})]
|
|
218
|
+
}), /* @__PURE__ */ u("div", {
|
|
219
|
+
className: "form-item",
|
|
220
|
+
children: [/* @__PURE__ */ o("div", {
|
|
221
|
+
className: "form-label",
|
|
222
|
+
children: "回答模版"
|
|
223
|
+
}), /* @__PURE__ */ o(b.TextArea, {
|
|
224
|
+
showCount: !0,
|
|
225
|
+
maxLength: 2e3,
|
|
226
|
+
value: e.a,
|
|
227
|
+
onChange: (t) => j(e.id, t.target.value),
|
|
228
|
+
placeholder: "请输入回答模版",
|
|
229
|
+
disabled: !c,
|
|
230
|
+
rows: 2
|
|
231
|
+
})]
|
|
232
|
+
})]
|
|
233
|
+
}, e.id))
|
|
234
|
+
})]
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
Y.displayName = "QAGenerationConfig";
|
|
238
|
+
export {
|
|
239
|
+
Y as default
|
|
240
|
+
};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
var D = (f, u, i) => new Promise((c, a) => {
|
|
2
|
+
var m = (n) => {
|
|
3
|
+
try {
|
|
4
|
+
l(i.next(n));
|
|
5
|
+
} catch (d) {
|
|
6
|
+
a(d);
|
|
7
|
+
}
|
|
8
|
+
}, h = (n) => {
|
|
9
|
+
try {
|
|
10
|
+
l(i.throw(n));
|
|
11
|
+
} catch (d) {
|
|
12
|
+
a(d);
|
|
13
|
+
}
|
|
14
|
+
}, l = (n) => n.done ? c(n.value) : Promise.resolve(n.value).then(m, h);
|
|
15
|
+
l((i = i.apply(f, u)).next());
|
|
16
|
+
});
|
|
17
|
+
import { jsx as e, jsxs as s, 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: c,
|
|
30
|
+
labels: a,
|
|
31
|
+
datasetId: m
|
|
32
|
+
} = f, [h, l] = g([]), [n, d] = 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 r = t.map((o, I) => {
|
|
45
|
+
var Q, q;
|
|
46
|
+
const x = {
|
|
47
|
+
id: (Q = o.id) != null ? Q : String(I),
|
|
48
|
+
regionId: (q = o.id) != null ? q : String(I),
|
|
49
|
+
shape: o.shape
|
|
50
|
+
}, T = o.content || {};
|
|
51
|
+
return a.forEach((C) => {
|
|
52
|
+
x[C.id] = T[C.id] || "-";
|
|
53
|
+
}), x;
|
|
54
|
+
});
|
|
55
|
+
l(r);
|
|
56
|
+
} else
|
|
57
|
+
l([]), d([]);
|
|
58
|
+
}, [i == null ? void 0 : i.labels, a]), S(() => {
|
|
59
|
+
h.length && y();
|
|
60
|
+
}, [h]);
|
|
61
|
+
const k = [{
|
|
62
|
+
title: "序号",
|
|
63
|
+
key: "index",
|
|
64
|
+
width: 80,
|
|
65
|
+
fixed: "left",
|
|
66
|
+
render: (t, r, o) => o + 1
|
|
67
|
+
}, ...(a || []).map((t) => ({
|
|
68
|
+
title: t.name,
|
|
69
|
+
dataIndex: t.id,
|
|
70
|
+
key: t.id,
|
|
71
|
+
width: 150,
|
|
72
|
+
render: (r) => /* @__PURE__ */ e("span", {
|
|
73
|
+
children: r || "-"
|
|
74
|
+
})
|
|
75
|
+
}))], y = () => {
|
|
76
|
+
p(!0), !(!m || !c || !(i != null && i.id)) && (N == null || N.postGenerateVlmKieQa(m, c, {
|
|
77
|
+
sampleIds: [i.id]
|
|
78
|
+
}).then((t) => {
|
|
79
|
+
console.log("QA生成结果:", t), d(t), p(!1);
|
|
80
|
+
}).catch((t) => {
|
|
81
|
+
console.error("QA生成失败:", t), p(!1);
|
|
82
|
+
}));
|
|
83
|
+
};
|
|
84
|
+
return /* @__PURE__ */ s("div", {
|
|
85
|
+
className: "qa-detail",
|
|
86
|
+
children: [/* @__PURE__ */ s(E, {
|
|
87
|
+
className: "infos",
|
|
88
|
+
gutter: 48,
|
|
89
|
+
children: [/* @__PURE__ */ e(G, {
|
|
90
|
+
span: 12,
|
|
91
|
+
children: /* @__PURE__ */ s("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: h,
|
|
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: m,
|
|
118
|
+
visionId: c,
|
|
119
|
+
afterChangeTemplates: () => {
|
|
120
|
+
y();
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
})]
|
|
124
|
+
}), /* @__PURE__ */ s("div", {
|
|
125
|
+
className: "qa-result",
|
|
126
|
+
children: [/* @__PURE__ */ s("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, r) => /* @__PURE__ */ s("div", {
|
|
149
|
+
className: "result-item-container",
|
|
150
|
+
style: {
|
|
151
|
+
borderBottom: r === 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__ */ s("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__ */ s("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
|
+
}, r)) : /* @__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
|
+
};
|