|
@@ -33,25 +33,12 @@ const DataSetListPage: FC<IProps> = ({ taskId, jobId, action }: IProps) => {
|
|
|
const operationSelectedDatas = async (data: any, type: string) => {
|
|
|
if (type === 'add' && data) {
|
|
|
let dataInfo = data;
|
|
|
- let str = { 1: 'text', 2: 'image', 3: 'audio', 4: 'image' };
|
|
|
const res = await getDataInfoById(taskId, jobId, data.id);
|
|
|
dataInfo.id = data.id;
|
|
|
dataInfo.annotationDesc = get(res.data, 'annotationDesc');
|
|
|
dataInfo.config = get(res.data, 'template.config');
|
|
|
dataInfo.task = {
|
|
|
- // data: {
|
|
|
- // image:
|
|
|
- // 'https://htx-misc.s3.amazonaws.com/opensource/label-studio/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg',
|
|
|
- // },
|
|
|
- // predictions: get(tasks, 'predictions'),
|
|
|
- // completions: get(tasks, 'completions'),
|
|
|
- data: {
|
|
|
- [get(res.data, 'annotationObject') === 2 && get(res.data, 'annotationTitle') === 'OCR识别'
|
|
|
- ? 'ocr'
|
|
|
- : str[get(res.data, 'annotationObject', 3)]]:
|
|
|
- `${localStorage.getItem('serverUrl')}/${BASE_CONSTS._SETTING_API_BASE_PATH}/labeling` +
|
|
|
- get(res.data, 'data'),
|
|
|
- },
|
|
|
+ data: formatTaskData(res.data),
|
|
|
annotations: get(res.data, 'annotations'),
|
|
|
predictions: get(res.data, 'predictions'),
|
|
|
};
|
|
@@ -160,6 +147,37 @@ const DataSetListPage: FC<IProps> = ({ taskId, jobId, action }: IProps) => {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+ const formatTaskData = (data) => {
|
|
|
+ let annotationObject = get(data, 'annotationObject', 3);
|
|
|
+ let annotationTitle = get(data, 'annotationTitle', 3);
|
|
|
+ let dataText = get(data, 'data');
|
|
|
+ let str = { 1: 'text', 2: 'image', 3: 'audio', 4: 'video' };
|
|
|
+ let dataKey = str[annotationObject];
|
|
|
+ switch (annotationTitle) {
|
|
|
+ case 'OCR识别':
|
|
|
+ dataKey = 'ocr';
|
|
|
+ break;
|
|
|
+ case '机器翻译':
|
|
|
+ dataKey = dataText.match(/toName=\"(.*?)\"/g)[0]?.replace(/toName=|"/g, '') ?? 'english';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ let dataValue = dataText;
|
|
|
+ switch (annotationObject) {
|
|
|
+ case 2:
|
|
|
+ case 3:
|
|
|
+ dataValue = `${localStorage.getItem('serverUrl')}/${BASE_CONSTS._SETTING_API_BASE_PATH}/labeling${dataText}`;
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ dataValue = `<video src="${localStorage.getItem('serverUrl')}/${
|
|
|
+ BASE_CONSTS._SETTING_API_BASE_PATH
|
|
|
+ }/labeling${dataText}" width=100% controls>`;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ dataValue = dataText;
|
|
|
+ }
|
|
|
+ return { [dataKey]: dataValue };
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<div className="label_div" style={{ height: document.documentElement.clientHeight }}>
|
|
|
<LeftDataPage
|