code7-leia 0.2.26 → 0.2.28
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 +145 -147
- 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 +145 -147
- package/dist/code7-leia.esm.js.map +1 -1
- package/dist/service/ApiDev.d.ts +3 -0
- package/dist/utils/getApi.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/Select/styles.tsx +1 -0
- package/src/components/TestArea/styles.tsx +2 -0
- package/src/contexts/SharedPropsProvider.tsx +4 -4
- package/src/service/ApiDev.ts +9 -0
- package/src/service/ApiHml.ts +1 -1
- package/src/store/modules/sagas.ts +14 -13
- package/src/utils/getApi.tsx +16 -0
package/dist/code7-leia.esm.js
CHANGED
|
@@ -11,12 +11,13 @@ import { TiDelete } from 'react-icons/ti';
|
|
|
11
11
|
import unorm from 'unorm';
|
|
12
12
|
import { MdClose, MdPerson2 } from 'react-icons/md';
|
|
13
13
|
import { useDropzone } from 'react-dropzone';
|
|
14
|
-
import
|
|
14
|
+
import { getApi as getApi$1 } from 'src/utils/getApi';
|
|
15
15
|
import { PiWaveformBold } from 'react-icons/pi';
|
|
16
16
|
import { createStore, applyMiddleware } from 'redux';
|
|
17
17
|
import createSagaMiddleware from 'redux-saga';
|
|
18
18
|
import { produce } from 'immer';
|
|
19
19
|
import { all, takeLatest, put, call } from 'redux-saga/effects';
|
|
20
|
+
import axios from 'axios';
|
|
20
21
|
import { toast as toast$1 } from 'react-toastify';
|
|
21
22
|
import 'react-toastify/dist/ReactToastify.css';
|
|
22
23
|
|
|
@@ -1218,14 +1219,6 @@ AreaUpload.defaultProps = {
|
|
|
1218
1219
|
hasListFiles: true
|
|
1219
1220
|
};
|
|
1220
1221
|
|
|
1221
|
-
var url = 'https://api.leia.digitalcontact.cloud';
|
|
1222
|
-
axios.defaults.baseURL = "" + url;
|
|
1223
|
-
var api = /*#__PURE__*/axios.create();
|
|
1224
|
-
|
|
1225
|
-
var url$1 = 'http://localhost:5000';
|
|
1226
|
-
axios.defaults.baseURL = "" + url$1;
|
|
1227
|
-
var apiHml = /*#__PURE__*/axios.create();
|
|
1228
|
-
|
|
1229
1222
|
var _excluded$5 = ["children"];
|
|
1230
1223
|
var SharedPropsContext = /*#__PURE__*/createContext(undefined);
|
|
1231
1224
|
var useSharedProps = function useSharedProps() {
|
|
@@ -1247,97 +1240,72 @@ var SharedPropsProvider = function SharedPropsProvider(_ref) {
|
|
|
1247
1240
|
var _useState2 = useState(null),
|
|
1248
1241
|
personas = _useState2[0],
|
|
1249
1242
|
setPersonas = _useState2[1];
|
|
1243
|
+
var api = getApi$1(env);
|
|
1250
1244
|
useEffect(function () {
|
|
1251
1245
|
var fetchData = /*#__PURE__*/function () {
|
|
1252
1246
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1253
|
-
var
|
|
1247
|
+
var _yield$api$get, data;
|
|
1254
1248
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1255
1249
|
while (1) switch (_context.prev = _context.next) {
|
|
1256
1250
|
case 0:
|
|
1257
1251
|
_context.prev = 0;
|
|
1258
|
-
|
|
1259
|
-
_context.next = 7;
|
|
1260
|
-
break;
|
|
1261
|
-
}
|
|
1262
|
-
_context.next = 4;
|
|
1252
|
+
_context.next = 3;
|
|
1263
1253
|
return api.get("/tags/" + id);
|
|
1264
|
-
case
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
break;
|
|
1268
|
-
case 7:
|
|
1269
|
-
_context.next = 9;
|
|
1270
|
-
return apiHml.get("/tags/" + id);
|
|
1271
|
-
case 9:
|
|
1272
|
-
_context.t0 = _context.sent;
|
|
1273
|
-
case 10:
|
|
1274
|
-
_ref3 = _context.t0;
|
|
1275
|
-
data = _ref3.data;
|
|
1254
|
+
case 3:
|
|
1255
|
+
_yield$api$get = _context.sent;
|
|
1256
|
+
data = _yield$api$get.data;
|
|
1276
1257
|
if (data) {
|
|
1277
1258
|
setTags(data);
|
|
1278
1259
|
} else {
|
|
1279
1260
|
console.error('Erro ao fazer a solicitação');
|
|
1280
1261
|
}
|
|
1281
|
-
_context.next =
|
|
1262
|
+
_context.next = 11;
|
|
1282
1263
|
break;
|
|
1283
|
-
case
|
|
1284
|
-
_context.prev =
|
|
1285
|
-
_context.
|
|
1286
|
-
console.error('Erro ao fazer a solicitação:', _context.
|
|
1287
|
-
case
|
|
1264
|
+
case 8:
|
|
1265
|
+
_context.prev = 8;
|
|
1266
|
+
_context.t0 = _context["catch"](0);
|
|
1267
|
+
console.error('Erro ao fazer a solicitação:', _context.t0);
|
|
1268
|
+
case 11:
|
|
1288
1269
|
case "end":
|
|
1289
1270
|
return _context.stop();
|
|
1290
1271
|
}
|
|
1291
|
-
}, _callee, null, [[0,
|
|
1272
|
+
}, _callee, null, [[0, 8]]);
|
|
1292
1273
|
}));
|
|
1293
1274
|
return function fetchData() {
|
|
1294
1275
|
return _ref2.apply(this, arguments);
|
|
1295
1276
|
};
|
|
1296
1277
|
}();
|
|
1297
1278
|
var personas = /*#__PURE__*/function () {
|
|
1298
|
-
var
|
|
1299
|
-
var
|
|
1279
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1280
|
+
var _yield$api$get2, data;
|
|
1300
1281
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1301
1282
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1302
1283
|
case 0:
|
|
1303
1284
|
_context2.prev = 0;
|
|
1304
|
-
|
|
1305
|
-
_context2.next = 7;
|
|
1306
|
-
break;
|
|
1307
|
-
}
|
|
1308
|
-
_context2.next = 4;
|
|
1285
|
+
_context2.next = 3;
|
|
1309
1286
|
return api.get("/personas?language=" + language);
|
|
1310
|
-
case
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
break;
|
|
1314
|
-
case 7:
|
|
1315
|
-
_context2.next = 9;
|
|
1316
|
-
return apiHml.get("/personas?language=" + language);
|
|
1317
|
-
case 9:
|
|
1318
|
-
_context2.t0 = _context2.sent;
|
|
1319
|
-
case 10:
|
|
1320
|
-
_ref5 = _context2.t0;
|
|
1321
|
-
data = _ref5.data;
|
|
1287
|
+
case 3:
|
|
1288
|
+
_yield$api$get2 = _context2.sent;
|
|
1289
|
+
data = _yield$api$get2.data;
|
|
1322
1290
|
if (data) {
|
|
1323
1291
|
setPersonas(data);
|
|
1324
1292
|
} else {
|
|
1325
1293
|
console.error('Erro ao fazer a solicitação');
|
|
1326
1294
|
}
|
|
1327
|
-
_context2.next =
|
|
1295
|
+
_context2.next = 11;
|
|
1328
1296
|
break;
|
|
1329
|
-
case
|
|
1330
|
-
_context2.prev =
|
|
1331
|
-
_context2.
|
|
1332
|
-
console.error('Erro ao fazer a solicitação:', _context2.
|
|
1333
|
-
case
|
|
1297
|
+
case 8:
|
|
1298
|
+
_context2.prev = 8;
|
|
1299
|
+
_context2.t0 = _context2["catch"](0);
|
|
1300
|
+
console.error('Erro ao fazer a solicitação:', _context2.t0);
|
|
1301
|
+
case 11:
|
|
1334
1302
|
case "end":
|
|
1335
1303
|
return _context2.stop();
|
|
1336
1304
|
}
|
|
1337
|
-
}, _callee2, null, [[0,
|
|
1305
|
+
}, _callee2, null, [[0, 8]]);
|
|
1338
1306
|
}));
|
|
1339
1307
|
return function personas() {
|
|
1340
|
-
return
|
|
1308
|
+
return _ref3.apply(this, arguments);
|
|
1341
1309
|
};
|
|
1342
1310
|
}();
|
|
1343
1311
|
fetchData();
|
|
@@ -1798,11 +1766,11 @@ var Container$3 = /*#__PURE__*/styled.div(_templateObject$9 || (_templateObject$
|
|
|
1798
1766
|
return props.isloading && css(_templateObject2$6 || (_templateObject2$6 = _taggedTemplateLiteralLoose(["\n #loading {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgb(151,154,165, 0.7);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n }\n\n #loading::after {\n content: \"\";\n border: 4px solid #f3f3f3; /* Cor do s\xEDmbolo de carregamento */\n border-top: 4px solid #5a5d68; /* Cor do s\xEDmbolo de carregamento */\n border-radius: 50%;\n width: 13px;\n height: 13px;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "])));
|
|
1799
1767
|
});
|
|
1800
1768
|
var Header$1 = /*#__PURE__*/styled.div(_templateObject3$5 || (_templateObject3$5 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n .infos {\n display: flex;\n flex-direction: column;\n padding: 14px 0;\n\n h2 {\n font-size: 20px\n }\n\n p {\n font-size: 14px\n }\n }\n"])));
|
|
1801
|
-
var Inputs = /*#__PURE__*/styled.div(_templateObject4$2 || (_templateObject4$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n justify-content: space-between;\n margin-bottom: 10px;\n\n button {\n background: #102693;\n padding: 10px 20px;\n color: white;\n border-radius: 4px;\n width: 190px;\n height: 45px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: 23px;\n height: 23px;\n }\n }\n"])));
|
|
1769
|
+
var Inputs = /*#__PURE__*/styled.div(_templateObject4$2 || (_templateObject4$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-flex;\n justify-content: space-between;\n margin-bottom: 10px;\n width: 725px;\n margin-right: 500px;\n\n button {\n background: #102693;\n padding: 10px 20px;\n color: white;\n border-radius: 4px;\n width: 190px;\n height: 45px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n\n svg {\n width: 23px;\n height: 23px;\n }\n }\n"])));
|
|
1802
1770
|
var Result = /*#__PURE__*/styled.div(_templateObject5$2 || (_templateObject5$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: left;\n background: #F3F5F9;\n padding: 15px;\n border-radius: 5px;\n margin-top: 15px;\n\n .text{\n margin-left: 5px;\n font-size: 14px;\n line-height: 1.5;\n }\n\n .icon {\n display: flex;\n justify-content: center;\n align-items: center;\n margin-right: 5px;\n\n svg {\n width: 35px;\n height: 35px;\n }\n }\n\n"])));
|
|
1803
1771
|
|
|
1804
1772
|
var _templateObject$a;
|
|
1805
|
-
var Container$4 = /*#__PURE__*/styled.div(_templateObject$a || (_templateObject$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 50%;\n margin-right: 5px;\n\n .custom-select {\n position: relative;\n width: 100%;\n cursor: pointer;\n\n .selected-option {\n padding: 12px;\n border-radius: 4px;\n border: 1px solid #979AA5;\n height: 45px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 14px;\n }\n\n .options {\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n border: 1px solid #979AA5;\n border-top: none;\n border-radius: 0 0 4px 4px;\n background-color: #fff;\n\n .option {\n padding: 12px;\n cursor: pointer;\n transition: background-color 0.1s;\n letter-spacing: 0.5px;\n font-size: 14px;\n\n &:hover {\n background-color: #6690ff;\n color: white;\n }\n }\n }\n }\n"])));
|
|
1773
|
+
var Container$4 = /*#__PURE__*/styled.div(_templateObject$a || (_templateObject$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 50%;\n margin-right: 5px;\n\n .custom-select {\n position: relative;\n width: 100%;\n cursor: pointer;\n\n .selected-option {\n padding: 12px;\n border-radius: 4px;\n border: 1px solid #979AA5;\n height: 45px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 14px;\n }\n\n .options {\n position: absolute;\n top: 100%;\n left: 0;\n width: 100%;\n border: 1px solid #979AA5;\n border-top: none;\n border-radius: 0 0 4px 4px;\n background-color: #fff;\n z-index: 9;\n\n .option {\n padding: 12px;\n cursor: pointer;\n transition: background-color 0.1s;\n letter-spacing: 0.5px;\n font-size: 14px;\n\n &:hover {\n background-color: #6690ff;\n color: white;\n }\n }\n }\n }\n"])));
|
|
1806
1774
|
|
|
1807
1775
|
var CustomSelect = function CustomSelect(_ref) {
|
|
1808
1776
|
var options = _ref.options,
|
|
@@ -2128,6 +2096,31 @@ function filesReducer(state, action) {
|
|
|
2128
2096
|
});
|
|
2129
2097
|
}
|
|
2130
2098
|
|
|
2099
|
+
var url = 'https://api.leia.digitalcontact.cloud';
|
|
2100
|
+
axios.defaults.baseURL = "" + url;
|
|
2101
|
+
var api = /*#__PURE__*/axios.create();
|
|
2102
|
+
|
|
2103
|
+
var url$1 = 'https://api-hml.leia.digitalcontact.cloud';
|
|
2104
|
+
axios.defaults.baseURL = "" + url$1;
|
|
2105
|
+
var apiHml = /*#__PURE__*/axios.create();
|
|
2106
|
+
|
|
2107
|
+
var url$2 = 'http://localhost:5000';
|
|
2108
|
+
axios.defaults.baseURL = "" + url$2;
|
|
2109
|
+
var apiDev = /*#__PURE__*/axios.create();
|
|
2110
|
+
|
|
2111
|
+
var getApi = function getApi(env) {
|
|
2112
|
+
switch (env.toLowerCase()) {
|
|
2113
|
+
case 'dev':
|
|
2114
|
+
return apiDev;
|
|
2115
|
+
case 'prod':
|
|
2116
|
+
return api;
|
|
2117
|
+
case 'test':
|
|
2118
|
+
return apiHml;
|
|
2119
|
+
default:
|
|
2120
|
+
return api;
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
|
|
2131
2124
|
var CustomToastContent = function CustomToastContent(_ref) {
|
|
2132
2125
|
var title = _ref.title,
|
|
2133
2126
|
description = _ref.description;
|
|
@@ -2181,7 +2174,7 @@ var _marked = /*#__PURE__*/_regeneratorRuntime().mark(getFilesSaga),
|
|
|
2181
2174
|
_marked5 = /*#__PURE__*/_regeneratorRuntime().mark(TrainingSaga),
|
|
2182
2175
|
_marked6 = /*#__PURE__*/_regeneratorRuntime().mark(filesSagas);
|
|
2183
2176
|
function getFilesSaga(action) {
|
|
2184
|
-
var _action$payload, id, token, env, _yield$call, data;
|
|
2177
|
+
var _action$payload, id, token, env, api, _yield$call, data;
|
|
2185
2178
|
return _regeneratorRuntime().wrap(function getFilesSaga$(_context) {
|
|
2186
2179
|
while (1) switch (_context.prev = _context.next) {
|
|
2187
2180
|
case 0:
|
|
@@ -2190,36 +2183,37 @@ function getFilesSaga(action) {
|
|
|
2190
2183
|
return put(commonLoadingStart());
|
|
2191
2184
|
case 3:
|
|
2192
2185
|
_action$payload = action.payload, id = _action$payload.id, token = _action$payload.token, env = _action$payload.env;
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2186
|
+
api = getApi(env);
|
|
2187
|
+
_context.next = 7;
|
|
2188
|
+
return call(api.get, "/training/" + id + "?token=" + token);
|
|
2189
|
+
case 7:
|
|
2196
2190
|
_yield$call = _context.sent;
|
|
2197
2191
|
data = _yield$call.data;
|
|
2198
|
-
_context.next =
|
|
2192
|
+
_context.next = 11;
|
|
2199
2193
|
return put(getFilesActionSuccess({
|
|
2200
2194
|
files: data.files
|
|
2201
2195
|
}));
|
|
2202
|
-
case
|
|
2203
|
-
_context.next =
|
|
2196
|
+
case 11:
|
|
2197
|
+
_context.next = 16;
|
|
2204
2198
|
break;
|
|
2205
|
-
case
|
|
2206
|
-
_context.prev =
|
|
2199
|
+
case 13:
|
|
2200
|
+
_context.prev = 13;
|
|
2207
2201
|
_context.t0 = _context["catch"](0);
|
|
2208
2202
|
console.log('-----------getFiles.error------------------->', _context.t0);
|
|
2209
|
-
case
|
|
2210
|
-
_context.prev =
|
|
2211
|
-
_context.next =
|
|
2203
|
+
case 16:
|
|
2204
|
+
_context.prev = 16;
|
|
2205
|
+
_context.next = 19;
|
|
2212
2206
|
return put(commonLoadingFinish());
|
|
2213
|
-
case 18:
|
|
2214
|
-
return _context.finish(15);
|
|
2215
2207
|
case 19:
|
|
2208
|
+
return _context.finish(16);
|
|
2209
|
+
case 20:
|
|
2216
2210
|
case "end":
|
|
2217
2211
|
return _context.stop();
|
|
2218
2212
|
}
|
|
2219
|
-
}, _marked, null, [[0,
|
|
2213
|
+
}, _marked, null, [[0, 13, 16, 20]]);
|
|
2220
2214
|
}
|
|
2221
2215
|
function deleteFilesSaga(action) {
|
|
2222
|
-
var t, _action$payload2, id, name, token, env, _yield$call2, data;
|
|
2216
|
+
var t, _action$payload2, id, name, token, env, api, _yield$call2, data;
|
|
2223
2217
|
return _regeneratorRuntime().wrap(function deleteFilesSaga$(_context2) {
|
|
2224
2218
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2225
2219
|
case 0:
|
|
@@ -2229,44 +2223,45 @@ function deleteFilesSaga(action) {
|
|
|
2229
2223
|
return put(commonLoadingStart());
|
|
2230
2224
|
case 4:
|
|
2231
2225
|
_action$payload2 = action.payload, id = _action$payload2.id, name = _action$payload2.name, token = _action$payload2.token, env = _action$payload2.env;
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2226
|
+
api = getApi(env);
|
|
2227
|
+
_context2.next = 8;
|
|
2228
|
+
return call(api["delete"], "/delete/" + id + "/" + name + "?token=" + token);
|
|
2229
|
+
case 8:
|
|
2230
|
+
_context2.next = 10;
|
|
2231
|
+
return call(api.get, "/training/" + id + "?token=" + token);
|
|
2232
|
+
case 10:
|
|
2238
2233
|
_yield$call2 = _context2.sent;
|
|
2239
2234
|
data = _yield$call2.data;
|
|
2240
|
-
_context2.next =
|
|
2235
|
+
_context2.next = 14;
|
|
2241
2236
|
return put(deleteFilesActionSuccess({
|
|
2242
2237
|
files: data.files,
|
|
2243
2238
|
success: true
|
|
2244
2239
|
}));
|
|
2245
|
-
case
|
|
2246
|
-
_context2.next =
|
|
2240
|
+
case 14:
|
|
2241
|
+
_context2.next = 20;
|
|
2247
2242
|
break;
|
|
2248
|
-
case
|
|
2249
|
-
_context2.prev =
|
|
2243
|
+
case 16:
|
|
2244
|
+
_context2.prev = 16;
|
|
2250
2245
|
_context2.t0 = _context2["catch"](1);
|
|
2251
2246
|
toast.error({
|
|
2252
2247
|
title: t.toast.deleteFile.fail.title,
|
|
2253
2248
|
description: t.toast.deleteFile.fail.description
|
|
2254
2249
|
});
|
|
2255
2250
|
console.log('-----------deleteFilesSaga.error------------------->', _context2.t0);
|
|
2256
|
-
case
|
|
2257
|
-
_context2.prev =
|
|
2258
|
-
_context2.next =
|
|
2251
|
+
case 20:
|
|
2252
|
+
_context2.prev = 20;
|
|
2253
|
+
_context2.next = 23;
|
|
2259
2254
|
return put(commonLoadingFinish());
|
|
2260
|
-
case 22:
|
|
2261
|
-
return _context2.finish(19);
|
|
2262
2255
|
case 23:
|
|
2256
|
+
return _context2.finish(20);
|
|
2257
|
+
case 24:
|
|
2263
2258
|
case "end":
|
|
2264
2259
|
return _context2.stop();
|
|
2265
2260
|
}
|
|
2266
|
-
}, _marked2, null, [[1,
|
|
2261
|
+
}, _marked2, null, [[1, 16, 20, 24]]);
|
|
2267
2262
|
}
|
|
2268
2263
|
function testSaga(action) {
|
|
2269
|
-
var _action$payload3, question, prompt, profile, presset, files_directory, token, env, _yield$call3, data;
|
|
2264
|
+
var _action$payload3, question, prompt, profile, presset, files_directory, token, env, api, _yield$call3, data;
|
|
2270
2265
|
return _regeneratorRuntime().wrap(function testSaga$(_context3) {
|
|
2271
2266
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2272
2267
|
case 0:
|
|
@@ -2275,8 +2270,9 @@ function testSaga(action) {
|
|
|
2275
2270
|
return put(commonLoadingStart());
|
|
2276
2271
|
case 3:
|
|
2277
2272
|
_action$payload3 = action.payload, question = _action$payload3.question, prompt = _action$payload3.prompt, profile = _action$payload3.profile, presset = _action$payload3.presset, files_directory = _action$payload3.files_directory, token = _action$payload3.token, env = _action$payload3.env;
|
|
2278
|
-
|
|
2279
|
-
|
|
2273
|
+
api = getApi(env);
|
|
2274
|
+
_context3.next = 7;
|
|
2275
|
+
return call(api.post, "/ask", {
|
|
2280
2276
|
question: question,
|
|
2281
2277
|
description: prompt,
|
|
2282
2278
|
profile: profile,
|
|
@@ -2284,34 +2280,34 @@ function testSaga(action) {
|
|
|
2284
2280
|
files_directory: files_directory,
|
|
2285
2281
|
token: token
|
|
2286
2282
|
});
|
|
2287
|
-
case
|
|
2283
|
+
case 7:
|
|
2288
2284
|
_yield$call3 = _context3.sent;
|
|
2289
2285
|
data = _yield$call3.data;
|
|
2290
|
-
_context3.next =
|
|
2286
|
+
_context3.next = 11;
|
|
2291
2287
|
return put(testActionSuccess({
|
|
2292
2288
|
message: data.message
|
|
2293
2289
|
}));
|
|
2294
|
-
case
|
|
2295
|
-
_context3.next =
|
|
2290
|
+
case 11:
|
|
2291
|
+
_context3.next = 16;
|
|
2296
2292
|
break;
|
|
2297
|
-
case
|
|
2298
|
-
_context3.prev =
|
|
2293
|
+
case 13:
|
|
2294
|
+
_context3.prev = 13;
|
|
2299
2295
|
_context3.t0 = _context3["catch"](0);
|
|
2300
2296
|
console.log('-----------testSaga.error------------------->', _context3.t0);
|
|
2301
|
-
case
|
|
2302
|
-
_context3.prev =
|
|
2303
|
-
_context3.next =
|
|
2297
|
+
case 16:
|
|
2298
|
+
_context3.prev = 16;
|
|
2299
|
+
_context3.next = 19;
|
|
2304
2300
|
return put(commonLoadingFinish());
|
|
2305
|
-
case 18:
|
|
2306
|
-
return _context3.finish(15);
|
|
2307
2301
|
case 19:
|
|
2302
|
+
return _context3.finish(16);
|
|
2303
|
+
case 20:
|
|
2308
2304
|
case "end":
|
|
2309
2305
|
return _context3.stop();
|
|
2310
2306
|
}
|
|
2311
|
-
}, _marked3, null, [[0,
|
|
2307
|
+
}, _marked3, null, [[0, 13, 16, 20]]);
|
|
2312
2308
|
}
|
|
2313
2309
|
function uploadFilesSaga(action) {
|
|
2314
|
-
var t, _action$payload4, id, file, pressets, token, env, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
|
|
2310
|
+
var t, _action$payload4, id, file, pressets, token, env, api, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
|
|
2315
2311
|
return _regeneratorRuntime().wrap(function uploadFilesSaga$(_context4) {
|
|
2316
2312
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2317
2313
|
case 0:
|
|
@@ -2321,6 +2317,7 @@ function uploadFilesSaga(action) {
|
|
|
2321
2317
|
return put(commonLoadingStart());
|
|
2322
2318
|
case 4:
|
|
2323
2319
|
_action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token, env = _action$payload4.env;
|
|
2320
|
+
api = getApi(env);
|
|
2324
2321
|
blob = new Blob([file.content]);
|
|
2325
2322
|
formData = new FormData();
|
|
2326
2323
|
sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
|
|
@@ -2329,47 +2326,47 @@ function uploadFilesSaga(action) {
|
|
|
2329
2326
|
tags: pressets.join(',')
|
|
2330
2327
|
}).toString() : '';
|
|
2331
2328
|
url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
|
|
2332
|
-
_context4.next =
|
|
2333
|
-
return call(
|
|
2329
|
+
_context4.next = 14;
|
|
2330
|
+
return call(api.post, url, formData, {
|
|
2334
2331
|
headers: {
|
|
2335
2332
|
'Content-Type': 'multipart/form-data'
|
|
2336
2333
|
}
|
|
2337
2334
|
});
|
|
2338
|
-
case
|
|
2339
|
-
_context4.next =
|
|
2340
|
-
return call(
|
|
2341
|
-
case
|
|
2335
|
+
case 14:
|
|
2336
|
+
_context4.next = 16;
|
|
2337
|
+
return call(api.get, "/training/" + id + "?token=" + token);
|
|
2338
|
+
case 16:
|
|
2342
2339
|
_yield$call4 = _context4.sent;
|
|
2343
2340
|
data = _yield$call4.data;
|
|
2344
|
-
_context4.next =
|
|
2341
|
+
_context4.next = 20;
|
|
2345
2342
|
return put(uploadFilesActionSuccess({
|
|
2346
2343
|
files: data.files
|
|
2347
2344
|
}));
|
|
2348
|
-
case
|
|
2349
|
-
_context4.next =
|
|
2345
|
+
case 20:
|
|
2346
|
+
_context4.next = 26;
|
|
2350
2347
|
break;
|
|
2351
|
-
case
|
|
2352
|
-
_context4.prev =
|
|
2348
|
+
case 22:
|
|
2349
|
+
_context4.prev = 22;
|
|
2353
2350
|
_context4.t0 = _context4["catch"](1);
|
|
2354
2351
|
toast.error({
|
|
2355
2352
|
title: t.toast.uploadFile.fail.title,
|
|
2356
2353
|
description: t.toast.uploadFile.fail.description
|
|
2357
2354
|
});
|
|
2358
2355
|
console.log('-----------uploadFilesSaga.error------------------->', _context4.t0);
|
|
2359
|
-
case
|
|
2360
|
-
_context4.prev =
|
|
2361
|
-
_context4.next =
|
|
2356
|
+
case 26:
|
|
2357
|
+
_context4.prev = 26;
|
|
2358
|
+
_context4.next = 29;
|
|
2362
2359
|
return put(commonLoadingFinish());
|
|
2363
|
-
case 28:
|
|
2364
|
-
return _context4.finish(25);
|
|
2365
2360
|
case 29:
|
|
2361
|
+
return _context4.finish(26);
|
|
2362
|
+
case 30:
|
|
2366
2363
|
case "end":
|
|
2367
2364
|
return _context4.stop();
|
|
2368
2365
|
}
|
|
2369
|
-
}, _marked4, null, [[1,
|
|
2366
|
+
}, _marked4, null, [[1, 22, 26, 30]]);
|
|
2370
2367
|
}
|
|
2371
2368
|
function TrainingSaga(action) {
|
|
2372
|
-
var t, _action$payload5, id, pressets, token, env, tag, queryParams, _yield$call5, data;
|
|
2369
|
+
var t, _action$payload5, id, pressets, token, env, tag, api, queryParams, _yield$call5, data;
|
|
2373
2370
|
return _regeneratorRuntime().wrap(function TrainingSaga$(_context5) {
|
|
2374
2371
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2375
2372
|
case 0:
|
|
@@ -2380,50 +2377,51 @@ function TrainingSaga(action) {
|
|
|
2380
2377
|
case 4:
|
|
2381
2378
|
_action$payload5 = action.payload, id = _action$payload5.id, pressets = _action$payload5.pressets, token = _action$payload5.token, env = _action$payload5.env;
|
|
2382
2379
|
tag = pressets.join(',');
|
|
2380
|
+
api = getApi(env);
|
|
2383
2381
|
queryParams = new URLSearchParams({
|
|
2384
2382
|
tag: tag
|
|
2385
2383
|
}).toString();
|
|
2386
|
-
_context5.next =
|
|
2387
|
-
return call(
|
|
2384
|
+
_context5.next = 10;
|
|
2385
|
+
return call(api.post, pressets.length > 0 ? "/training?" + queryParams : "/training", {
|
|
2388
2386
|
files_directory: id,
|
|
2389
2387
|
token: token
|
|
2390
2388
|
});
|
|
2391
|
-
case
|
|
2392
|
-
_context5.next =
|
|
2393
|
-
return call(
|
|
2394
|
-
case
|
|
2389
|
+
case 10:
|
|
2390
|
+
_context5.next = 12;
|
|
2391
|
+
return call(api.get, "/training/" + id + "?token=" + token);
|
|
2392
|
+
case 12:
|
|
2395
2393
|
_yield$call5 = _context5.sent;
|
|
2396
2394
|
data = _yield$call5.data;
|
|
2397
|
-
_context5.next =
|
|
2395
|
+
_context5.next = 16;
|
|
2398
2396
|
return put(uploadFilesActionSuccess({
|
|
2399
2397
|
files: data.files
|
|
2400
2398
|
}));
|
|
2401
|
-
case
|
|
2399
|
+
case 16:
|
|
2402
2400
|
toast.success({
|
|
2403
2401
|
title: t.toast.Train.success.title,
|
|
2404
2402
|
description: t.toast.Train.success.description
|
|
2405
2403
|
});
|
|
2406
|
-
_context5.next =
|
|
2404
|
+
_context5.next = 23;
|
|
2407
2405
|
break;
|
|
2408
|
-
case
|
|
2409
|
-
_context5.prev =
|
|
2406
|
+
case 19:
|
|
2407
|
+
_context5.prev = 19;
|
|
2410
2408
|
_context5.t0 = _context5["catch"](1);
|
|
2411
2409
|
toast.error({
|
|
2412
2410
|
title: t.toast.Train.fail.title,
|
|
2413
2411
|
description: t.toast.Train.fail.description
|
|
2414
2412
|
});
|
|
2415
2413
|
console.log('-----------TrainingSaga.error------------------->', _context5.t0);
|
|
2416
|
-
case
|
|
2417
|
-
_context5.prev =
|
|
2418
|
-
_context5.next =
|
|
2414
|
+
case 23:
|
|
2415
|
+
_context5.prev = 23;
|
|
2416
|
+
_context5.next = 26;
|
|
2419
2417
|
return put(commonLoadingFinish());
|
|
2420
|
-
case 25:
|
|
2421
|
-
return _context5.finish(22);
|
|
2422
2418
|
case 26:
|
|
2419
|
+
return _context5.finish(23);
|
|
2420
|
+
case 27:
|
|
2423
2421
|
case "end":
|
|
2424
2422
|
return _context5.stop();
|
|
2425
2423
|
}
|
|
2426
|
-
}, _marked5, null, [[1,
|
|
2424
|
+
}, _marked5, null, [[1, 19, 23, 27]]);
|
|
2427
2425
|
}
|
|
2428
2426
|
function filesSagas() {
|
|
2429
2427
|
return _regeneratorRuntime().wrap(function filesSagas$(_context6) {
|