code7-leia 0.2.20 → 0.2.22
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 +154 -52
- 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 +154 -52
- package/dist/code7-leia.esm.js.map +1 -1
- package/dist/components/TestArea/components/TextArea/index.d.ts +19 -0
- package/dist/components/TestArea/components/TextArea/styles.d.ts +11 -0
- package/dist/contexts/SharedPropsProvider.d.ts +1 -0
- package/dist/interface/Language.d.ts +1 -0
- package/dist/service/ApiHml.d.ts +3 -0
- package/dist/store/modules/actions.d.ts +11 -5
- package/package.json +1 -1
- package/src/Leia.tsx +1 -1
- package/src/components/FileArea/index.tsx +6 -6
- package/src/components/TestArea/components/TextArea/index.tsx +97 -0
- package/src/components/TestArea/components/TextArea/styles.tsx +169 -0
- package/src/components/TestArea/index.tsx +10 -3
- package/src/contexts/SharedPropsProvider.tsx +1 -0
- package/src/interface/Language.ts +1 -0
- package/src/service/ApiHml.ts +9 -0
- package/src/store/modules/actions.ts +10 -10
- package/src/store/modules/sagas.ts +15 -14
- package/src/utils/languages/en.ts +5 -4
- package/src/utils/languages/es.ts +5 -4
- package/src/utils/languages/pt-br.ts +5 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { takeLatest, all, put, call } from 'redux-saga/effects';
|
|
2
2
|
import api from '../../service/Api'
|
|
3
|
+
import apiHml from '../../service/ApiHml'
|
|
3
4
|
import Types from './types'
|
|
4
5
|
import { getFilesActionSuccess,
|
|
5
6
|
deleteFilesActionSuccess,
|
|
@@ -13,8 +14,8 @@ import { getLanguage } from '../../utils/getLanguage'
|
|
|
13
14
|
export function* getFilesSaga(action: any) {
|
|
14
15
|
try {
|
|
15
16
|
yield put(commonLoadingStart());
|
|
16
|
-
const { id, token } = action.payload
|
|
17
|
-
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
17
|
+
const { id, token, env } = action.payload
|
|
18
|
+
const { data } = yield call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, `/training/${id}?token=${token}`);
|
|
18
19
|
yield put(getFilesActionSuccess({ files: data.files}));
|
|
19
20
|
} catch (error) {
|
|
20
21
|
console.log('-----------getFiles.error------------------->', error);
|
|
@@ -27,10 +28,10 @@ export function* deleteFilesSaga(action: any) {
|
|
|
27
28
|
const t = getLanguage(action.payload.language)
|
|
28
29
|
try {
|
|
29
30
|
yield put(commonLoadingStart());
|
|
30
|
-
const { id, name, token } = action.payload
|
|
31
|
+
const { id, name, token, env } = action.payload
|
|
31
32
|
|
|
32
|
-
yield call(api.delete, `/delete/${id}/${name}?token=${token}`);
|
|
33
|
-
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
33
|
+
yield call(env.toLowerCase() === 'prod' ? api.delete : apiHml.delete, `/delete/${id}/${name}?token=${token}`);
|
|
34
|
+
const { data } = yield call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, `/training/${id}?token=${token}`);
|
|
34
35
|
yield put(deleteFilesActionSuccess({ files: data.files, success: true }));
|
|
35
36
|
} catch (error) {
|
|
36
37
|
toast.error({title: t.toast.deleteFile.fail.title, description: t.toast.deleteFile.fail.description});
|
|
@@ -43,8 +44,8 @@ export function* deleteFilesSaga(action: any) {
|
|
|
43
44
|
export function* testSaga(action: any) {
|
|
44
45
|
try {
|
|
45
46
|
yield put(commonLoadingStart());
|
|
46
|
-
const { question, profile, presset, files_directory, token } = action.payload
|
|
47
|
-
const { data } = yield call(api.post, `/ask`, { question, profile, tag: presset, files_directory, token });
|
|
47
|
+
const { question, prompt, profile, presset, files_directory, token, env } = action.payload
|
|
48
|
+
const { data } = yield call(env.toLowerCase() === 'prod' ? api.post : apiHml.post, `/ask`, { question, description: prompt, profile, tag: presset, files_directory, token });
|
|
48
49
|
yield put(testActionSuccess({ message: data.message }));
|
|
49
50
|
} catch (error) {
|
|
50
51
|
console.log('-----------testSaga.error------------------->', error);
|
|
@@ -57,11 +58,11 @@ export function* uploadFilesSaga(action: any) {
|
|
|
57
58
|
const t = getLanguage(action.payload.language);
|
|
58
59
|
try {
|
|
59
60
|
yield put(commonLoadingStart());
|
|
60
|
-
const { id, file, pressets, token } = action.payload;
|
|
61
|
+
const { id, file, pressets, token, env } = action.payload;
|
|
61
62
|
|
|
62
63
|
const blob = new Blob([file.content]);
|
|
63
64
|
const formData = new FormData();
|
|
64
|
-
const sanitizedPath = file.properties.path.replace(
|
|
65
|
+
const sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
|
|
65
66
|
formData.append('file', blob, sanitizedPath || 'default_filename');
|
|
66
67
|
|
|
67
68
|
const queryParams = pressets.length
|
|
@@ -72,13 +73,13 @@ export function* uploadFilesSaga(action: any) {
|
|
|
72
73
|
? `/upload/${id}?token=${token}&${queryParams}`
|
|
73
74
|
: `/upload/${id}?token=${token}`;
|
|
74
75
|
|
|
75
|
-
yield call(api.post, url, formData, {
|
|
76
|
+
yield call(env.toLowerCase() === 'prod' ? api.post : apiHml.post, url, formData, {
|
|
76
77
|
headers: {
|
|
77
78
|
'Content-Type': 'multipart/form-data',
|
|
78
79
|
},
|
|
79
80
|
});
|
|
80
81
|
|
|
81
|
-
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
82
|
+
const { data } = yield call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, `/training/${id}?token=${token}`);
|
|
82
83
|
yield put(uploadFilesActionSuccess({ files: data.files }));
|
|
83
84
|
} catch (error) {
|
|
84
85
|
toast.error({
|
|
@@ -96,14 +97,14 @@ export function* TrainingSaga(action: any) {
|
|
|
96
97
|
const t = getLanguage(action.payload.language)
|
|
97
98
|
try {
|
|
98
99
|
yield put(commonLoadingStart());
|
|
99
|
-
const { id, pressets, token } = action.payload;
|
|
100
|
+
const { id, pressets, token, env } = action.payload;
|
|
100
101
|
const tag = pressets.join(',');
|
|
101
102
|
|
|
102
103
|
const queryParams = new URLSearchParams({ tag }).toString();
|
|
103
104
|
|
|
104
|
-
yield call(api.post, pressets.length > 0 ? `/training?${queryParams}` : `/training`,{ files_directory: id, token });
|
|
105
|
+
yield call(env.toLowerCase() === 'prod' ? api.post : apiHml.post, pressets.length > 0 ? `/training?${queryParams}` : `/training`,{ files_directory: id, token });
|
|
105
106
|
|
|
106
|
-
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
107
|
+
const { data } = yield call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, `/training/${id}?token=${token}`);
|
|
107
108
|
yield put(uploadFilesActionSuccess({ files: data.files }));
|
|
108
109
|
toast.success({title: t.toast.Train.success.title, description: t.toast.Train.success.description});
|
|
109
110
|
} catch (error) {
|
|
@@ -23,7 +23,7 @@ export const enTranslation: Language = {
|
|
|
23
23
|
deleteFileTitle: 'Delete a file',
|
|
24
24
|
deleteFile: 'Important! By deleting this file, you will lose all its information and will not be able to recover it.',
|
|
25
25
|
trainingTitle: 'Presset Training',
|
|
26
|
-
trainingDescription: 'Select one or more pressets to be trained. Note: If none are selected,
|
|
26
|
+
trainingDescription: 'Select one or more pressets to be trained. Note: If none are selected, Le-IA will train all pressets.'
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
buttons: {
|
|
@@ -38,6 +38,7 @@ export const enTranslation: Language = {
|
|
|
38
38
|
testArea: {
|
|
39
39
|
description: 'Type a sentence to test artificial intelligence',
|
|
40
40
|
typeSentence: 'Type a sentence',
|
|
41
|
+
typePrompt: 'Insert a custom prompt here',
|
|
41
42
|
selectPersona: 'Select a Persona',
|
|
42
43
|
selectPresset: 'Select a presset',
|
|
43
44
|
emptyState: {
|
|
@@ -69,17 +70,17 @@ export const enTranslation: Language = {
|
|
|
69
70
|
Test: {
|
|
70
71
|
fail: {
|
|
71
72
|
title: 'Failure',
|
|
72
|
-
description: 'Error testing
|
|
73
|
+
description: 'Error testing Le-IA'
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
Train: {
|
|
76
77
|
fail: {
|
|
77
78
|
title: 'Failure',
|
|
78
|
-
description: 'Error training
|
|
79
|
+
description: 'Error training Le-IA'
|
|
79
80
|
},
|
|
80
81
|
success: {
|
|
81
82
|
title: 'Success',
|
|
82
|
-
description: '
|
|
83
|
+
description: 'Le-IA is in the training process!'
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
}
|
|
@@ -23,7 +23,7 @@ export const esTranslation: Language = {
|
|
|
23
23
|
deleteFileTitle: 'Eliminar un archivo',
|
|
24
24
|
deleteFile: '¡Importante! Al eliminar este archivo, perderá toda su información y no podrá recuperarla.',
|
|
25
25
|
trainingTitle: 'Entrenamiento de preconfiguración',
|
|
26
|
-
trainingDescription: 'Seleccione una o más preconfiguracións para ser entrenadas. Nota: Si no se selecciona ninguna,
|
|
26
|
+
trainingDescription: 'Seleccione una o más preconfiguracións para ser entrenadas. Nota: Si no se selecciona ninguna, Le-IA entrenará todas las preconfiguracións.'
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
buttons: {
|
|
@@ -38,6 +38,7 @@ export const esTranslation: Language = {
|
|
|
38
38
|
testArea: {
|
|
39
39
|
description: 'Escribe una frase para probar la inteligencia artificial.',
|
|
40
40
|
typeSentence: 'Escribe una oración',
|
|
41
|
+
typePrompt: 'Inserte un prompt personalizado aquí',
|
|
41
42
|
selectPersona: 'Seleccionar una Persona',
|
|
42
43
|
selectPresset: 'Seleccionar una preconfiguración',
|
|
43
44
|
emptyState: {
|
|
@@ -69,17 +70,17 @@ export const esTranslation: Language = {
|
|
|
69
70
|
Test: {
|
|
70
71
|
fail: {
|
|
71
72
|
title: 'Error',
|
|
72
|
-
description: 'Error al probar
|
|
73
|
+
description: 'Error al probar Le-IA'
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
Train: {
|
|
76
77
|
fail: {
|
|
77
78
|
title: 'Error',
|
|
78
|
-
description: 'Error al entrenar
|
|
79
|
+
description: 'Error al entrenar Le-IA'
|
|
79
80
|
},
|
|
80
81
|
success: {
|
|
81
82
|
title: 'Éxito',
|
|
82
|
-
description: '¡
|
|
83
|
+
description: '¡Le-IA está en proceso de entrenamiento!'
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
}
|
|
@@ -23,7 +23,7 @@ export const ptTranslation: Language = {
|
|
|
23
23
|
deleteFileTitle: 'Excluir um arquivo',
|
|
24
24
|
deleteFile: 'Importante! Ao excluir este arquivo, você perderá todas as suas informações e não poderá recuperá-las.',
|
|
25
25
|
trainingTitle: 'Treinamento de predefinição',
|
|
26
|
-
trainingDescription: 'Selecione um ou mais predefinições para serem treinadas. Obs: Caso não selecionada nenhuma a
|
|
26
|
+
trainingDescription: 'Selecione um ou mais predefinições para serem treinadas. Obs: Caso não selecionada nenhuma a Le-IA irá treinar todas as predefinições'
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
buttons: {
|
|
@@ -38,6 +38,7 @@ export const ptTranslation: Language = {
|
|
|
38
38
|
testArea: {
|
|
39
39
|
description: 'Digite uma frase para testar a inteligência artificial.',
|
|
40
40
|
typeSentence: 'Digite uma frase',
|
|
41
|
+
typePrompt: 'Insira aqui um prompt personalizado',
|
|
41
42
|
selectPersona: 'Selecione uma Persona',
|
|
42
43
|
selectPresset: 'Selecione uma predefinição',
|
|
43
44
|
emptyState: {
|
|
@@ -69,17 +70,17 @@ export const ptTranslation: Language = {
|
|
|
69
70
|
Test: {
|
|
70
71
|
fail: {
|
|
71
72
|
title: 'Falha',
|
|
72
|
-
description: 'Erro ao testar
|
|
73
|
+
description: 'Erro ao testar Le-IA'
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
Train: {
|
|
76
77
|
fail: {
|
|
77
78
|
title: 'Falha',
|
|
78
|
-
description: 'Erro ao treinar a
|
|
79
|
+
description: 'Erro ao treinar a Le-IA'
|
|
79
80
|
},
|
|
80
81
|
success: {
|
|
81
82
|
title: 'Sucesso',
|
|
82
|
-
description: 'A
|
|
83
|
+
description: 'A Le-IA está em processo de treinamento!'
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
86
|
}
|