code7-leia 0.2.20 → 0.2.23

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.
@@ -469,7 +469,7 @@ var enTranslation = {
469
469
  deleteFileTitle: 'Delete a file',
470
470
  deleteFile: 'Important! By deleting this file, you will lose all its information and will not be able to recover it.',
471
471
  trainingTitle: 'Presset Training',
472
- trainingDescription: 'Select one or more pressets to be trained. Note: If none are selected, Lira will train all pressets.'
472
+ trainingDescription: 'Select one or more pressets to be trained. Note: If none are selected, Le-IA will train all pressets.'
473
473
  }
474
474
  },
475
475
  buttons: {
@@ -484,6 +484,7 @@ var enTranslation = {
484
484
  testArea: {
485
485
  description: 'Type a sentence to test artificial intelligence',
486
486
  typeSentence: 'Type a sentence',
487
+ typePrompt: 'Insert a custom prompt here',
487
488
  selectPersona: 'Select a Persona',
488
489
  selectPresset: 'Select a presset',
489
490
  emptyState: {
@@ -515,17 +516,17 @@ var enTranslation = {
515
516
  Test: {
516
517
  fail: {
517
518
  title: 'Failure',
518
- description: 'Error testing Lira'
519
+ description: 'Error testing Le-IA'
519
520
  }
520
521
  },
521
522
  Train: {
522
523
  fail: {
523
524
  title: 'Failure',
524
- description: 'Error training Lira'
525
+ description: 'Error training Le-IA'
525
526
  },
526
527
  success: {
527
528
  title: 'Success',
528
- description: 'Lira is in the training process!'
529
+ description: 'Le-IA is in the training process!'
529
530
  }
530
531
  }
531
532
  }
@@ -554,7 +555,7 @@ var ptTranslation = {
554
555
  deleteFileTitle: 'Excluir um arquivo',
555
556
  deleteFile: 'Importante! Ao excluir este arquivo, você perderá todas as suas informações e não poderá recuperá-las.',
556
557
  trainingTitle: 'Treinamento de predefinição',
557
- trainingDescription: 'Selecione um ou mais predefinições para serem treinadas. Obs: Caso não selecionada nenhuma a Lira irá treinar todas as predefinições'
558
+ 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'
558
559
  }
559
560
  },
560
561
  buttons: {
@@ -569,6 +570,7 @@ var ptTranslation = {
569
570
  testArea: {
570
571
  description: 'Digite uma frase para testar a inteligência artificial.',
571
572
  typeSentence: 'Digite uma frase',
573
+ typePrompt: 'Insira aqui um prompt personalizado',
572
574
  selectPersona: 'Selecione uma Persona',
573
575
  selectPresset: 'Selecione uma predefinição',
574
576
  emptyState: {
@@ -600,17 +602,17 @@ var ptTranslation = {
600
602
  Test: {
601
603
  fail: {
602
604
  title: 'Falha',
603
- description: 'Erro ao testar Lira'
605
+ description: 'Erro ao testar Le-IA'
604
606
  }
605
607
  },
606
608
  Train: {
607
609
  fail: {
608
610
  title: 'Falha',
609
- description: 'Erro ao treinar a Lira'
611
+ description: 'Erro ao treinar a Le-IA'
610
612
  },
611
613
  success: {
612
614
  title: 'Sucesso',
613
- description: 'A Lira está em processo de treinamento!'
615
+ description: 'A Le-IA está em processo de treinamento!'
614
616
  }
615
617
  }
616
618
  }
@@ -639,7 +641,7 @@ var esTranslation = {
639
641
  deleteFileTitle: 'Eliminar un archivo',
640
642
  deleteFile: '¡Importante! Al eliminar este archivo, perderá toda su información y no podrá recuperarla.',
641
643
  trainingTitle: 'Entrenamiento de preconfiguración',
642
- trainingDescription: 'Seleccione una o más preconfiguracións para ser entrenadas. Nota: Si no se selecciona ninguna, Lira entrenará todas las preconfiguracións.'
644
+ trainingDescription: 'Seleccione una o más preconfiguracións para ser entrenadas. Nota: Si no se selecciona ninguna, Le-IA entrenará todas las preconfiguracións.'
643
645
  }
644
646
  },
645
647
  buttons: {
@@ -654,6 +656,7 @@ var esTranslation = {
654
656
  testArea: {
655
657
  description: 'Escribe una frase para probar la inteligencia artificial.',
656
658
  typeSentence: 'Escribe una oración',
659
+ typePrompt: 'Inserte un prompt personalizado aquí',
657
660
  selectPersona: 'Seleccionar una Persona',
658
661
  selectPresset: 'Seleccionar una preconfiguración',
659
662
  emptyState: {
@@ -685,17 +688,17 @@ var esTranslation = {
685
688
  Test: {
686
689
  fail: {
687
690
  title: 'Error',
688
- description: 'Error al probar Lira'
691
+ description: 'Error al probar Le-IA'
689
692
  }
690
693
  },
691
694
  Train: {
692
695
  fail: {
693
696
  title: 'Error',
694
- description: 'Error al entrenar Lira'
697
+ description: 'Error al entrenar Le-IA'
695
698
  },
696
699
  success: {
697
700
  title: 'Éxito',
698
- description: '¡Lira está en proceso de entrenamiento!'
701
+ description: '¡Le-IA está en proceso de entrenamiento!'
699
702
  }
700
703
  }
701
704
  }
@@ -1219,6 +1222,10 @@ var url = 'https://api.leia.digitalcontact.cloud';
1219
1222
  axios.defaults.baseURL = "" + url;
1220
1223
  var api = /*#__PURE__*/axios.create();
1221
1224
 
1225
+ var url$1 = 'http://localhost:5000';
1226
+ axios.defaults.baseURL = "" + url$1;
1227
+ var apiHml = /*#__PURE__*/axios.create();
1228
+
1222
1229
  var _excluded$5 = ["children"];
1223
1230
  var SharedPropsContext = /*#__PURE__*/createContext(undefined);
1224
1231
  var useSharedProps = function useSharedProps() {
@@ -1232,7 +1239,8 @@ var SharedPropsProvider = function SharedPropsProvider(_ref) {
1232
1239
  var children = _ref.children,
1233
1240
  props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
1234
1241
  var id = props.id,
1235
- language = props.language;
1242
+ language = props.language,
1243
+ env = props.env;
1236
1244
  var _useState = useState(null),
1237
1245
  tags = _useState[0],
1238
1246
  setTags = _useState[1];
@@ -1242,68 +1250,94 @@ var SharedPropsProvider = function SharedPropsProvider(_ref) {
1242
1250
  useEffect(function () {
1243
1251
  var fetchData = /*#__PURE__*/function () {
1244
1252
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1245
- var _yield$api$get, data;
1253
+ var _ref3, data;
1246
1254
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1247
1255
  while (1) switch (_context.prev = _context.next) {
1248
1256
  case 0:
1249
1257
  _context.prev = 0;
1250
- _context.next = 3;
1258
+ if (!(env.toLowerCase() === 'prod')) {
1259
+ _context.next = 7;
1260
+ break;
1261
+ }
1262
+ _context.next = 4;
1251
1263
  return api.get("/tags/" + id);
1252
- case 3:
1253
- _yield$api$get = _context.sent;
1254
- data = _yield$api$get.data;
1264
+ case 4:
1265
+ _context.t0 = _context.sent;
1266
+ _context.next = 10;
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;
1255
1276
  if (data) {
1256
1277
  setTags(data);
1257
1278
  } else {
1258
1279
  console.error('Erro ao fazer a solicitação');
1259
1280
  }
1260
- _context.next = 11;
1281
+ _context.next = 18;
1261
1282
  break;
1262
- case 8:
1263
- _context.prev = 8;
1264
- _context.t0 = _context["catch"](0);
1265
- console.error('Erro ao fazer a solicitação:', _context.t0);
1266
- case 11:
1283
+ case 15:
1284
+ _context.prev = 15;
1285
+ _context.t1 = _context["catch"](0);
1286
+ console.error('Erro ao fazer a solicitação:', _context.t1);
1287
+ case 18:
1267
1288
  case "end":
1268
1289
  return _context.stop();
1269
1290
  }
1270
- }, _callee, null, [[0, 8]]);
1291
+ }, _callee, null, [[0, 15]]);
1271
1292
  }));
1272
1293
  return function fetchData() {
1273
1294
  return _ref2.apply(this, arguments);
1274
1295
  };
1275
1296
  }();
1276
1297
  var personas = /*#__PURE__*/function () {
1277
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1278
- var _yield$api$get2, data;
1298
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1299
+ var _ref5, data;
1279
1300
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1280
1301
  while (1) switch (_context2.prev = _context2.next) {
1281
1302
  case 0:
1282
1303
  _context2.prev = 0;
1283
- _context2.next = 3;
1304
+ if (!(env.toLowerCase() === 'prod')) {
1305
+ _context2.next = 7;
1306
+ break;
1307
+ }
1308
+ _context2.next = 4;
1284
1309
  return api.get("/personas?language=" + language);
1285
- case 3:
1286
- _yield$api$get2 = _context2.sent;
1287
- data = _yield$api$get2.data;
1310
+ case 4:
1311
+ _context2.t0 = _context2.sent;
1312
+ _context2.next = 10;
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;
1288
1322
  if (data) {
1289
1323
  setPersonas(data);
1290
1324
  } else {
1291
1325
  console.error('Erro ao fazer a solicitação');
1292
1326
  }
1293
- _context2.next = 11;
1327
+ _context2.next = 18;
1294
1328
  break;
1295
- case 8:
1296
- _context2.prev = 8;
1297
- _context2.t0 = _context2["catch"](0);
1298
- console.error('Erro ao fazer a solicitação:', _context2.t0);
1299
- case 11:
1329
+ case 15:
1330
+ _context2.prev = 15;
1331
+ _context2.t1 = _context2["catch"](0);
1332
+ console.error('Erro ao fazer a solicitação:', _context2.t1);
1333
+ case 18:
1300
1334
  case "end":
1301
1335
  return _context2.stop();
1302
1336
  }
1303
- }, _callee2, null, [[0, 8]]);
1337
+ }, _callee2, null, [[0, 15]]);
1304
1338
  }));
1305
1339
  return function personas() {
1306
- return _ref3.apply(this, arguments);
1340
+ return _ref4.apply(this, arguments);
1307
1341
  };
1308
1342
  }();
1309
1343
  fetchData();
@@ -1338,12 +1372,13 @@ var Types = {
1338
1372
  NETWORK_OFFLINE: 'NETWORK_OFFLINE'
1339
1373
  };
1340
1374
 
1341
- var getFilesAction = function getFilesAction(id, token) {
1375
+ var getFilesAction = function getFilesAction(id, token, env) {
1342
1376
  return {
1343
1377
  type: Types.GET_FILES_REQUEST,
1344
1378
  payload: {
1345
1379
  id: id,
1346
- token: token
1380
+ token: token,
1381
+ env: env
1347
1382
  }
1348
1383
  };
1349
1384
  };
@@ -1356,14 +1391,15 @@ var getFilesActionSuccess = function getFilesActionSuccess(_ref) {
1356
1391
  }
1357
1392
  };
1358
1393
  };
1359
- var deleteFilesAction = function deleteFilesAction(name, id, language, token) {
1394
+ var deleteFilesAction = function deleteFilesAction(name, id, language, token, env) {
1360
1395
  return {
1361
1396
  type: Types.DELETE_FILES_REQUEST,
1362
1397
  payload: {
1363
1398
  name: name,
1364
1399
  id: id,
1365
1400
  language: language,
1366
- token: token
1401
+ token: token,
1402
+ env: env
1367
1403
  }
1368
1404
  };
1369
1405
  };
@@ -1376,7 +1412,7 @@ var deleteFilesActionSuccess = function deleteFilesActionSuccess(_ref2) {
1376
1412
  }
1377
1413
  };
1378
1414
  };
1379
- var uploadFilesAction = function uploadFilesAction(file, id, pressets, language, token) {
1415
+ var uploadFilesAction = function uploadFilesAction(file, id, pressets, language, token, env) {
1380
1416
  return {
1381
1417
  type: Types.UPLOAD_FILES_REQUEST,
1382
1418
  payload: {
@@ -1384,7 +1420,8 @@ var uploadFilesAction = function uploadFilesAction(file, id, pressets, language,
1384
1420
  id: id,
1385
1421
  pressets: pressets,
1386
1422
  language: language,
1387
- token: token
1423
+ token: token,
1424
+ env: env
1388
1425
  }
1389
1426
  };
1390
1427
  };
@@ -1397,26 +1434,29 @@ var uploadFilesActionSuccess = function uploadFilesActionSuccess(_ref3) {
1397
1434
  }
1398
1435
  };
1399
1436
  };
1400
- var trainingAction = function trainingAction(id, pressets, language, token) {
1437
+ var trainingAction = function trainingAction(id, pressets, language, token, env) {
1401
1438
  return {
1402
1439
  type: Types.TRAINING_REQUEST,
1403
1440
  payload: {
1404
1441
  id: id,
1405
1442
  pressets: pressets,
1406
1443
  language: language,
1407
- token: token
1444
+ token: token,
1445
+ env: env
1408
1446
  }
1409
1447
  };
1410
1448
  };
1411
- var testAction = function testAction(question, profile, presset, files_directory, token) {
1449
+ var testAction = function testAction(question, prompt, profile, presset, files_directory, token, env) {
1412
1450
  return {
1413
1451
  type: Types.TEST_REQUEST,
1414
1452
  payload: {
1415
1453
  question: question,
1454
+ prompt: prompt,
1416
1455
  profile: profile,
1417
1456
  presset: presset,
1418
1457
  files_directory: files_directory,
1419
- token: token
1458
+ token: token,
1459
+ env: env
1420
1460
  }
1421
1461
  };
1422
1462
  };
@@ -1445,7 +1485,8 @@ var FileArea = function FileArea() {
1445
1485
  id = _useSharedProps.id,
1446
1486
  language = _useSharedProps.language,
1447
1487
  propTags = _useSharedProps.propTags,
1448
- token = _useSharedProps.token;
1488
+ token = _useSharedProps.token,
1489
+ env = _useSharedProps.env;
1449
1490
  var _useState = useState([]),
1450
1491
  files = _useState[0],
1451
1492
  setFiles = _useState[1];
@@ -1483,7 +1524,7 @@ var FileArea = function FileArea() {
1483
1524
  });
1484
1525
  var tags = propTags ? propTags.tags : [];
1485
1526
  useEffect(function () {
1486
- dispatch(getFilesAction(id, token));
1527
+ dispatch(getFilesAction(id, token, env));
1487
1528
  }, [id]);
1488
1529
  useEffect(function () {
1489
1530
  if (tags.length > 0) {
@@ -1548,17 +1589,17 @@ var FileArea = function FileArea() {
1548
1589
  setModalTraining(!modalTraining);
1549
1590
  };
1550
1591
  var deleteFile = function deleteFile() {
1551
- dispatch(deleteFilesAction(fileDelete, id, language, token));
1592
+ dispatch(deleteFilesAction(fileDelete, id, language, token, env));
1552
1593
  setModalDelete(false);
1553
1594
  };
1554
1595
  var handleUploadFile = function handleUploadFile() {
1555
- dispatch(uploadFilesAction(uploadFile, id, presset, language, token));
1596
+ dispatch(uploadFilesAction(uploadFile, id, presset, language, token, env));
1556
1597
  setModal(false);
1557
1598
  setUploadFile(undefined);
1558
1599
  setPresset([]);
1559
1600
  };
1560
1601
  var handleTrain = function handleTrain() {
1561
- dispatch(trainingAction(id, presset, language, token));
1602
+ dispatch(trainingAction(id, presset, language, token, env));
1562
1603
  setModalTraining(false);
1563
1604
  setPresset([]);
1564
1605
  };
@@ -1741,6 +1782,7 @@ var FileArea = function FileArea() {
1741
1782
  id: id,
1742
1783
  language: language,
1743
1784
  token: token,
1785
+ env: env,
1744
1786
  propTags: {
1745
1787
  tags: []
1746
1788
  },
@@ -1820,13 +1862,83 @@ var InputTest = function InputTest(_ref) {
1820
1862
  }));
1821
1863
  };
1822
1864
 
1865
+ var _templateObject$c, _templateObject2$8, _templateObject3$6, _templateObject4$3, _templateObject5$3, _templateObject6$2;
1866
+ var Container$6 = /*#__PURE__*/styled.div(_templateObject$c || (_templateObject$c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-flow: column;\n margin-bottom: ", ";\n"])), function (_ref) {
1867
+ var marginBottom = _ref.marginBottom;
1868
+ return marginBottom;
1869
+ });
1870
+ var InputWrapper = /*#__PURE__*/styled.div(_templateObject2$8 || (_templateObject2$8 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n position: relative;\n\n .icon {\n position: absolute;\n color: #5a5d68;\n\n &.start-icon {\n left: 12px;\n }\n &.end-icon {\n right: 12px;\n }\n }\n\n & .pass-view {\n position: absolute;\n right: 0;\n top: 0;\n bottom: 0;\n padding: 14px;\n font-size: 1rem;\n color: #5a5d68;\n }\n"])));
1871
+ var LabelWrapper = /*#__PURE__*/styled.label(_templateObject3$6 || (_templateObject3$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 8px;\n\n .label {\n display: block;\n color: #5a5d68;\n\n font-style: normal;\n font-weight: 600;\n font-size: 0.875rem;\n line-height: 114%;\n letter-spacing: -0.02em;\n }\n\n .description {\n font-style: normal;\n font-weight: 500;\n font-size: 0.625rem;\n line-height: 120%;\n color: #5a5d68;\n display: block;\n }\n"])));
1872
+ var CustomTextArea = /*#__PURE__*/styled.textarea(_templateObject4$3 || (_templateObject4$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-family: 'Monospace', -apple-system, BlinkMacSystemFont, sans-serif;\n font-size: 0.875rem;\n font-style: normal;\n font-weight: 500;\n line-height: 20px;\n text-align: left;\n letter-spacing: -0.02em;\n resize: vertical;\n padding: 8px 12px;\n\n border-radius: 4px;\n border: 1px solid #979aa5;\n color: #5a5d68 !important;\n width: 100%;\n\n background: #ffffff;\n transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,\n border 0.2s ease-in-out;\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 3px #6690ff;\n }\n\n &:hover {\n border: 1px solid #102693;\n }\n &:active {\n border: 1px solid #102693;\n }\n &:disabled {\n border: 1px solid #dadce3;\n background: #f3f5f9;\n color: #dadce3;\n }\n\n &.small {\n min-height: 32px;\n }\n\n &.medium {\n min-height: 40px;\n }\n\n &.large {\n min-height: 48px;\n font-size: 1rem;\n }\n\n &.success {\n background: #e3f8cc;\n border: 1px solid #19660a;\n color: #19660a;\n }\n\n &.danger {\n background: #fae0d2;\n border: 1px solid #871821;\n color: #871821;\n }\n\n &.error {\n background: #fae0d2;\n border: 1px solid #871821;\n color: #871821;\n }\n\n &.has-start-icon {\n padding-left: 40px;\n }\n &.has-end-icon {\n padding-right: 40px;\n }\n"])));
1873
+ var Helper = /*#__PURE__*/styled.div(_templateObject5$3 || (_templateObject5$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n &.helper {\n font-style: normal;\n font-weight: 500;\n font-size: 0.625rem;\n line-height: 120%;\n color: #5a5d68;\n display: block;\n margin-top: 4px;\n\n &.success {\n color: #19660a;\n }\n\n &.danger {\n color: #871821;\n }\n }\n"])));
1874
+ var Error$1 = /*#__PURE__*/styled.div(_templateObject6$2 || (_templateObject6$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n font-style: normal;\n font-weight: 500;\n font-size: 0.625rem;\n line-height: 120%;\n display: block;\n margin-top: 4px;\n color: #871821;\n"])));
1875
+
1876
+ var _excluded$6 = ["id", "label", "description", "helper", "error", "placeholder", "className", "size", "color", "disabled", "startIcon", "endIcon", "marginBottom", "rows"];
1877
+ var TextArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
1878
+ var id = _ref.id,
1879
+ label = _ref.label,
1880
+ description = _ref.description,
1881
+ helper = _ref.helper,
1882
+ error = _ref.error,
1883
+ placeholder = _ref.placeholder,
1884
+ className = _ref.className,
1885
+ _ref$size = _ref.size,
1886
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
1887
+ _ref$color = _ref.color,
1888
+ color = _ref$color === void 0 ? '' : _ref$color,
1889
+ _ref$disabled = _ref.disabled,
1890
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1891
+ startIcon = _ref.startIcon,
1892
+ endIcon = _ref.endIcon,
1893
+ _ref$marginBottom = _ref.marginBottom,
1894
+ marginBottom = _ref$marginBottom === void 0 ? '3px' : _ref$marginBottom,
1895
+ _ref$rows = _ref.rows,
1896
+ rows = _ref$rows === void 0 ? 4 : _ref$rows,
1897
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
1898
+ var selfId = id || "input__" + Math.random().toString(36).substr(2, 9);
1899
+ return React.createElement(Container$6, {
1900
+ className: className,
1901
+ marginBottom: marginBottom
1902
+ }, label && React.createElement(LabelWrapper, {
1903
+ htmlFor: selfId
1904
+ }, React.createElement("span", {
1905
+ className: "label"
1906
+ }, label), description && React.createElement("span", {
1907
+ className: "description"
1908
+ }, description)), React.createElement(InputWrapper, {
1909
+ className: cc({
1910
+ hasLabel: Boolean(label)
1911
+ })
1912
+ }, React.createElement(CustomTextArea, Object.assign({
1913
+ className: cc(['input', size, color, {
1914
+ error: Boolean(error),
1915
+ 'has-start-icon': Boolean(startIcon),
1916
+ 'has-end-icon': Boolean(endIcon)
1917
+ }]),
1918
+ id: selfId,
1919
+ placeholder: placeholder,
1920
+ disabled: disabled,
1921
+ rows: rows,
1922
+ ref: ref
1923
+ }, props)), startIcon && React.createElement("span", {
1924
+ className: cc(['icon', 'start-icon'])
1925
+ }, startIcon), endIcon && React.createElement("span", {
1926
+ className: cc(['icon', 'end-icon'])
1927
+ }, endIcon)), helper && React.createElement(Helper, {
1928
+ className: cc(['helper', color])
1929
+ }, helper), error && React.createElement(Error$1, {
1930
+ className: cc(['error'])
1931
+ }, error));
1932
+ });
1933
+
1823
1934
  var TestArea = function TestArea() {
1824
1935
  var _useSharedProps = useSharedProps(),
1825
1936
  id = _useSharedProps.id,
1826
1937
  language = _useSharedProps.language,
1827
1938
  personas = _useSharedProps.personas,
1828
1939
  propTags = _useSharedProps.propTags,
1829
- token = _useSharedProps.token;
1940
+ token = _useSharedProps.token,
1941
+ env = _useSharedProps.env;
1830
1942
  var t = getLanguage(language);
1831
1943
  var results = useSelector(function (state) {
1832
1944
  return state.message;
@@ -1838,11 +1950,14 @@ var TestArea = function TestArea() {
1838
1950
  search = _useState[0],
1839
1951
  setSearch = _useState[1];
1840
1952
  var _useState2 = useState(''),
1841
- profile = _useState2[0],
1842
- setProfile = _useState2[1];
1953
+ prompt = _useState2[0],
1954
+ setPrompt = _useState2[1];
1843
1955
  var _useState3 = useState(''),
1844
- presset = _useState3[0],
1845
- setPresset = _useState3[1];
1956
+ profile = _useState3[0],
1957
+ setProfile = _useState3[1];
1958
+ var _useState4 = useState(''),
1959
+ presset = _useState4[0],
1960
+ setPresset = _useState4[1];
1846
1961
  var dispatch = useDispatch();
1847
1962
  var tags = propTags ? propTags.tags : [];
1848
1963
  var optionsPersona = personas && personas.map(function (persona) {
@@ -1866,8 +1981,11 @@ var TestArea = function TestArea() {
1866
1981
  var handleSearch = function handleSearch(value) {
1867
1982
  setSearch(value);
1868
1983
  };
1984
+ var handlePrompt = function handlePrompt(value) {
1985
+ setPrompt(value);
1986
+ };
1869
1987
  var handleTest = function handleTest() {
1870
- dispatch(testAction(search, profile, presset, id, token));
1988
+ dispatch(testAction(search, prompt, profile, presset, id, token, env));
1871
1989
  };
1872
1990
  var returnTest = function returnTest() {
1873
1991
  return React.createElement(Container$3, {
@@ -1883,6 +2001,14 @@ var TestArea = function TestArea() {
1883
2001
  placeholder: t.testArea.selectPersona,
1884
2002
  options: optionsPersona,
1885
2003
  onSelect: handleSelectPersona
2004
+ }), profile === "Custom" && React.createElement(TextArea, {
2005
+ className: "textarea-message",
2006
+ label: "Prompt",
2007
+ placeholder: t.testArea.typePrompt,
2008
+ value: prompt,
2009
+ onChange: function onChange(e) {
2010
+ handlePrompt(e.target.value);
2011
+ }
1886
2012
  }), React.createElement(CustomSelect, {
1887
2013
  placeholder: t.testArea.selectPresset,
1888
2014
  options: optionsPresset,
@@ -1904,6 +2030,7 @@ var TestArea = function TestArea() {
1904
2030
  id: id,
1905
2031
  token: token,
1906
2032
  language: language,
2033
+ env: env,
1907
2034
  propTags: {
1908
2035
  tags: []
1909
2036
  },
@@ -1927,6 +2054,7 @@ var Leia = function Leia(props) {
1927
2054
  propTags: {
1928
2055
  tags: []
1929
2056
  },
2057
+ env: '',
1930
2058
  personas: [{
1931
2059
  name: '',
1932
2060
  description: ''
@@ -2054,7 +2182,7 @@ var _marked = /*#__PURE__*/_regeneratorRuntime().mark(getFilesSaga),
2054
2182
  _marked5 = /*#__PURE__*/_regeneratorRuntime().mark(TrainingSaga),
2055
2183
  _marked6 = /*#__PURE__*/_regeneratorRuntime().mark(filesSagas);
2056
2184
  function getFilesSaga(action) {
2057
- var _action$payload, id, token, _yield$call, data;
2185
+ var _action$payload, id, token, env, _yield$call, data;
2058
2186
  return _regeneratorRuntime().wrap(function getFilesSaga$(_context) {
2059
2187
  while (1) switch (_context.prev = _context.next) {
2060
2188
  case 0:
@@ -2062,9 +2190,9 @@ function getFilesSaga(action) {
2062
2190
  _context.next = 3;
2063
2191
  return put(commonLoadingStart());
2064
2192
  case 3:
2065
- _action$payload = action.payload, id = _action$payload.id, token = _action$payload.token;
2193
+ _action$payload = action.payload, id = _action$payload.id, token = _action$payload.token, env = _action$payload.env;
2066
2194
  _context.next = 6;
2067
- return call(api.get, "/training/" + id + "?token=" + token);
2195
+ return call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, "/training/" + id + "?token=" + token);
2068
2196
  case 6:
2069
2197
  _yield$call = _context.sent;
2070
2198
  data = _yield$call.data;
@@ -2092,7 +2220,7 @@ function getFilesSaga(action) {
2092
2220
  }, _marked, null, [[0, 12, 15, 19]]);
2093
2221
  }
2094
2222
  function deleteFilesSaga(action) {
2095
- var t, _action$payload2, id, name, token, _yield$call2, data;
2223
+ var t, _action$payload2, id, name, token, env, _yield$call2, data;
2096
2224
  return _regeneratorRuntime().wrap(function deleteFilesSaga$(_context2) {
2097
2225
  while (1) switch (_context2.prev = _context2.next) {
2098
2226
  case 0:
@@ -2101,12 +2229,12 @@ function deleteFilesSaga(action) {
2101
2229
  _context2.next = 4;
2102
2230
  return put(commonLoadingStart());
2103
2231
  case 4:
2104
- _action$payload2 = action.payload, id = _action$payload2.id, name = _action$payload2.name, token = _action$payload2.token;
2232
+ _action$payload2 = action.payload, id = _action$payload2.id, name = _action$payload2.name, token = _action$payload2.token, env = _action$payload2.env;
2105
2233
  _context2.next = 7;
2106
- return call(api["delete"], "/delete/" + id + "/" + name + "?token=" + token);
2234
+ return call(env.toLowerCase() === 'prod' ? api["delete"] : apiHml["delete"], "/delete/" + id + "/" + name + "?token=" + token);
2107
2235
  case 7:
2108
2236
  _context2.next = 9;
2109
- return call(api.get, "/training/" + id + "?token=" + token);
2237
+ return call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, "/training/" + id + "?token=" + token);
2110
2238
  case 9:
2111
2239
  _yield$call2 = _context2.sent;
2112
2240
  data = _yield$call2.data;
@@ -2139,7 +2267,7 @@ function deleteFilesSaga(action) {
2139
2267
  }, _marked2, null, [[1, 15, 19, 23]]);
2140
2268
  }
2141
2269
  function testSaga(action) {
2142
- var _action$payload3, question, profile, presset, files_directory, token, _yield$call3, data;
2270
+ var _action$payload3, question, prompt, profile, presset, files_directory, token, env, _yield$call3, data;
2143
2271
  return _regeneratorRuntime().wrap(function testSaga$(_context3) {
2144
2272
  while (1) switch (_context3.prev = _context3.next) {
2145
2273
  case 0:
@@ -2147,10 +2275,11 @@ function testSaga(action) {
2147
2275
  _context3.next = 3;
2148
2276
  return put(commonLoadingStart());
2149
2277
  case 3:
2150
- _action$payload3 = action.payload, question = _action$payload3.question, profile = _action$payload3.profile, presset = _action$payload3.presset, files_directory = _action$payload3.files_directory, token = _action$payload3.token;
2278
+ _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;
2151
2279
  _context3.next = 6;
2152
- return call(api.post, "/ask", {
2280
+ return call(env.toLowerCase() === 'prod' ? api.post : apiHml.post, "/ask", {
2153
2281
  question: question,
2282
+ description: prompt,
2154
2283
  profile: profile,
2155
2284
  tag: presset,
2156
2285
  files_directory: files_directory,
@@ -2183,7 +2312,7 @@ function testSaga(action) {
2183
2312
  }, _marked3, null, [[0, 12, 15, 19]]);
2184
2313
  }
2185
2314
  function uploadFilesSaga(action) {
2186
- var t, _action$payload4, id, file, pressets, token, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
2315
+ var t, _action$payload4, id, file, pressets, token, env, blob, formData, sanitizedPath, queryParams, url, _yield$call4, data;
2187
2316
  return _regeneratorRuntime().wrap(function uploadFilesSaga$(_context4) {
2188
2317
  while (1) switch (_context4.prev = _context4.next) {
2189
2318
  case 0:
@@ -2192,24 +2321,24 @@ function uploadFilesSaga(action) {
2192
2321
  _context4.next = 4;
2193
2322
  return put(commonLoadingStart());
2194
2323
  case 4:
2195
- _action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token;
2324
+ _action$payload4 = action.payload, id = _action$payload4.id, file = _action$payload4.file, pressets = _action$payload4.pressets, token = _action$payload4.token, env = _action$payload4.env;
2196
2325
  blob = new Blob([file.content]);
2197
2326
  formData = new FormData();
2198
- sanitizedPath = file.properties.path.replace(/^(\.\/|\/+)|\/+$/g, '');
2327
+ sanitizedPath = file.properties.path.replace(/^\/+|\/+$/g, '');
2199
2328
  formData.append('file', blob, sanitizedPath || 'default_filename');
2200
2329
  queryParams = pressets.length ? new URLSearchParams({
2201
2330
  tags: pressets.join(',')
2202
2331
  }).toString() : '';
2203
2332
  url = queryParams ? "/upload/" + id + "?token=" + token + "&" + queryParams : "/upload/" + id + "?token=" + token;
2204
2333
  _context4.next = 13;
2205
- return call(api.post, url, formData, {
2334
+ return call(env.toLowerCase() === 'prod' ? api.post : apiHml.post, url, formData, {
2206
2335
  headers: {
2207
2336
  'Content-Type': 'multipart/form-data'
2208
2337
  }
2209
2338
  });
2210
2339
  case 13:
2211
2340
  _context4.next = 15;
2212
- return call(api.get, "/training/" + id + "?token=" + token);
2341
+ return call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, "/training/" + id + "?token=" + token);
2213
2342
  case 15:
2214
2343
  _yield$call4 = _context4.sent;
2215
2344
  data = _yield$call4.data;
@@ -2241,7 +2370,7 @@ function uploadFilesSaga(action) {
2241
2370
  }, _marked4, null, [[1, 21, 25, 29]]);
2242
2371
  }
2243
2372
  function TrainingSaga(action) {
2244
- var t, _action$payload5, id, pressets, token, tag, queryParams, _yield$call5, data;
2373
+ var t, _action$payload5, id, pressets, token, env, tag, queryParams, _yield$call5, data;
2245
2374
  return _regeneratorRuntime().wrap(function TrainingSaga$(_context5) {
2246
2375
  while (1) switch (_context5.prev = _context5.next) {
2247
2376
  case 0:
@@ -2250,19 +2379,19 @@ function TrainingSaga(action) {
2250
2379
  _context5.next = 4;
2251
2380
  return put(commonLoadingStart());
2252
2381
  case 4:
2253
- _action$payload5 = action.payload, id = _action$payload5.id, pressets = _action$payload5.pressets, token = _action$payload5.token;
2382
+ _action$payload5 = action.payload, id = _action$payload5.id, pressets = _action$payload5.pressets, token = _action$payload5.token, env = _action$payload5.env;
2254
2383
  tag = pressets.join(',');
2255
2384
  queryParams = new URLSearchParams({
2256
2385
  tag: tag
2257
2386
  }).toString();
2258
2387
  _context5.next = 9;
2259
- return call(api.post, pressets.length > 0 ? "/training?" + queryParams : "/training", {
2388
+ return call(env.toLowerCase() === 'prod' ? api.post : apiHml.post, pressets.length > 0 ? "/training?" + queryParams : "/training", {
2260
2389
  files_directory: id,
2261
2390
  token: token
2262
2391
  });
2263
2392
  case 9:
2264
2393
  _context5.next = 11;
2265
- return call(api.get, "/training/" + id + "?token=" + token);
2394
+ return call(env.toLowerCase() === 'prod' ? api.get : apiHml.get, "/training/" + id + "?token=" + token);
2266
2395
  case 11:
2267
2396
  _yield$call5 = _context5.sent;
2268
2397
  data = _yield$call5.data;