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
|
@@ -19,12 +19,13 @@ var ti = require('react-icons/ti');
|
|
|
19
19
|
var unorm = _interopDefault(require('unorm'));
|
|
20
20
|
var md = require('react-icons/md');
|
|
21
21
|
var reactDropzone = require('react-dropzone');
|
|
22
|
-
var
|
|
22
|
+
var getApi$1 = require('src/utils/getApi');
|
|
23
23
|
var pi = require('react-icons/pi');
|
|
24
24
|
var redux = require('redux');
|
|
25
25
|
var createSagaMiddleware = _interopDefault(require('redux-saga'));
|
|
26
26
|
var immer = require('immer');
|
|
27
27
|
var effects = require('redux-saga/effects');
|
|
28
|
+
var axios = _interopDefault(require('axios'));
|
|
28
29
|
var reactToastify = require('react-toastify');
|
|
29
30
|
require('react-toastify/dist/ReactToastify.css');
|
|
30
31
|
|
|
@@ -1226,14 +1227,6 @@ AreaUpload.defaultProps = {
|
|
|
1226
1227
|
hasListFiles: true
|
|
1227
1228
|
};
|
|
1228
1229
|
|
|
1229
|
-
var url = 'https://api.leia.digitalcontact.cloud';
|
|
1230
|
-
axios.defaults.baseURL = "" + url;
|
|
1231
|
-
var api = /*#__PURE__*/axios.create();
|
|
1232
|
-
|
|
1233
|
-
var url$1 = 'http://localhost:5000';
|
|
1234
|
-
axios.defaults.baseURL = "" + url$1;
|
|
1235
|
-
var apiHml = /*#__PURE__*/axios.create();
|
|
1236
|
-
|
|
1237
1230
|
var _excluded$5 = ["children"];
|
|
1238
1231
|
var SharedPropsContext = /*#__PURE__*/React.createContext(undefined);
|
|
1239
1232
|
var useSharedProps = function useSharedProps() {
|
|
@@ -1255,97 +1248,72 @@ var SharedPropsProvider = function SharedPropsProvider(_ref) {
|
|
|
1255
1248
|
var _useState2 = React.useState(null),
|
|
1256
1249
|
personas = _useState2[0],
|
|
1257
1250
|
setPersonas = _useState2[1];
|
|
1251
|
+
var api = getApi$1.getApi(env);
|
|
1258
1252
|
React.useEffect(function () {
|
|
1259
1253
|
var fetchData = /*#__PURE__*/function () {
|
|
1260
1254
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1261
|
-
var
|
|
1255
|
+
var _yield$api$get, data;
|
|
1262
1256
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1263
1257
|
while (1) switch (_context.prev = _context.next) {
|
|
1264
1258
|
case 0:
|
|
1265
1259
|
_context.prev = 0;
|
|
1266
|
-
|
|
1267
|
-
_context.next = 7;
|
|
1268
|
-
break;
|
|
1269
|
-
}
|
|
1270
|
-
_context.next = 4;
|
|
1260
|
+
_context.next = 3;
|
|
1271
1261
|
return api.get("/tags/" + id);
|
|
1272
|
-
case
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
break;
|
|
1276
|
-
case 7:
|
|
1277
|
-
_context.next = 9;
|
|
1278
|
-
return apiHml.get("/tags/" + id);
|
|
1279
|
-
case 9:
|
|
1280
|
-
_context.t0 = _context.sent;
|
|
1281
|
-
case 10:
|
|
1282
|
-
_ref3 = _context.t0;
|
|
1283
|
-
data = _ref3.data;
|
|
1262
|
+
case 3:
|
|
1263
|
+
_yield$api$get = _context.sent;
|
|
1264
|
+
data = _yield$api$get.data;
|
|
1284
1265
|
if (data) {
|
|
1285
1266
|
setTags(data);
|
|
1286
1267
|
} else {
|
|
1287
1268
|
console.error('Erro ao fazer a solicitação');
|
|
1288
1269
|
}
|
|
1289
|
-
_context.next =
|
|
1270
|
+
_context.next = 11;
|
|
1290
1271
|
break;
|
|
1291
|
-
case
|
|
1292
|
-
_context.prev =
|
|
1293
|
-
_context.
|
|
1294
|
-
console.error('Erro ao fazer a solicitação:', _context.
|
|
1295
|
-
case
|
|
1272
|
+
case 8:
|
|
1273
|
+
_context.prev = 8;
|
|
1274
|
+
_context.t0 = _context["catch"](0);
|
|
1275
|
+
console.error('Erro ao fazer a solicitação:', _context.t0);
|
|
1276
|
+
case 11:
|
|
1296
1277
|
case "end":
|
|
1297
1278
|
return _context.stop();
|
|
1298
1279
|
}
|
|
1299
|
-
}, _callee, null, [[0,
|
|
1280
|
+
}, _callee, null, [[0, 8]]);
|
|
1300
1281
|
}));
|
|
1301
1282
|
return function fetchData() {
|
|
1302
1283
|
return _ref2.apply(this, arguments);
|
|
1303
1284
|
};
|
|
1304
1285
|
}();
|
|
1305
1286
|
var personas = /*#__PURE__*/function () {
|
|
1306
|
-
var
|
|
1307
|
-
var
|
|
1287
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1288
|
+
var _yield$api$get2, data;
|
|
1308
1289
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1309
1290
|
while (1) switch (_context2.prev = _context2.next) {
|
|
1310
1291
|
case 0:
|
|
1311
1292
|
_context2.prev = 0;
|
|
1312
|
-
|
|
1313
|
-
_context2.next = 7;
|
|
1314
|
-
break;
|
|
1315
|
-
}
|
|
1316
|
-
_context2.next = 4;
|
|
1293
|
+
_context2.next = 3;
|
|
1317
1294
|
return api.get("/personas?language=" + language);
|
|
1318
|
-
case
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
break;
|
|
1322
|
-
case 7:
|
|
1323
|
-
_context2.next = 9;
|
|
1324
|
-
return apiHml.get("/personas?language=" + language);
|
|
1325
|
-
case 9:
|
|
1326
|
-
_context2.t0 = _context2.sent;
|
|
1327
|
-
case 10:
|
|
1328
|
-
_ref5 = _context2.t0;
|
|
1329
|
-
data = _ref5.data;
|
|
1295
|
+
case 3:
|
|
1296
|
+
_yield$api$get2 = _context2.sent;
|
|
1297
|
+
data = _yield$api$get2.data;
|
|
1330
1298
|
if (data) {
|
|
1331
1299
|
setPersonas(data);
|
|
1332
1300
|
} else {
|
|
1333
1301
|
console.error('Erro ao fazer a solicitação');
|
|
1334
1302
|
}
|
|
1335
|
-
_context2.next =
|
|
1303
|
+
_context2.next = 11;
|
|
1336
1304
|
break;
|
|
1337
|
-
case
|
|
1338
|
-
_context2.prev =
|
|
1339
|
-
_context2.
|
|
1340
|
-
console.error('Erro ao fazer a solicitação:', _context2.
|
|
1341
|
-
case
|
|
1305
|
+
case 8:
|
|
1306
|
+
_context2.prev = 8;
|
|
1307
|
+
_context2.t0 = _context2["catch"](0);
|
|
1308
|
+
console.error('Erro ao fazer a solicitação:', _context2.t0);
|
|
1309
|
+
case 11:
|
|
1342
1310
|
case "end":
|
|
1343
1311
|
return _context2.stop();
|
|
1344
1312
|
}
|
|
1345
|
-
}, _callee2, null, [[0,
|
|
1313
|
+
}, _callee2, null, [[0, 8]]);
|
|
1346
1314
|
}));
|
|
1347
1315
|
return function personas() {
|
|
1348
|
-
return
|
|
1316
|
+
return _ref3.apply(this, arguments);
|
|
1349
1317
|
};
|
|
1350
1318
|
}();
|
|
1351
1319
|
fetchData();
|
|
@@ -1806,11 +1774,11 @@ var Container$3 = /*#__PURE__*/styled__default.div(_templateObject$9 || (_templa
|
|
|
1806
1774
|
return props.isloading && styled.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 "])));
|
|
1807
1775
|
});
|
|
1808
1776
|
var Header$1 = /*#__PURE__*/styled__default.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"])));
|
|
1809
|
-
var Inputs = /*#__PURE__*/styled__default.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"])));
|
|
1777
|
+
var Inputs = /*#__PURE__*/styled__default.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"])));
|
|
1810
1778
|
var Result = /*#__PURE__*/styled__default.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"])));
|
|
1811
1779
|
|
|
1812
1780
|
var _templateObject$a;
|
|
1813
|
-
var Container$4 = /*#__PURE__*/styled__default.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"])));
|
|
1781
|
+
var Container$4 = /*#__PURE__*/styled__default.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"])));
|
|
1814
1782
|
|
|
1815
1783
|
var CustomSelect = function CustomSelect(_ref) {
|
|
1816
1784
|
var options = _ref.options,
|
|
@@ -2136,6 +2104,31 @@ function filesReducer(state, action) {
|
|
|
2136
2104
|
});
|
|
2137
2105
|
}
|
|
2138
2106
|
|
|
2107
|
+
var url = 'https://api.leia.digitalcontact.cloud';
|
|
2108
|
+
axios.defaults.baseURL = "" + url;
|
|
2109
|
+
var api = /*#__PURE__*/axios.create();
|
|
2110
|
+
|
|
2111
|
+
var url$1 = 'https://api-hml.leia.digitalcontact.cloud';
|
|
2112
|
+
axios.defaults.baseURL = "" + url$1;
|
|
2113
|
+
var apiHml = /*#__PURE__*/axios.create();
|
|
2114
|
+
|
|
2115
|
+
var url$2 = 'http://localhost:5000';
|
|
2116
|
+
axios.defaults.baseURL = "" + url$2;
|
|
2117
|
+
var apiDev = /*#__PURE__*/axios.create();
|
|
2118
|
+
|
|
2119
|
+
var getApi = function getApi(env) {
|
|
2120
|
+
switch (env.toLowerCase()) {
|
|
2121
|
+
case 'dev':
|
|
2122
|
+
return apiDev;
|
|
2123
|
+
case 'prod':
|
|
2124
|
+
return api;
|
|
2125
|
+
case 'test':
|
|
2126
|
+
return apiHml;
|
|
2127
|
+
default:
|
|
2128
|
+
return api;
|
|
2129
|
+
}
|
|
2130
|
+
};
|
|
2131
|
+
|
|
2139
2132
|
var CustomToastContent = function CustomToastContent(_ref) {
|
|
2140
2133
|
var title = _ref.title,
|
|
2141
2134
|
description = _ref.description;
|
|
@@ -2189,7 +2182,7 @@ var _marked = /*#__PURE__*/_regeneratorRuntime().mark(getFilesSaga),
|
|
|
2189
2182
|
_marked5 = /*#__PURE__*/_regeneratorRuntime().mark(TrainingSaga),
|
|
2190
2183
|
_marked6 = /*#__PURE__*/_regeneratorRuntime().mark(filesSagas);
|
|
2191
2184
|
function getFilesSaga(action) {
|
|
2192
|
-
var _action$payload, id, token, env, _yield$call, data;
|
|
2185
|
+
var _action$payload, id, token, env, api, _yield$call, data;
|
|
2193
2186
|
return _regeneratorRuntime().wrap(function getFilesSaga$(_context) {
|
|
2194
2187
|
while (1) switch (_context.prev = _context.next) {
|
|
2195
2188
|
case 0:
|
|
@@ -2198,36 +2191,37 @@ function getFilesSaga(action) {
|
|
|
2198
2191
|
return effects.put(commonLoadingStart());
|
|
2199
2192
|
case 3:
|
|
2200
2193
|
_action$payload = action.payload, id = _action$payload.id, token = _action$payload.token, env = _action$payload.env;
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2194
|
+
api = getApi(env);
|
|
2195
|
+
_context.next = 7;
|
|
2196
|
+
return effects.call(api.get, "/training/" + id + "?token=" + token);
|
|
2197
|
+
case 7:
|
|
2204
2198
|
_yield$call = _context.sent;
|
|
2205
2199
|
data = _yield$call.data;
|
|
2206
|
-
_context.next =
|
|
2200
|
+
_context.next = 11;
|
|
2207
2201
|
return effects.put(getFilesActionSuccess({
|
|
2208
2202
|
files: data.files
|
|
2209
2203
|
}));
|
|
2210
|
-
case
|
|
2211
|
-
_context.next =
|
|
2204
|
+
case 11:
|
|
2205
|
+
_context.next = 16;
|
|
2212
2206
|
break;
|
|
2213
|
-
case
|
|
2214
|
-
_context.prev =
|
|
2207
|
+
case 13:
|
|
2208
|
+
_context.prev = 13;
|
|
2215
2209
|
_context.t0 = _context["catch"](0);
|
|
2216
2210
|
console.log('-----------getFiles.error------------------->', _context.t0);
|
|
2217
|
-
case
|
|
2218
|
-
_context.prev =
|
|
2219
|
-
_context.next =
|
|
2211
|
+
case 16:
|
|
2212
|
+
_context.prev = 16;
|
|
2213
|
+
_context.next = 19;
|
|
2220
2214
|
return effects.put(commonLoadingFinish());
|
|
2221
|
-
case 18:
|
|
2222
|
-
return _context.finish(15);
|
|
2223
2215
|
case 19:
|
|
2216
|
+
return _context.finish(16);
|
|
2217
|
+
case 20:
|
|
2224
2218
|
case "end":
|
|
2225
2219
|
return _context.stop();
|
|
2226
2220
|
}
|
|
2227
|
-
}, _marked, null, [[0,
|
|
2221
|
+
}, _marked, null, [[0, 13, 16, 20]]);
|
|
2228
2222
|
}
|
|
2229
2223
|
function deleteFilesSaga(action) {
|
|
2230
|
-
var t, _action$payload2, id, name, token, env, _yield$call2, data;
|
|
2224
|
+
var t, _action$payload2, id, name, token, env, api, _yield$call2, data;
|
|
2231
2225
|
return _regeneratorRuntime().wrap(function deleteFilesSaga$(_context2) {
|
|
2232
2226
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2233
2227
|
case 0:
|
|
@@ -2237,44 +2231,45 @@ function deleteFilesSaga(action) {
|
|
|
2237
2231
|
return effects.put(commonLoadingStart());
|
|
2238
2232
|
case 4:
|
|
2239
2233
|
_action$payload2 = action.payload, id = _action$payload2.id, name = _action$payload2.name, token = _action$payload2.token, env = _action$payload2.env;
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2234
|
+
api = getApi(env);
|
|
2235
|
+
_context2.next = 8;
|
|
2236
|
+
return effects.call(api["delete"], "/delete/" + id + "/" + name + "?token=" + token);
|
|
2237
|
+
case 8:
|
|
2238
|
+
_context2.next = 10;
|
|
2239
|
+
return effects.call(api.get, "/training/" + id + "?token=" + token);
|
|
2240
|
+
case 10:
|
|
2246
2241
|
_yield$call2 = _context2.sent;
|
|
2247
2242
|
data = _yield$call2.data;
|
|
2248
|
-
_context2.next =
|
|
2243
|
+
_context2.next = 14;
|
|
2249
2244
|
return effects.put(deleteFilesActionSuccess({
|
|
2250
2245
|
files: data.files,
|
|
2251
2246
|
success: true
|
|
2252
2247
|
}));
|
|
2253
|
-
case
|
|
2254
|
-
_context2.next =
|
|
2248
|
+
case 14:
|
|
2249
|
+
_context2.next = 20;
|
|
2255
2250
|
break;
|
|
2256
|
-
case
|
|
2257
|
-
_context2.prev =
|
|
2251
|
+
case 16:
|
|
2252
|
+
_context2.prev = 16;
|
|
2258
2253
|
_context2.t0 = _context2["catch"](1);
|
|
2259
2254
|
toast.error({
|
|
2260
2255
|
title: t.toast.deleteFile.fail.title,
|
|
2261
2256
|
description: t.toast.deleteFile.fail.description
|
|
2262
2257
|
});
|
|
2263
2258
|
console.log('-----------deleteFilesSaga.error------------------->', _context2.t0);
|
|
2264
|
-
case
|
|
2265
|
-
_context2.prev =
|
|
2266
|
-
_context2.next =
|
|
2259
|
+
case 20:
|
|
2260
|
+
_context2.prev = 20;
|
|
2261
|
+
_context2.next = 23;
|
|
2267
2262
|
return effects.put(commonLoadingFinish());
|
|
2268
|
-
case 22:
|
|
2269
|
-
return _context2.finish(19);
|
|
2270
2263
|
case 23:
|
|
2264
|
+
return _context2.finish(20);
|
|
2265
|
+
case 24:
|
|
2271
2266
|
case "end":
|
|
2272
2267
|
return _context2.stop();
|
|
2273
2268
|
}
|
|
2274
|
-
}, _marked2, null, [[1,
|
|
2269
|
+
}, _marked2, null, [[1, 16, 20, 24]]);
|
|
2275
2270
|
}
|
|
2276
2271
|
function testSaga(action) {
|
|
2277
|
-
var _action$payload3, question, prompt, profile, presset, files_directory, token, env, _yield$call3, data;
|
|
2272
|
+
var _action$payload3, question, prompt, profile, presset, files_directory, token, env, api, _yield$call3, data;
|
|
2278
2273
|
return _regeneratorRuntime().wrap(function testSaga$(_context3) {
|
|
2279
2274
|
while (1) switch (_context3.prev = _context3.next) {
|
|
2280
2275
|
case 0:
|
|
@@ -2283,8 +2278,9 @@ function testSaga(action) {
|
|
|
2283
2278
|
return effects.put(commonLoadingStart());
|
|
2284
2279
|
case 3:
|
|
2285
2280
|
_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;
|
|
2286
|
-
|
|
2287
|
-
|
|
2281
|
+
api = getApi(env);
|
|
2282
|
+
_context3.next = 7;
|
|
2283
|
+
return effects.call(api.post, "/ask", {
|
|
2288
2284
|
question: question,
|
|
2289
2285
|
description: prompt,
|
|
2290
2286
|
profile: profile,
|
|
@@ -2292,34 +2288,34 @@ function testSaga(action) {
|
|
|
2292
2288
|
files_directory: files_directory,
|
|
2293
2289
|
token: token
|
|
2294
2290
|
});
|
|
2295
|
-
case
|
|
2291
|
+
case 7:
|
|
2296
2292
|
_yield$call3 = _context3.sent;
|
|
2297
2293
|
data = _yield$call3.data;
|
|
2298
|
-
_context3.next =
|
|
2294
|
+
_context3.next = 11;
|
|
2299
2295
|
return effects.put(testActionSuccess({
|
|
2300
2296
|
message: data.message
|
|
2301
2297
|
}));
|
|
2302
|
-
case
|
|
2303
|
-
_context3.next =
|
|
2298
|
+
case 11:
|
|
2299
|
+
_context3.next = 16;
|
|
2304
2300
|
break;
|
|
2305
|
-
case
|
|
2306
|
-
_context3.prev =
|
|
2301
|
+
case 13:
|
|
2302
|
+
_context3.prev = 13;
|
|
2307
2303
|
_context3.t0 = _context3["catch"](0);
|
|
2308
2304
|
console.log('-----------testSaga.error------------------->', _context3.t0);
|
|
2309
|
-
case
|
|
2310
|
-
_context3.prev =
|
|
2311
|
-
_context3.next =
|
|
2305
|
+
case 16:
|
|
2306
|
+
_context3.prev = 16;
|
|
2307
|
+
_context3.next = 19;
|
|
2312
2308
|
return effects.put(commonLoadingFinish());
|
|
2313
|
-
case 18:
|
|
2314
|
-
return _context3.finish(15);
|
|
2315
2309
|
case 19:
|
|
2310
|
+
return _context3.finish(16);
|
|
2311
|
+
case 20:
|
|
2316
2312
|
case "end":
|
|
2317
2313
|
return _context3.stop();
|
|
2318
2314
|
}
|
|
2319
|
-
}, _marked3, null, [[0,
|
|
2315
|
+
}, _marked3, null, [[0, 13, 16, 20]]);
|
|
2320
2316
|
}
|
|
2321
2317
|
function uploadFilesSaga(action) {
|
|
2322
|
-
var t, _action$payload4, id, file, pressets, token, env, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
|
|
2318
|
+
var t, _action$payload4, id, file, pressets, token, env, api, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
|
|
2323
2319
|
return _regeneratorRuntime().wrap(function uploadFilesSaga$(_context4) {
|
|
2324
2320
|
while (1) switch (_context4.prev = _context4.next) {
|
|
2325
2321
|
case 0:
|
|
@@ -2329,6 +2325,7 @@ function uploadFilesSaga(action) {
|
|
|
2329
2325
|
return effects.put(commonLoadingStart());
|
|
2330
2326
|
case 4:
|
|
2331
2327
|
_action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token, env = _action$payload4.env;
|
|
2328
|
+
api = getApi(env);
|
|
2332
2329
|
blob = new Blob([file.content]);
|
|
2333
2330
|
formData = new FormData();
|
|
2334
2331
|
sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
|
|
@@ -2337,47 +2334,47 @@ function uploadFilesSaga(action) {
|
|
|
2337
2334
|
tags: pressets.join(',')
|
|
2338
2335
|
}).toString() : '';
|
|
2339
2336
|
url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
|
|
2340
|
-
_context4.next =
|
|
2341
|
-
return effects.call(
|
|
2337
|
+
_context4.next = 14;
|
|
2338
|
+
return effects.call(api.post, url, formData, {
|
|
2342
2339
|
headers: {
|
|
2343
2340
|
'Content-Type': 'multipart/form-data'
|
|
2344
2341
|
}
|
|
2345
2342
|
});
|
|
2346
|
-
case
|
|
2347
|
-
_context4.next =
|
|
2348
|
-
return effects.call(
|
|
2349
|
-
case
|
|
2343
|
+
case 14:
|
|
2344
|
+
_context4.next = 16;
|
|
2345
|
+
return effects.call(api.get, "/training/" + id + "?token=" + token);
|
|
2346
|
+
case 16:
|
|
2350
2347
|
_yield$call4 = _context4.sent;
|
|
2351
2348
|
data = _yield$call4.data;
|
|
2352
|
-
_context4.next =
|
|
2349
|
+
_context4.next = 20;
|
|
2353
2350
|
return effects.put(uploadFilesActionSuccess({
|
|
2354
2351
|
files: data.files
|
|
2355
2352
|
}));
|
|
2356
|
-
case
|
|
2357
|
-
_context4.next =
|
|
2353
|
+
case 20:
|
|
2354
|
+
_context4.next = 26;
|
|
2358
2355
|
break;
|
|
2359
|
-
case
|
|
2360
|
-
_context4.prev =
|
|
2356
|
+
case 22:
|
|
2357
|
+
_context4.prev = 22;
|
|
2361
2358
|
_context4.t0 = _context4["catch"](1);
|
|
2362
2359
|
toast.error({
|
|
2363
2360
|
title: t.toast.uploadFile.fail.title,
|
|
2364
2361
|
description: t.toast.uploadFile.fail.description
|
|
2365
2362
|
});
|
|
2366
2363
|
console.log('-----------uploadFilesSaga.error------------------->', _context4.t0);
|
|
2367
|
-
case
|
|
2368
|
-
_context4.prev =
|
|
2369
|
-
_context4.next =
|
|
2364
|
+
case 26:
|
|
2365
|
+
_context4.prev = 26;
|
|
2366
|
+
_context4.next = 29;
|
|
2370
2367
|
return effects.put(commonLoadingFinish());
|
|
2371
|
-
case 28:
|
|
2372
|
-
return _context4.finish(25);
|
|
2373
2368
|
case 29:
|
|
2369
|
+
return _context4.finish(26);
|
|
2370
|
+
case 30:
|
|
2374
2371
|
case "end":
|
|
2375
2372
|
return _context4.stop();
|
|
2376
2373
|
}
|
|
2377
|
-
}, _marked4, null, [[1,
|
|
2374
|
+
}, _marked4, null, [[1, 22, 26, 30]]);
|
|
2378
2375
|
}
|
|
2379
2376
|
function TrainingSaga(action) {
|
|
2380
|
-
var t, _action$payload5, id, pressets, token, env, tag, queryParams, _yield$call5, data;
|
|
2377
|
+
var t, _action$payload5, id, pressets, token, env, tag, api, queryParams, _yield$call5, data;
|
|
2381
2378
|
return _regeneratorRuntime().wrap(function TrainingSaga$(_context5) {
|
|
2382
2379
|
while (1) switch (_context5.prev = _context5.next) {
|
|
2383
2380
|
case 0:
|
|
@@ -2388,50 +2385,51 @@ function TrainingSaga(action) {
|
|
|
2388
2385
|
case 4:
|
|
2389
2386
|
_action$payload5 = action.payload, id = _action$payload5.id, pressets = _action$payload5.pressets, token = _action$payload5.token, env = _action$payload5.env;
|
|
2390
2387
|
tag = pressets.join(',');
|
|
2388
|
+
api = getApi(env);
|
|
2391
2389
|
queryParams = new URLSearchParams({
|
|
2392
2390
|
tag: tag
|
|
2393
2391
|
}).toString();
|
|
2394
|
-
_context5.next =
|
|
2395
|
-
return effects.call(
|
|
2392
|
+
_context5.next = 10;
|
|
2393
|
+
return effects.call(api.post, pressets.length > 0 ? "/training?" + queryParams : "/training", {
|
|
2396
2394
|
files_directory: id,
|
|
2397
2395
|
token: token
|
|
2398
2396
|
});
|
|
2399
|
-
case
|
|
2400
|
-
_context5.next =
|
|
2401
|
-
return effects.call(
|
|
2402
|
-
case
|
|
2397
|
+
case 10:
|
|
2398
|
+
_context5.next = 12;
|
|
2399
|
+
return effects.call(api.get, "/training/" + id + "?token=" + token);
|
|
2400
|
+
case 12:
|
|
2403
2401
|
_yield$call5 = _context5.sent;
|
|
2404
2402
|
data = _yield$call5.data;
|
|
2405
|
-
_context5.next =
|
|
2403
|
+
_context5.next = 16;
|
|
2406
2404
|
return effects.put(uploadFilesActionSuccess({
|
|
2407
2405
|
files: data.files
|
|
2408
2406
|
}));
|
|
2409
|
-
case
|
|
2407
|
+
case 16:
|
|
2410
2408
|
toast.success({
|
|
2411
2409
|
title: t.toast.Train.success.title,
|
|
2412
2410
|
description: t.toast.Train.success.description
|
|
2413
2411
|
});
|
|
2414
|
-
_context5.next =
|
|
2412
|
+
_context5.next = 23;
|
|
2415
2413
|
break;
|
|
2416
|
-
case
|
|
2417
|
-
_context5.prev =
|
|
2414
|
+
case 19:
|
|
2415
|
+
_context5.prev = 19;
|
|
2418
2416
|
_context5.t0 = _context5["catch"](1);
|
|
2419
2417
|
toast.error({
|
|
2420
2418
|
title: t.toast.Train.fail.title,
|
|
2421
2419
|
description: t.toast.Train.fail.description
|
|
2422
2420
|
});
|
|
2423
2421
|
console.log('-----------TrainingSaga.error------------------->', _context5.t0);
|
|
2424
|
-
case
|
|
2425
|
-
_context5.prev =
|
|
2426
|
-
_context5.next =
|
|
2422
|
+
case 23:
|
|
2423
|
+
_context5.prev = 23;
|
|
2424
|
+
_context5.next = 26;
|
|
2427
2425
|
return effects.put(commonLoadingFinish());
|
|
2428
|
-
case 25:
|
|
2429
|
-
return _context5.finish(22);
|
|
2430
2426
|
case 26:
|
|
2427
|
+
return _context5.finish(23);
|
|
2428
|
+
case 27:
|
|
2431
2429
|
case "end":
|
|
2432
2430
|
return _context5.stop();
|
|
2433
2431
|
}
|
|
2434
|
-
}, _marked5, null, [[1,
|
|
2432
|
+
}, _marked5, null, [[1, 19, 23, 27]]);
|
|
2435
2433
|
}
|
|
2436
2434
|
function filesSagas() {
|
|
2437
2435
|
return _regeneratorRuntime().wrap(function filesSagas$(_context6) {
|