code7-leia 1.0.11 → 1.0.14
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/index.es.js +3490 -2979
- package/package.json +8 -7
- package/src/components/CustomToast/index.tsx +62 -0
- package/src/components/CustomToast/styles.tsx +74 -0
- package/src/components/EmptyState/index.tsx +88 -0
- package/src/components/EmptyState/styles.tsx +85 -0
- package/src/components/FileArea/components/AreaUpload/index.tsx +137 -0
- package/src/components/FileArea/components/AreaUpload/styles.tsx +86 -0
- package/src/components/FileArea/components/Modal/ModalButtonClose.tsx +23 -0
- package/src/components/FileArea/components/Modal/ModalContent.tsx +26 -0
- package/src/components/FileArea/components/Modal/ModalFooter.tsx +18 -0
- package/src/components/FileArea/components/Modal/ModalHeader.tsx +18 -0
- package/src/components/FileArea/components/Modal/ModalTitle.tsx +18 -0
- package/src/components/FileArea/components/Modal/index.tsx +131 -0
- package/src/components/FileArea/components/Modal/styles.tsx +121 -0
- package/src/components/FileArea/components/Search/index.tsx +45 -0
- package/src/components/FileArea/components/Search/styles.tsx +26 -0
- package/src/components/FileArea/components/Spinner/index.tsx +22 -0
- package/src/components/FileArea/components/Spinner/styles.tsx +59 -0
- package/src/components/FileArea/components/Table/index.tsx +34 -0
- package/src/components/FileArea/components/Table/styles.tsx +60 -0
- package/src/components/FileArea/index.tsx +279 -0
- package/src/components/FileArea/styles.tsx +183 -0
- package/src/components/LengthCounter/index.tsx +29 -0
- package/src/components/LengthCounter/styles.ts +11 -0
- package/src/components/Modal/index.tsx +30 -0
- package/src/components/Modal/styles.ts +52 -0
- package/src/components/MultiSelect/index.tsx +102 -0
- package/src/components/MultiSelect/styles.tsx +85 -0
- package/src/components/PersonasArea/index.tsx +206 -0
- package/src/components/PersonasArea/styles.ts +205 -0
- package/src/components/Select/index.tsx +60 -0
- package/src/components/Select/styles.tsx +49 -0
- package/src/components/TestArea/components/InputTest/index.tsx +24 -0
- package/src/components/TestArea/components/InputTest/styles.tsx +28 -0
- package/src/components/TestArea/components/TextArea/index.tsx +97 -0
- package/src/components/TestArea/components/TextArea/styles.tsx +173 -0
- package/src/components/TestArea/index.tsx +99 -0
- package/src/components/TestArea/styles.tsx +112 -0
- package/src/contexts/LeiaProvider.tsx +133 -0
- package/src/index.tsx +6 -0
- package/src/interface/FileData.ts +11 -0
- package/src/interface/Language.ts +95 -0
- package/src/interface/Table.ts +12 -0
- package/src/service/Api.ts +9 -0
- package/src/service/ApiDev.ts +9 -0
- package/src/service/ApiHml.ts +9 -0
- package/src/store/index.ts +13 -0
- package/src/store/modules/actions.ts +88 -0
- package/src/store/modules/reducer.ts +46 -0
- package/src/store/modules/sagas.ts +127 -0
- package/src/store/modules/types.ts +19 -0
- package/src/types/image.d.ts +4 -0
- package/src/utils/formatAxios.tsx +15 -0
- package/src/utils/getApi.tsx +16 -0
- package/src/utils/getLanguage.tsx +17 -0
- package/src/utils/languages/en.ts +108 -0
- package/src/utils/languages/es.ts +108 -0
- package/src/utils/languages/pt-br.ts +112 -0
- package/src/utils/stringNormalize.ts +9 -0
- package/dist/code7-leia.css +0 -1
- package/dist/index.cjs.js +0 -1073
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
type FileArea = {
|
|
2
|
+
description: string;
|
|
3
|
+
status: string;
|
|
4
|
+
fileName: string;
|
|
5
|
+
presset: string;
|
|
6
|
+
actions: string;
|
|
7
|
+
search: string;
|
|
8
|
+
fileUpload: string;
|
|
9
|
+
training: string;
|
|
10
|
+
emptyState: {
|
|
11
|
+
title: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
modal: {
|
|
15
|
+
descriptionUpload: string;
|
|
16
|
+
chooseFile: string;
|
|
17
|
+
uploadFile: string;
|
|
18
|
+
deleteFileTitle: string;
|
|
19
|
+
deleteFile: string;
|
|
20
|
+
trainingTitle: string;
|
|
21
|
+
trainingDescription: string
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type Buttons = {
|
|
26
|
+
cancel: string;
|
|
27
|
+
send: string;
|
|
28
|
+
delete: string;
|
|
29
|
+
test: string;
|
|
30
|
+
addNewPresset: string;
|
|
31
|
+
addPresset: string;
|
|
32
|
+
training: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type TestArea = {
|
|
36
|
+
description: string;
|
|
37
|
+
typeSentence: string;
|
|
38
|
+
typePrompt: string;
|
|
39
|
+
selectPersona: string;
|
|
40
|
+
selectPresset: string;
|
|
41
|
+
emptyState: {
|
|
42
|
+
title: string;
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
type Toast = {
|
|
48
|
+
deleteFile: {
|
|
49
|
+
success: {
|
|
50
|
+
title: String,
|
|
51
|
+
description: String
|
|
52
|
+
},
|
|
53
|
+
fail: {
|
|
54
|
+
title: String,
|
|
55
|
+
description: String
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
uploadFile: {
|
|
59
|
+
success: {
|
|
60
|
+
title: String,
|
|
61
|
+
description: String
|
|
62
|
+
},
|
|
63
|
+
fail: {
|
|
64
|
+
title: String,
|
|
65
|
+
description: String
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
Test: {
|
|
69
|
+
fail: {
|
|
70
|
+
title: String,
|
|
71
|
+
description: String
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
Train: {
|
|
75
|
+
fail: {
|
|
76
|
+
title: String,
|
|
77
|
+
description: String
|
|
78
|
+
},
|
|
79
|
+
success: {
|
|
80
|
+
title: String,
|
|
81
|
+
description: String
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type Language = any | {
|
|
87
|
+
files: string;
|
|
88
|
+
test: string;
|
|
89
|
+
fileArea: FileArea;
|
|
90
|
+
buttons: Buttons;
|
|
91
|
+
testArea: TestArea;
|
|
92
|
+
toast: Toast;
|
|
93
|
+
personas: any;
|
|
94
|
+
copyPrefix: string;
|
|
95
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface TableProps {
|
|
2
|
+
children: React.ReactNode;
|
|
3
|
+
className?: string;
|
|
4
|
+
size?: 'small' | 'medium' | 'large';
|
|
5
|
+
isloading?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SpinnerProps {
|
|
9
|
+
color?: string;
|
|
10
|
+
size?: 'sm' | 'md' | 'lg';
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createStore, applyMiddleware } from 'redux';
|
|
2
|
+
import createSagaMiddleware from 'redux-saga';
|
|
3
|
+
import Reducer from './modules/reducer';
|
|
4
|
+
import Sagas from './modules/sagas';
|
|
5
|
+
|
|
6
|
+
const sagaMiddleware = createSagaMiddleware();
|
|
7
|
+
|
|
8
|
+
const store = createStore(Reducer, applyMiddleware(sagaMiddleware));
|
|
9
|
+
|
|
10
|
+
sagaMiddleware.run(Sagas);
|
|
11
|
+
|
|
12
|
+
export default store;
|
|
13
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import types from './types'
|
|
2
|
+
|
|
3
|
+
export const getFilesAction = (id: string, token: string, env: string) => {
|
|
4
|
+
return {
|
|
5
|
+
type: types.GET_FILES_REQUEST,
|
|
6
|
+
payload: { id, token, env }
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const getFilesActionSuccess = ({ files }: any) => {
|
|
11
|
+
return {
|
|
12
|
+
type: types.GET_FILES_SUCCESS,
|
|
13
|
+
payload: { files }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const deleteFilesAction = (name: string, id: string, language: string, token: string, env: string) => {
|
|
18
|
+
return {
|
|
19
|
+
type: types.DELETE_FILES_REQUEST,
|
|
20
|
+
payload: { name, id, language, token, env }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const deleteFilesActionSuccess = ({ files }: any) => {
|
|
25
|
+
return {
|
|
26
|
+
type: types.DELETE_FILES_SUCCESS,
|
|
27
|
+
payload: { files }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const uploadFilesAction = (file: any, id: string, pressets: string[], language: string, token: string, env: string) => {
|
|
32
|
+
return {
|
|
33
|
+
type: types.UPLOAD_FILES_REQUEST,
|
|
34
|
+
payload: { file, id, pressets, language, token, env }
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const uploadFilesActionSuccess = ({ files }: any) => {
|
|
39
|
+
return {
|
|
40
|
+
type: types.UPLOAD_FILES_SUCCESS,
|
|
41
|
+
payload: { files }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const trainingAction = (id: string, pressets: string[], language: string, token: string, env: string) => {
|
|
46
|
+
return {
|
|
47
|
+
type: types.TRAINING_REQUEST,
|
|
48
|
+
payload: { id, pressets, language, token, env }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const testAction = (question: string, prompt:string, profile: string, presset: string, files_directory: string, token: string, env: string) => {
|
|
53
|
+
return {
|
|
54
|
+
type: types.TEST_REQUEST,
|
|
55
|
+
payload: { question, prompt, profile, presset, files_directory, token, env }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const testActionSuccess = ({ message }: any) => {
|
|
60
|
+
return {
|
|
61
|
+
type: types.TEST_SUCCESS,
|
|
62
|
+
payload: { message }
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const commonLoadingStart = () => ({
|
|
67
|
+
type: types.LOADING_START,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export const commonLoadingFinish = () => ({
|
|
71
|
+
type: types.LOADING_FINISH,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const commonChangingStart = () => ({
|
|
75
|
+
type: types.CHANGING_START,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const commonChangingFinish = () => ({
|
|
79
|
+
type: types.CHANGING_FINISH,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const commonNetworkOnline = () => ({
|
|
83
|
+
type: types.NETWORK_ONLINE,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export const commonNetworkOffline = () => ({
|
|
87
|
+
type: types.NETWORK_OFFLINE,
|
|
88
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { produce } from 'immer';
|
|
2
|
+
import types from './types'
|
|
3
|
+
|
|
4
|
+
const INITIAL_STATE = {
|
|
5
|
+
files: [],
|
|
6
|
+
message: '',
|
|
7
|
+
isloading: false,
|
|
8
|
+
isChanging: false,
|
|
9
|
+
isOffline: true,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function filesReducer(state = INITIAL_STATE, action: any) {
|
|
13
|
+
return produce(state, (draft) => {
|
|
14
|
+
switch (action.type) {
|
|
15
|
+
case types.GET_FILES_SUCCESS:
|
|
16
|
+
draft.files = action.payload.files;
|
|
17
|
+
break;
|
|
18
|
+
case types.DELETE_FILES_SUCCESS:
|
|
19
|
+
draft.files = action.payload.files;
|
|
20
|
+
break;
|
|
21
|
+
case types.TEST_SUCCESS:
|
|
22
|
+
draft.message = action.payload.message;
|
|
23
|
+
break;
|
|
24
|
+
case types.LOADING_START:
|
|
25
|
+
draft.isloading = true;
|
|
26
|
+
break;
|
|
27
|
+
case types.LOADING_FINISH:
|
|
28
|
+
draft.isloading = false;
|
|
29
|
+
break;
|
|
30
|
+
case types.CHANGING_START:
|
|
31
|
+
draft.isChanging = true;
|
|
32
|
+
break;
|
|
33
|
+
case types.CHANGING_FINISH:
|
|
34
|
+
draft.isChanging = false;
|
|
35
|
+
break;
|
|
36
|
+
case types.NETWORK_ONLINE:
|
|
37
|
+
draft.isOffline = false;
|
|
38
|
+
break;
|
|
39
|
+
case types.NETWORK_OFFLINE:
|
|
40
|
+
draft.isOffline = true;
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
return action.payload;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { takeLatest, all, put, call } from 'redux-saga/effects';
|
|
2
|
+
import { getApi } from '../../utils/getApi'
|
|
3
|
+
import Types from './types'
|
|
4
|
+
import { getFilesActionSuccess,
|
|
5
|
+
deleteFilesActionSuccess,
|
|
6
|
+
testActionSuccess,
|
|
7
|
+
uploadFilesActionSuccess,
|
|
8
|
+
commonLoadingStart,
|
|
9
|
+
commonLoadingFinish, } from './actions'
|
|
10
|
+
import { toast } from '../../components/CustomToast'
|
|
11
|
+
import { getLanguage } from '../../utils/getLanguage'
|
|
12
|
+
|
|
13
|
+
export function* getFilesSaga(action: any) {
|
|
14
|
+
try {
|
|
15
|
+
yield put(commonLoadingStart());
|
|
16
|
+
const { id, token, env } = action.payload
|
|
17
|
+
const api = getApi(env)
|
|
18
|
+
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
19
|
+
yield put(getFilesActionSuccess({ files: data.files}));
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.log('-----------getFiles.error------------------->', error);
|
|
22
|
+
} finally {
|
|
23
|
+
yield put(commonLoadingFinish());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function* deleteFilesSaga(action: any) {
|
|
28
|
+
const t = getLanguage(action.payload.language)
|
|
29
|
+
try {
|
|
30
|
+
yield put(commonLoadingStart());
|
|
31
|
+
const { id, name, token, env } = action.payload
|
|
32
|
+
const api = getApi(env)
|
|
33
|
+
yield call(api.delete, `/delete/${id}/${name}?token=${token}`);
|
|
34
|
+
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
35
|
+
yield put(deleteFilesActionSuccess({ files: data.files, success: true }));
|
|
36
|
+
} catch (error) {
|
|
37
|
+
toast.error({title: t.toast.deleteFile.fail.title, description: t.toast.deleteFile.fail.description});
|
|
38
|
+
console.log('-----------deleteFilesSaga.error------------------->', error);
|
|
39
|
+
} finally {
|
|
40
|
+
yield put(commonLoadingFinish());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function* testSaga(action: any) {
|
|
45
|
+
try {
|
|
46
|
+
yield put(commonLoadingStart());
|
|
47
|
+
const { question, prompt, profile, presset, files_directory, token, env } = action.payload
|
|
48
|
+
const api = getApi(env)
|
|
49
|
+
const { data } = yield call(api.post, `/ask`, { question, description: prompt, profile, tag: presset, files_directory, token });
|
|
50
|
+
yield put(testActionSuccess({ message: data.message }));
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.log('-----------testSaga.error------------------->', error);
|
|
53
|
+
} finally {
|
|
54
|
+
yield put(commonLoadingFinish());
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function* uploadFilesSaga(action: any) {
|
|
59
|
+
const t = getLanguage(action.payload.language);
|
|
60
|
+
try {
|
|
61
|
+
yield put(commonLoadingStart());
|
|
62
|
+
const { id, file, pressets, token, env } = action.payload;
|
|
63
|
+
const api = getApi(env)
|
|
64
|
+
const blob = new Blob([file.content]);
|
|
65
|
+
const formData = new FormData();
|
|
66
|
+
const sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
|
|
67
|
+
formData.append('file', blob, sanitizedPath || 'default_filename');
|
|
68
|
+
|
|
69
|
+
const queryParams = pressets.length
|
|
70
|
+
? new URLSearchParams({ tags: pressets.join(',') }).toString()
|
|
71
|
+
: '';
|
|
72
|
+
|
|
73
|
+
const url = queryParams
|
|
74
|
+
? `/upload/${id}?token=${token}&${queryParams}`
|
|
75
|
+
: `/upload/${id}?token=${token}`;
|
|
76
|
+
|
|
77
|
+
yield call(api.post, url, formData, {
|
|
78
|
+
headers: {
|
|
79
|
+
'Content-Type': 'multipart/form-data',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
84
|
+
yield put(uploadFilesActionSuccess({ files: data.files }));
|
|
85
|
+
} catch (error) {
|
|
86
|
+
toast.error({
|
|
87
|
+
title: t.toast.uploadFile.fail.title,
|
|
88
|
+
description: t.toast.uploadFile.fail.description,
|
|
89
|
+
});
|
|
90
|
+
console.log('-----------uploadFilesSaga.error------------------->', error);
|
|
91
|
+
} finally {
|
|
92
|
+
yield put(commonLoadingFinish());
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
export function* TrainingSaga(action: any) {
|
|
98
|
+
const t = getLanguage(action.payload.language)
|
|
99
|
+
try {
|
|
100
|
+
yield put(commonLoadingStart());
|
|
101
|
+
const { id, pressets, token, env } = action.payload;
|
|
102
|
+
const tag = pressets.join(',');
|
|
103
|
+
const api = getApi(env)
|
|
104
|
+
const queryParams = new URLSearchParams({ tag }).toString();
|
|
105
|
+
|
|
106
|
+
yield call(api.post, pressets.length > 0 ? `/training?${queryParams}` : `/training`,{ files_directory: id, token });
|
|
107
|
+
|
|
108
|
+
const { data } = yield call(api.get, `/training/${id}?token=${token}`);
|
|
109
|
+
yield put(uploadFilesActionSuccess({ files: data.files }));
|
|
110
|
+
toast.success({title: t.toast.Train.success.title, description: t.toast.Train.success.description});
|
|
111
|
+
} catch (error) {
|
|
112
|
+
toast.error({title: t.toast.Train.fail.title, description: t.toast.Train.fail.description});
|
|
113
|
+
console.log('-----------TrainingSaga.error------------------->', error);
|
|
114
|
+
} finally {
|
|
115
|
+
yield put(commonLoadingFinish());
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default function* filesSagas() {
|
|
120
|
+
yield all([
|
|
121
|
+
takeLatest(Types.GET_FILES_REQUEST, getFilesSaga),
|
|
122
|
+
takeLatest(Types.DELETE_FILES_REQUEST, deleteFilesSaga),
|
|
123
|
+
takeLatest(Types.UPLOAD_FILES_REQUEST, uploadFilesSaga),
|
|
124
|
+
takeLatest(Types.TEST_REQUEST, testSaga),
|
|
125
|
+
takeLatest(Types.TRAINING_REQUEST, TrainingSaga)
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const Types = {
|
|
2
|
+
GET_FILES_REQUEST: 'GET_FILES_REQUEST',
|
|
3
|
+
GET_FILES_SUCCESS: 'GET_FILES_SUCCESS',
|
|
4
|
+
DELETE_FILES_REQUEST: 'DELETE_FILES_REQUEST',
|
|
5
|
+
DELETE_FILES_SUCCESS: 'DELETE_FILES_SUCCESS',
|
|
6
|
+
UPLOAD_FILES_REQUEST: 'UPLOAD_FILES_REQUEST',
|
|
7
|
+
UPLOAD_FILES_SUCCESS: 'UPLOAD_FILES_SUCCESS',
|
|
8
|
+
TRAINING_REQUEST: 'TRAINING_REQUEST',
|
|
9
|
+
TEST_REQUEST: 'TEST_REQUEST',
|
|
10
|
+
TEST_SUCCESS: 'TEST_SUCCESS',
|
|
11
|
+
LOADING_START: 'LOADING_START',
|
|
12
|
+
LOADING_FINISH: 'LOADING_FINISH',
|
|
13
|
+
CHANGING_START: 'CHANGING_START',
|
|
14
|
+
CHANGING_FINISH: 'CHANGING_FINISH',
|
|
15
|
+
NETWORK_ONLINE: 'NETWORK_ONLINE',
|
|
16
|
+
NETWORK_OFFLINE: 'NETWORK_OFFLINE',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default Types;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
|
|
3
|
+
type HttpServerMethod = 'get' | 'post' | 'delete' | 'put' | 'patch' | 'options'
|
|
4
|
+
|
|
5
|
+
export async function formatAxios(method: HttpServerMethod, url: string, hasBody:boolean, body:any): Promise<any> {
|
|
6
|
+
if(hasBody){
|
|
7
|
+
const { data } = method !== 'delete' ? await axios[method](url, body) : await axios[method](url, body)
|
|
8
|
+
|
|
9
|
+
return data
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const { data } = await axios[method](url)
|
|
13
|
+
|
|
14
|
+
return data
|
|
15
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import api from '../service/Api'
|
|
2
|
+
import apiHml from '../service/ApiHml'
|
|
3
|
+
import apiDev from '../service/ApiDev'
|
|
4
|
+
|
|
5
|
+
export const getApi = (env: string) => {
|
|
6
|
+
switch (env.toLowerCase()) {
|
|
7
|
+
case 'dev':
|
|
8
|
+
return apiDev;
|
|
9
|
+
case 'prod':
|
|
10
|
+
return api;
|
|
11
|
+
case 'test':
|
|
12
|
+
return apiHml;
|
|
13
|
+
default:
|
|
14
|
+
return api;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Language } from '../interface/Language';
|
|
2
|
+
import { enTranslation } from './languages/en';
|
|
3
|
+
import { ptTranslation } from './languages/pt-br';
|
|
4
|
+
import { esTranslation } from './languages/es';
|
|
5
|
+
|
|
6
|
+
export const getLanguage = (language: keyof Record<'en' | 'pt-br' | 'es', Language>): Language => {
|
|
7
|
+
switch (language) {
|
|
8
|
+
case 'en':
|
|
9
|
+
return enTranslation;
|
|
10
|
+
case 'pt-br':
|
|
11
|
+
return ptTranslation;
|
|
12
|
+
case 'es':
|
|
13
|
+
return esTranslation;
|
|
14
|
+
default:
|
|
15
|
+
return enTranslation;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Language } from "../../interface/Language";
|
|
2
|
+
|
|
3
|
+
export const enTranslation: Language = {
|
|
4
|
+
files: 'Files',
|
|
5
|
+
test: 'Test',
|
|
6
|
+
|
|
7
|
+
search: 'Search',
|
|
8
|
+
edit: 'Edit',
|
|
9
|
+
clone: 'Clone',
|
|
10
|
+
save: 'Save',
|
|
11
|
+
delete: 'Delete',
|
|
12
|
+
copyPrefix: 'Copy',
|
|
13
|
+
|
|
14
|
+
personas: {
|
|
15
|
+
title: 'Personas',
|
|
16
|
+
description: 'Add custom prompts for specific assistant behaviors',
|
|
17
|
+
add: 'Add persona',
|
|
18
|
+
modalTitle: 'Persona',
|
|
19
|
+
modalAlert: 'Are you sure you want to delete',
|
|
20
|
+
|
|
21
|
+
fields: {
|
|
22
|
+
name: 'Name',
|
|
23
|
+
description: 'Description',
|
|
24
|
+
prompt: 'Prompt',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
fileArea: {
|
|
28
|
+
description: 'Manage your files with ease! Add new ones and delete old ones as desired.',
|
|
29
|
+
fileName: 'File name',
|
|
30
|
+
status: 'Status',
|
|
31
|
+
presset: 'Presset',
|
|
32
|
+
actions: 'Actions',
|
|
33
|
+
search: 'Search',
|
|
34
|
+
fileUpload: 'File upload',
|
|
35
|
+
training: 'Train preset',
|
|
36
|
+
emptyState: {
|
|
37
|
+
title: 'No data',
|
|
38
|
+
description: 'No files uploaded yet. Start by adding your documents now!',
|
|
39
|
+
},
|
|
40
|
+
modal: {
|
|
41
|
+
descriptionUpload: 'Drag and drop files here or',
|
|
42
|
+
chooseFile: 'Choose a file',
|
|
43
|
+
uploadFile: 'Upload a file',
|
|
44
|
+
deleteFileTitle: 'Delete a file',
|
|
45
|
+
deleteFile: 'Important! By deleting this file, you will lose all its information and will not be able to recover it.',
|
|
46
|
+
trainingTitle: 'Presset Training',
|
|
47
|
+
trainingDescription: 'Select one or more pressets to be trained. Note: If none are selected, Lira will train all pressets.'
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
buttons: {
|
|
51
|
+
cancel: 'Cancel',
|
|
52
|
+
send: 'Send',
|
|
53
|
+
delete: 'Delete',
|
|
54
|
+
test: 'Test',
|
|
55
|
+
addNewPresset: 'Add new presset',
|
|
56
|
+
addPresset: 'Add presset',
|
|
57
|
+
training: 'Training'
|
|
58
|
+
},
|
|
59
|
+
testArea: {
|
|
60
|
+
description: 'Type a sentence to test artificial intelligence',
|
|
61
|
+
typeSentence: 'Type a sentence',
|
|
62
|
+
typePrompt: 'Insert a custom prompt here',
|
|
63
|
+
selectPersona: 'Select a Persona',
|
|
64
|
+
selectPresset: 'Select a presset',
|
|
65
|
+
emptyState: {
|
|
66
|
+
title: 'No data for analysis',
|
|
67
|
+
description: 'Do a search, click the "Test" button.',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
toast: {
|
|
71
|
+
deleteFile: {
|
|
72
|
+
success: {
|
|
73
|
+
title: 'Success',
|
|
74
|
+
description: 'File deleted successfully!'
|
|
75
|
+
},
|
|
76
|
+
fail: {
|
|
77
|
+
title: 'Failure',
|
|
78
|
+
description: 'Error deleting the file!'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
uploadFile: {
|
|
82
|
+
success: {
|
|
83
|
+
title: 'Success',
|
|
84
|
+
description: 'File uploaded successfully!'
|
|
85
|
+
},
|
|
86
|
+
fail: {
|
|
87
|
+
title: 'Failure',
|
|
88
|
+
description: 'Error uploading the file!'
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
Test: {
|
|
92
|
+
fail: {
|
|
93
|
+
title: 'Failure',
|
|
94
|
+
description: 'Error testing Lira'
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
Train: {
|
|
98
|
+
fail: {
|
|
99
|
+
title: 'Failure',
|
|
100
|
+
description: 'Error training Lira'
|
|
101
|
+
},
|
|
102
|
+
success: {
|
|
103
|
+
title: 'Success',
|
|
104
|
+
description: 'Lira is in the training process!'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|