@lvce-editor/chat-debug-view 2.2.0 → 2.3.0

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.
@@ -1028,12 +1028,13 @@ const diff2 = uid => {
1028
1028
  return diff(oldState, newState);
1029
1029
  };
1030
1030
 
1031
- const Filter = 'filter';
1032
- const ShowInputEvents = 'showInputEvents';
1033
-
1034
1031
  const getBoolean = value => {
1035
1032
  return value === true || value === 'true' || value === 'on' || value === '1';
1036
1033
  };
1034
+
1035
+ const Filter = 'filter';
1036
+ const ShowInputEvents = 'showInputEvents';
1037
+
1037
1038
  const handleInput = (state, name, value, checked) => {
1038
1039
  if (name === Filter) {
1039
1040
  return {
@@ -1241,6 +1242,11 @@ const getCss = () => {
1241
1242
  opacity: 0.8;
1242
1243
  }
1243
1244
 
1245
+ .ChatDebugViewEventCount {
1246
+ font-size: 12px;
1247
+ opacity: 0.8;
1248
+ }
1249
+
1244
1250
  .ChatDebugViewEvents {
1245
1251
  overflow: auto;
1246
1252
  scrollbar-width: thin;
@@ -1450,8 +1456,9 @@ const getChatDebugViewDom = (sessionId, errorMessage, filterValue, showInputEven
1450
1456
  }, text(errorMessage)];
1451
1457
  }
1452
1458
  const eventNodes = events.flatMap(getEventNode);
1459
+ const eventCountText = `${events.length} event${events.length === 1 ? '' : 's'}`;
1453
1460
  return [{
1454
- childCount: 3,
1461
+ childCount: 4,
1455
1462
  className: 'ChatDebugView',
1456
1463
  type: Div
1457
1464
  }, {
@@ -1478,6 +1485,10 @@ const getChatDebugViewDom = (sessionId, errorMessage, filterValue, showInputEven
1478
1485
  onChange: HandleInput,
1479
1486
  type: Input
1480
1487
  }, text('Show input events'), {
1488
+ childCount: 1,
1489
+ className: 'ChatDebugViewEventCount',
1490
+ type: Div
1491
+ }, text(eventCountText), {
1481
1492
  childCount: 1,
1482
1493
  className: 'ChatDebugViewSession',
1483
1494
  type: Div
@@ -1584,6 +1595,15 @@ const saveState = state => {
1584
1595
  };
1585
1596
  };
1586
1597
 
1598
+ const setEvents = (state, events) => {
1599
+ return {
1600
+ ...state,
1601
+ errorMessage: '',
1602
+ events,
1603
+ initial: false
1604
+ };
1605
+ };
1606
+
1587
1607
  const setSessionId = async (state, sessionId) => {
1588
1608
  const events = await listChatViewEvents(sessionId, state.databaseName, state.dataBaseVersion, state.eventStoreName, state.sessionIdIndexName);
1589
1609
  return {
@@ -1608,6 +1628,7 @@ const commandMap = {
1608
1628
  'ChatDebug.rerender': wrapCommand(rerender),
1609
1629
  'ChatDebug.resize': wrapCommand(resize),
1610
1630
  'ChatDebug.saveState': wrapGetter(saveState),
1631
+ 'ChatDebug.setEvents': wrapCommand(setEvents),
1611
1632
  'ChatDebug.setSessionId': wrapCommand(setSessionId),
1612
1633
  'ChatDebug.terminate': terminate
1613
1634
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/chat-debug-view",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Chat Debug View Worker",
5
5
  "repository": {
6
6
  "type": "git",