code7-leia 0.1.161 → 0.1.162
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/code7-leia.cjs.development.js +79 -25
- package/dist/code7-leia.cjs.development.js.map +1 -1
- package/dist/code7-leia.cjs.production.min.js +1 -1
- package/dist/code7-leia.cjs.production.min.js.map +1 -1
- package/dist/code7-leia.esm.js +79 -25
- package/dist/code7-leia.esm.js.map +1 -1
- package/dist/interface/FileData.d.ts +5 -1
- package/dist/interface/Language.d.ts +3 -0
- package/package.json +1 -1
- package/src/components/FileArea/index.tsx +40 -5
- package/src/components/FileArea/styles.tsx +19 -1
- package/src/components/MultiSelect/styles.tsx +1 -1
- package/src/interface/FileData.ts +6 -1
- package/src/interface/Language.ts +3 -0
- package/src/store/modules/sagas.ts +3 -3
- package/src/utils/languages/en.ts +5 -2
- package/src/utils/languages/es.ts +5 -2
- package/src/utils/languages/pt-br.ts +5 -2
|
@@ -15,6 +15,8 @@ declare type FileArea = {
|
|
|
15
15
|
uploadFile: string;
|
|
16
16
|
deleteFileTitle: string;
|
|
17
17
|
deleteFile: string;
|
|
18
|
+
trainingTitle: string;
|
|
19
|
+
trainingDescription: string;
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
22
|
declare type Buttons = {
|
|
@@ -23,6 +25,7 @@ declare type Buttons = {
|
|
|
23
25
|
delete: string;
|
|
24
26
|
test: string;
|
|
25
27
|
addNewOpinion: string;
|
|
28
|
+
training: string;
|
|
26
29
|
};
|
|
27
30
|
declare type TestArea = {
|
|
28
31
|
description: string;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
|
|
3
3
|
|
|
4
4
|
import { FaUpload, FaList, FaPlus } from 'react-icons/fa';
|
|
5
5
|
|
|
6
|
-
import type { FileData } from '../../interface/FileData'
|
|
6
|
+
import type { FileData, tag } from '../../interface/FileData'
|
|
7
7
|
|
|
8
8
|
import { getLanguage } from '../../utils/getLanguage'
|
|
9
9
|
|
|
@@ -26,6 +26,7 @@ export const FileArea = () => {
|
|
|
26
26
|
const [uploadFile, setUploadFile] = useState<{ content: ArrayBuffer | string; properties: File }>();
|
|
27
27
|
const [modal, setModal] = useState(false)
|
|
28
28
|
const [modalDelete, setModalDelete] = useState(false)
|
|
29
|
+
const [modalTraining, setModalTraining] = useState(false)
|
|
29
30
|
const [fileDelete, setFileDelete] = useState('')
|
|
30
31
|
const [optionsPresset, setOptionsPresset] = useState<{ label: any; value: any; }[]>([])
|
|
31
32
|
const [presset, setPresset] = useState<string[]>([]);
|
|
@@ -67,12 +68,11 @@ export const FileArea = () => {
|
|
|
67
68
|
}
|
|
68
69
|
}, [initFiles])
|
|
69
70
|
|
|
70
|
-
const pressetTag = (tags:
|
|
71
|
-
const tagsSplit = tags.split(',');
|
|
71
|
+
const pressetTag = (tags: [tag]) => {
|
|
72
72
|
let html = '';
|
|
73
73
|
|
|
74
|
-
html +=
|
|
75
|
-
return `<p class='tag'>${tag}</p>`;
|
|
74
|
+
html += tags.map(tag => {
|
|
75
|
+
return `<p class='tag ${tag.trained ? 'trained' : ''}'>${tag.name}</p>`;
|
|
76
76
|
}).join('');
|
|
77
77
|
|
|
78
78
|
return html;
|
|
@@ -91,6 +91,14 @@ export const FileArea = () => {
|
|
|
91
91
|
setModalDelete(!modalDelete)
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
const handleOpenModalTraining = (tags?: [tag]) => {
|
|
95
|
+
const pressets = tags?.map((tag) => {
|
|
96
|
+
return tag.name
|
|
97
|
+
})
|
|
98
|
+
setPresset(pressets ? pressets : [])
|
|
99
|
+
setModalTraining(!modalTraining)
|
|
100
|
+
}
|
|
101
|
+
|
|
94
102
|
const deleteFile = () => {
|
|
95
103
|
dispatch(deleteFilesAction(fileDelete, id, language))
|
|
96
104
|
setModalDelete(false)
|
|
@@ -152,6 +160,9 @@ export const FileArea = () => {
|
|
|
152
160
|
<div className='divDelete'>
|
|
153
161
|
<button className='buttonDelete' onClick={() => handleOpenModalDelete(object.name)}>{t.buttons.delete}</button>
|
|
154
162
|
</div>
|
|
163
|
+
<div className='divTraining'>
|
|
164
|
+
<button className='buttonTraining' onClick={() => handleOpenModalTraining(object.tags)}>{t.buttons.training}</button>
|
|
165
|
+
</div>
|
|
155
166
|
</td>
|
|
156
167
|
</tr>
|
|
157
168
|
))}
|
|
@@ -206,6 +217,30 @@ export const FileArea = () => {
|
|
|
206
217
|
</button>
|
|
207
218
|
</ModalFooter>
|
|
208
219
|
</Modal>
|
|
220
|
+
<Modal
|
|
221
|
+
isopen={modal}
|
|
222
|
+
maxwidth="600px"
|
|
223
|
+
maxheight="max-content"
|
|
224
|
+
onClose={handleOpenModal}
|
|
225
|
+
title={t.fileArea.modal.trainingTitle}
|
|
226
|
+
>
|
|
227
|
+
<ModalContent>
|
|
228
|
+
<p id='info'>{t.fileArea.modal.trainingDescription}</p>
|
|
229
|
+
<div className='presset'>
|
|
230
|
+
<p>{t.fileArea.presset}</p>
|
|
231
|
+
<MultiSelect setOptions={setOptionsPresset} options={optionsPresset} presset={presset} setPresset={setPresset} modal={modal} language={language} />
|
|
232
|
+
</div>
|
|
233
|
+
</ModalContent>
|
|
234
|
+
<ModalFooter>
|
|
235
|
+
<button className='button cancel' onClick={() => handleOpenModalTraining(undefined)}>
|
|
236
|
+
{t.buttons.cancel}
|
|
237
|
+
</button>
|
|
238
|
+
<button onClick={() => handleUploadFile()} className='button send' type="submit" form="form-tts">
|
|
239
|
+
{t.buttons.send}
|
|
240
|
+
</button>
|
|
241
|
+
</ModalFooter>
|
|
242
|
+
|
|
243
|
+
</Modal>
|
|
209
244
|
</S.Container>
|
|
210
245
|
);
|
|
211
246
|
}
|
|
@@ -50,7 +50,7 @@ export const Container = styled.div<ContainerProps>`
|
|
|
50
50
|
gap: 4px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
.divDelete {
|
|
53
|
+
.divDelete, .divTraining {
|
|
54
54
|
display: flex;
|
|
55
55
|
align-items: center;
|
|
56
56
|
justify-content: center;
|
|
@@ -68,6 +68,17 @@ export const Container = styled.div<ContainerProps>`
|
|
|
68
68
|
background: #f5bba7;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
.buttonTraining {
|
|
72
|
+
color: #023906;
|
|
73
|
+
background: #e3f8cc;
|
|
74
|
+
padding: 12px 20px;
|
|
75
|
+
border-radius: 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.buttonTraining:hover {
|
|
79
|
+
background: #90d665;
|
|
80
|
+
}
|
|
81
|
+
|
|
71
82
|
.button {
|
|
72
83
|
padding: 8px 16px 8px 16px;
|
|
73
84
|
border-radius: 4px;
|
|
@@ -106,6 +117,13 @@ export const Container = styled.div<ContainerProps>`
|
|
|
106
117
|
background: #FAE0D2;
|
|
107
118
|
color: #871821;
|
|
108
119
|
}
|
|
120
|
+
|
|
121
|
+
#info {
|
|
122
|
+
padding: 10px;
|
|
123
|
+
background: #c7f9ed;
|
|
124
|
+
color: #00344e;
|
|
125
|
+
}
|
|
126
|
+
|
|
109
127
|
`;
|
|
110
128
|
|
|
111
129
|
export const Header = styled.div`
|
|
@@ -23,7 +23,6 @@ export const OverSelect = styled.div`
|
|
|
23
23
|
top: 0;
|
|
24
24
|
bottom: 0;
|
|
25
25
|
display: flex;
|
|
26
|
-
justify-content: flex-end;
|
|
27
26
|
|
|
28
27
|
input {
|
|
29
28
|
height: 43px;
|
|
@@ -64,6 +63,7 @@ export const SelectedValues = styled.div`
|
|
|
64
63
|
display: flex;
|
|
65
64
|
flex-wrap: wrap;
|
|
66
65
|
margin-left: 5px;
|
|
66
|
+
right: 30px;
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
69
|
export const SelectedValue = styled.div`
|
|
@@ -15,6 +15,8 @@ type FileArea = {
|
|
|
15
15
|
uploadFile: string;
|
|
16
16
|
deleteFileTitle: string;
|
|
17
17
|
deleteFile: string;
|
|
18
|
+
trainingTitle: string;
|
|
19
|
+
trainingDescription: string
|
|
18
20
|
};
|
|
19
21
|
};
|
|
20
22
|
|
|
@@ -24,6 +26,7 @@ type Buttons = {
|
|
|
24
26
|
delete: string;
|
|
25
27
|
test: string;
|
|
26
28
|
addNewOpinion: string;
|
|
29
|
+
training: string;
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
type TestArea = {
|
|
@@ -14,7 +14,7 @@ export function* getFilesSaga(action: any) {
|
|
|
14
14
|
try {
|
|
15
15
|
yield put(commonLoadingStart());
|
|
16
16
|
const { id } = action.payload
|
|
17
|
-
const { data } = yield call(api.get, `/
|
|
17
|
+
const { data } = yield call(api.get, `/training/${id}`);
|
|
18
18
|
yield put(getFilesActionSuccess({ files: data.files}));
|
|
19
19
|
} catch (error) {
|
|
20
20
|
console.log('-----------getFiles.error------------------->', error);
|
|
@@ -30,7 +30,7 @@ export function* deleteFilesSaga(action: any) {
|
|
|
30
30
|
const { id, name } = action.payload
|
|
31
31
|
|
|
32
32
|
yield call(api.delete, `/delete/${id}/${name}`);
|
|
33
|
-
const { data } = yield call(api.get, `/
|
|
33
|
+
const { data } = yield call(api.get, `/training/${id}`);
|
|
34
34
|
yield put(deleteFilesActionSuccess({ files: data.files, success: true }));
|
|
35
35
|
} catch (error) {
|
|
36
36
|
toast.error({title: t.toast.deleteFile.fail.title, description: t.toast.deleteFile.fail.description});
|
|
@@ -73,7 +73,7 @@ export function* uploadFilesSaga(action: any) {
|
|
|
73
73
|
},
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
const { data } = yield call(api.get, `/
|
|
76
|
+
const { data } = yield call(api.get, `/training/${id}`);
|
|
77
77
|
yield put(uploadFilesActionSuccess({ files: data.files }));
|
|
78
78
|
} catch (error) {
|
|
79
79
|
toast.error({title: t.toast.uploadFile.fail.title, description: t.toast.uploadFile.fail.description});
|
|
@@ -19,7 +19,9 @@ export const enTranslation: Language = {
|
|
|
19
19
|
chooseFile: 'Choose a file',
|
|
20
20
|
uploadFile: 'Upload a file',
|
|
21
21
|
deleteFileTitle: 'Delete a file',
|
|
22
|
-
deleteFile: 'Important! By deleting this file, you will lose all its information and will not be able to recover it.'
|
|
22
|
+
deleteFile: 'Important! By deleting this file, you will lose all its information and will not be able to recover it.',
|
|
23
|
+
trainingTitle: 'Presset Training',
|
|
24
|
+
trainingDescription: 'Select one or more pressets to be trained'
|
|
23
25
|
},
|
|
24
26
|
},
|
|
25
27
|
buttons: {
|
|
@@ -27,7 +29,8 @@ export const enTranslation: Language = {
|
|
|
27
29
|
send: 'Send',
|
|
28
30
|
delete: 'Delete',
|
|
29
31
|
test: 'Test',
|
|
30
|
-
addNewOpinion: 'Add new Opinion'
|
|
32
|
+
addNewOpinion: 'Add new Opinion',
|
|
33
|
+
training: 'Training'
|
|
31
34
|
},
|
|
32
35
|
testArea: {
|
|
33
36
|
description: 'Type a sentence to test artificial intelligence',
|
|
@@ -19,7 +19,9 @@ export const esTranslation: Language = {
|
|
|
19
19
|
chooseFile: 'Elegir un archivo',
|
|
20
20
|
uploadFile: 'Subir un archivo',
|
|
21
21
|
deleteFileTitle: 'Eliminar un archivo',
|
|
22
|
-
deleteFile: '¡Importante! Al eliminar este archivo, perderá toda su información y no podrá recuperarla.'
|
|
22
|
+
deleteFile: '¡Importante! Al eliminar este archivo, perderá toda su información y no podrá recuperarla.',
|
|
23
|
+
trainingTitle: 'Entrenamiento de preconfiguración',
|
|
24
|
+
trainingDescription: 'Seleccione una o más preconfiguracións para ser entrenadas'
|
|
23
25
|
},
|
|
24
26
|
},
|
|
25
27
|
buttons: {
|
|
@@ -27,7 +29,8 @@ export const esTranslation: Language = {
|
|
|
27
29
|
send: 'Enviar',
|
|
28
30
|
delete: 'Eliminar',
|
|
29
31
|
test: 'Prueba',
|
|
30
|
-
addNewOpinion: 'Agregar nueva preconfiguración'
|
|
32
|
+
addNewOpinion: 'Agregar nueva preconfiguración',
|
|
33
|
+
training: 'Capacitación'
|
|
31
34
|
},
|
|
32
35
|
testArea: {
|
|
33
36
|
description: 'Escribe una frase para probar la inteligencia artificial.',
|
|
@@ -19,7 +19,9 @@ export const ptTranslation: Language = {
|
|
|
19
19
|
chooseFile: 'Escolha um arquivo',
|
|
20
20
|
uploadFile: 'Enviar um arquivo',
|
|
21
21
|
deleteFileTitle: 'Excluir um arquivo',
|
|
22
|
-
deleteFile: 'Importante! Ao excluir este arquivo, você perderá todas as suas informações e não poderá recuperá-las.'
|
|
22
|
+
deleteFile: 'Importante! Ao excluir este arquivo, você perderá todas as suas informações e não poderá recuperá-las.',
|
|
23
|
+
trainingTitle: 'Treinamento de predefinição',
|
|
24
|
+
trainingDescription: 'Selecione um ou mais predefinições para serem treinadas'
|
|
23
25
|
},
|
|
24
26
|
},
|
|
25
27
|
buttons: {
|
|
@@ -27,7 +29,8 @@ export const ptTranslation: Language = {
|
|
|
27
29
|
send: 'Enviar',
|
|
28
30
|
delete: 'Excluir',
|
|
29
31
|
test: 'Teste',
|
|
30
|
-
addNewOpinion: 'Adicionar nova predefinição'
|
|
32
|
+
addNewOpinion: 'Adicionar nova predefinição',
|
|
33
|
+
training: 'Treinamento'
|
|
31
34
|
},
|
|
32
35
|
testArea: {
|
|
33
36
|
description: 'Digite uma frase para testar a inteligência artificial.',
|