code7-leia 0.1.169 → 0.1.171
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 +112 -12
- 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 +112 -12
- package/dist/code7-leia.esm.js.map +1 -1
- package/dist/interface/Language.d.ts +7 -0
- package/dist/store/modules/actions.d.ts +7 -0
- package/dist/store/modules/sagas.d.ts +5 -0
- package/dist/store/modules/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/FileArea/index.tsx +13 -3
- package/src/components/FileArea/styles.tsx +4 -1
- package/src/interface/Language.ts +7 -0
- package/src/store/modules/actions.ts +7 -0
- package/src/store/modules/sagas.ts +23 -1
- package/src/store/modules/types.ts +1 -0
- package/src/utils/languages/en.ts +7 -0
- package/src/utils/languages/es.ts +7 -0
- package/src/utils/languages/pt-br.ts +7 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare type FileArea = {
|
|
2
2
|
description: string;
|
|
3
|
+
status: string;
|
|
3
4
|
fileName: string;
|
|
4
5
|
presset: string;
|
|
5
6
|
actions: string;
|
|
@@ -66,6 +67,12 @@ declare type Toast = {
|
|
|
66
67
|
description: String;
|
|
67
68
|
};
|
|
68
69
|
};
|
|
70
|
+
Train: {
|
|
71
|
+
fail: {
|
|
72
|
+
title: String;
|
|
73
|
+
description: String;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
69
76
|
};
|
|
70
77
|
export declare type Language = {
|
|
71
78
|
files: string;
|
|
@@ -39,6 +39,13 @@ export declare const uploadFilesActionSuccess: ({ files }: any) => {
|
|
|
39
39
|
files: any;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
|
+
export declare const trainingAction: (id: string, pressets: string[]) => {
|
|
43
|
+
type: string;
|
|
44
|
+
payload: {
|
|
45
|
+
id: string;
|
|
46
|
+
pressets: string[];
|
|
47
|
+
};
|
|
48
|
+
};
|
|
42
49
|
export declare const testAction: (question: string, profile: string, presset: string, files_directory: string) => {
|
|
43
50
|
type: string;
|
|
44
51
|
payload: {
|
|
@@ -18,4 +18,9 @@ export declare function uploadFilesSaga(action: any): Generator<import("redux-sa
|
|
|
18
18
|
}> | import("redux-saga/effects").CallEffect<unknown>, void, {
|
|
19
19
|
data: any;
|
|
20
20
|
}>;
|
|
21
|
+
export declare function TrainingSaga(action: any): Generator<import("redux-saga/effects").PutEffect<{
|
|
22
|
+
type: string;
|
|
23
|
+
}> | import("redux-saga/effects").CallEffect<unknown>, void, {
|
|
24
|
+
data: any;
|
|
25
|
+
}>;
|
|
21
26
|
export default function filesSagas(): Generator<import("redux-saga/effects").AllEffect<import("redux-saga/effects").ForkEffect<never>>, void, unknown>;
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ import EmptyState from '../EmptyState';
|
|
|
20
20
|
import MultiSelect from '../MultiSelect';
|
|
21
21
|
import AreaUpload from './components/AreaUpload';
|
|
22
22
|
import { SharedPropsProvider, useSharedProps } from '../../contexts/SharedPropsProvider';
|
|
23
|
-
import { deleteFilesAction, getFilesAction, uploadFilesAction } from '../../store/modules/actions';
|
|
23
|
+
import { deleteFilesAction, getFilesAction, uploadFilesAction, trainingAction } from '../../store/modules/actions';
|
|
24
24
|
|
|
25
25
|
export const FileArea = () => {
|
|
26
26
|
const { id, language, propTags } = useSharedProps();
|
|
@@ -116,6 +116,12 @@ export const FileArea = () => {
|
|
|
116
116
|
setPresset([])
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
+
const handleTrain = () => {
|
|
120
|
+
dispatch(trainingAction(id, presset))
|
|
121
|
+
setModalTraining(false)
|
|
122
|
+
setPresset([])
|
|
123
|
+
};
|
|
124
|
+
|
|
119
125
|
const renderFiles = () => {
|
|
120
126
|
return (
|
|
121
127
|
<S.Container isloading={isloading}>
|
|
@@ -147,6 +153,9 @@ export const FileArea = () => {
|
|
|
147
153
|
) : <Table>
|
|
148
154
|
<thead>
|
|
149
155
|
<tr>
|
|
156
|
+
<th key="th_file_name" className="th_status">
|
|
157
|
+
{t.fileArea.status}
|
|
158
|
+
</th>
|
|
150
159
|
<th key="th_file_name" className="th_file_name">
|
|
151
160
|
{t.fileArea.fileName}
|
|
152
161
|
</th>
|
|
@@ -162,7 +171,8 @@ export const FileArea = () => {
|
|
|
162
171
|
<tbody>
|
|
163
172
|
{files.map((object) => (
|
|
164
173
|
<tr>
|
|
165
|
-
<td>{object.
|
|
174
|
+
<td>{object.trained ? <FaCheck size={14} style={{ color: 'green' }} /> : <TiDelete size={14} style={{ color: 'red' }} />}</td>
|
|
175
|
+
<td>{object.name}</td>
|
|
166
176
|
<td className='tags' dangerouslySetInnerHTML={{ __html: pressetTag(object.tags) }} />
|
|
167
177
|
<td>
|
|
168
178
|
<div className='divDelete'>
|
|
@@ -241,7 +251,7 @@ export const FileArea = () => {
|
|
|
241
251
|
<button className='button cancel' onClick={() => handleOpenModalTraining(undefined)}>
|
|
242
252
|
{t.buttons.cancel}
|
|
243
253
|
</button>
|
|
244
|
-
<button onClick={() =>
|
|
254
|
+
<button onClick={() => handleTrain()} className='button send' type="submit" form="form-tts">
|
|
245
255
|
{t.buttons.send}
|
|
246
256
|
</button>
|
|
247
257
|
</ModalFooter>
|
|
@@ -42,6 +42,9 @@ export const Container = styled.div<ContainerProps>`
|
|
|
42
42
|
padding: 4px 8px 4px 8px;
|
|
43
43
|
background: #C7F9ED;
|
|
44
44
|
border-radius: 4px;
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
align-items: center;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
.tags {
|
|
@@ -53,7 +56,7 @@ export const Container = styled.div<ContainerProps>`
|
|
|
53
56
|
.divDelete {
|
|
54
57
|
display: flex;
|
|
55
58
|
align-items: center;
|
|
56
|
-
justify-content:
|
|
59
|
+
justify-content: flex-start;
|
|
57
60
|
gap: 4px;
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
type FileArea = {
|
|
2
2
|
description: string;
|
|
3
|
+
status: string;
|
|
3
4
|
fileName: string;
|
|
4
5
|
presset: string;
|
|
5
6
|
actions: string;
|
|
@@ -68,6 +69,12 @@ type Toast = {
|
|
|
68
69
|
title: String,
|
|
69
70
|
description: String
|
|
70
71
|
}
|
|
72
|
+
},
|
|
73
|
+
Train: {
|
|
74
|
+
fail: {
|
|
75
|
+
title: String,
|
|
76
|
+
description: String
|
|
77
|
+
}
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
|
|
@@ -42,6 +42,13 @@ export const uploadFilesActionSuccess = ({ files }: any) => {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export const trainingAction = (id: string, pressets: string[]) => {
|
|
46
|
+
return {
|
|
47
|
+
type: types.TRAINING_REQUEST,
|
|
48
|
+
payload: { id, pressets }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
45
52
|
export const testAction = (question: string, profile: string, presset: string, files_directory: string) => {
|
|
46
53
|
return {
|
|
47
54
|
type: types.TEST_REQUEST,
|
|
@@ -83,11 +83,33 @@ export function* uploadFilesSaga(action: any) {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
export function* TrainingSaga(action: any) {
|
|
87
|
+
const t = getLanguage(action.payload.language)
|
|
88
|
+
try {
|
|
89
|
+
yield put(commonLoadingStart());
|
|
90
|
+
const { id, pressets } = action.payload;
|
|
91
|
+
const tag = pressets.join(',');
|
|
92
|
+
|
|
93
|
+
const queryParams = new URLSearchParams({ tag }).toString();
|
|
94
|
+
|
|
95
|
+
yield call(api.post, `/training?${queryParams}`,{ files_directory: id });
|
|
96
|
+
|
|
97
|
+
const { data } = yield call(api.get, `/training/${id}`);
|
|
98
|
+
yield put(uploadFilesActionSuccess({ files: data.files }));
|
|
99
|
+
} catch (error) {
|
|
100
|
+
toast.error({title: t.toast.Train.fail.title, description: t.toast.Train.fail.description});
|
|
101
|
+
console.log('-----------TrainingSaga.error------------------->', error);
|
|
102
|
+
} finally {
|
|
103
|
+
yield put(commonLoadingFinish());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
86
107
|
export default function* filesSagas() {
|
|
87
108
|
yield all([
|
|
88
109
|
takeLatest(Types.GET_FILES_REQUEST, getFilesSaga),
|
|
89
110
|
takeLatest(Types.DELETE_FILES_REQUEST, deleteFilesSaga),
|
|
90
111
|
takeLatest(Types.UPLOAD_FILES_REQUEST, uploadFilesSaga),
|
|
91
|
-
takeLatest(Types.TEST_REQUEST, testSaga)
|
|
112
|
+
takeLatest(Types.TEST_REQUEST, testSaga),
|
|
113
|
+
takeLatest(Types.TRAINING_REQUEST, TrainingSaga)
|
|
92
114
|
]);
|
|
93
115
|
}
|
|
@@ -5,6 +5,7 @@ const Types = {
|
|
|
5
5
|
DELETE_FILES_SUCCESS: 'DELETE_FILES_SUCCESS',
|
|
6
6
|
UPLOAD_FILES_REQUEST: 'UPLOAD_FILES_REQUEST',
|
|
7
7
|
UPLOAD_FILES_SUCCESS: 'UPLOAD_FILES_SUCCESS',
|
|
8
|
+
TRAINING_REQUEST: 'TRAINING_REQUEST',
|
|
8
9
|
TEST_REQUEST: 'TEST_REQUEST',
|
|
9
10
|
TEST_SUCCESS: 'TEST_SUCCESS',
|
|
10
11
|
LOADING_START: 'LOADING_START',
|
|
@@ -6,6 +6,7 @@ export const enTranslation: Language = {
|
|
|
6
6
|
fileArea: {
|
|
7
7
|
description: 'Manage your files with ease! Add new ones and delete old ones as desired.',
|
|
8
8
|
fileName: 'File name',
|
|
9
|
+
status: 'Status',
|
|
9
10
|
presset: 'Presset',
|
|
10
11
|
actions: 'Actions',
|
|
11
12
|
search: 'Search',
|
|
@@ -70,6 +71,12 @@ export const enTranslation: Language = {
|
|
|
70
71
|
title: 'Failure',
|
|
71
72
|
description: 'Error testing Le-IA'
|
|
72
73
|
}
|
|
74
|
+
},
|
|
75
|
+
Train: {
|
|
76
|
+
fail: {
|
|
77
|
+
title: 'Failure',
|
|
78
|
+
description: 'Error training Le-IA'
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
};
|
|
@@ -6,6 +6,7 @@ export const esTranslation: Language = {
|
|
|
6
6
|
fileArea: {
|
|
7
7
|
description: '¡Administre sus archivos fácilmente! Agregue nuevos y elimine los antiguos según desee.',
|
|
8
8
|
fileName: 'Nombre del archivo',
|
|
9
|
+
status: 'Status',
|
|
9
10
|
presset: 'Preconfiguración',
|
|
10
11
|
actions: 'Acciones',
|
|
11
12
|
search: 'Buscar',
|
|
@@ -70,6 +71,12 @@ export const esTranslation: Language = {
|
|
|
70
71
|
title: 'Error',
|
|
71
72
|
description: 'Error al probar Le-IA'
|
|
72
73
|
}
|
|
74
|
+
},
|
|
75
|
+
Train: {
|
|
76
|
+
fail: {
|
|
77
|
+
title: 'Error',
|
|
78
|
+
description: 'Error al entrenar Le-IA'
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
};
|
|
@@ -6,6 +6,7 @@ export const ptTranslation: Language = {
|
|
|
6
6
|
fileArea: {
|
|
7
7
|
description: 'Gerencie seus arquivos com facilidade! Adicione novos e exclua os antigos conforme desejar.',
|
|
8
8
|
fileName: 'Nome do arquivo',
|
|
9
|
+
status: 'Status',
|
|
9
10
|
presset: 'Predefinição',
|
|
10
11
|
actions: 'Ações',
|
|
11
12
|
search: 'Pesquisar',
|
|
@@ -70,6 +71,12 @@ export const ptTranslation: Language = {
|
|
|
70
71
|
title: 'Falha',
|
|
71
72
|
description: 'Erro ao testar Le-IA'
|
|
72
73
|
}
|
|
74
|
+
},
|
|
75
|
+
Train: {
|
|
76
|
+
fail: {
|
|
77
|
+
title: 'Falha',
|
|
78
|
+
description: 'Erro ao treinar a Le-IA'
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
}
|
|
75
82
|
};
|