@appbaseio/reactivesearch-vue 3.0.0-rc.6.2 → 3.0.0-rc.6.4

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.
@@ -7294,17 +7294,7 @@
7294
7294
  dispatch((0, misc.setPromotedResults)([], component));
7295
7295
  }
7296
7296
  dispatch((0, misc.setRawData)(component, response));
7297
- if (response.AISessionId) {
7298
- var localCache = ((0, helper.getObjectFromLocalStorage)(constants$1.AI_LOCAL_CACHE_KEY) || {})[props.componentId];
7299
- if (localCache && localCache.sessionId && localCache.sessionId === response.AISessionId) {
7300
- dispatch((0, misc.setAIResponse)(component, localCache));
7301
- } else {
7302
- (0, helper.setObjectInLocalStorage)('AISessions', _defineProperty({}, component, {}));
7303
- dispatch((0, query.fetchAIResponse)(response.AISessionId, component, '', {
7304
- hits: response.hits || {}
7305
- }, props[component].componentType === constants$1.componentTypes.searchBox));
7306
- }
7307
- } else if (response.AIAnswer) {
7297
+ if (response.AIAnswer) {
7308
7298
  if (response.AIAnswer.error) {
7309
7299
  dispatch((0, misc.setAIResponseError)(component, {
7310
7300
  message: response.AIAnswer.error
@@ -7320,11 +7310,25 @@
7320
7310
  text: input.choices[0].message.content
7321
7311
  }
7322
7312
  };
7323
- dispatch((0, misc.setAIResponse)(component, {
7313
+ var finalResponseObj = {
7324
7314
  response: finalResponse,
7325
7315
  meta: response.hits,
7326
7316
  isTyping: false
7327
- }));
7317
+ };
7318
+ if (response.AISessionId) {
7319
+ finalResponseObj.sessionId = response.AISessionId;
7320
+ }
7321
+ dispatch((0, misc.setAIResponse)(component, finalResponseObj));
7322
+ } else if (response.AISessionId) {
7323
+ var localCache = ((0, helper.getObjectFromLocalStorage)(constants$1.AI_LOCAL_CACHE_KEY) || {})[props.componentId];
7324
+ if (localCache && localCache.sessionId && localCache.sessionId === response.AISessionId) {
7325
+ dispatch((0, misc.setAIResponse)(component, localCache));
7326
+ } else {
7327
+ (0, helper.setObjectInLocalStorage)('AISessions', _defineProperty({}, component, {}));
7328
+ dispatch((0, query.fetchAIResponse)(response.AISessionId, component, '', {
7329
+ hits: response.hits || {}
7330
+ }, props[component].componentType === constants$1.componentTypes.searchBox));
7331
+ }
7328
7332
  }
7329
7333
  dispatch((0, misc.setCustomData)(response.customData, component));
7330
7334
  if (response.hits && !((response.AIAnswer || response.AISessionId) && props[component].componentType === constants$1.componentTypes.searchBox)) {
@@ -8242,13 +8246,14 @@
8242
8246
  var chunk = decoder.decode(value, {
8243
8247
  stream: true
8244
8248
  });
8245
- var lines = chunk.split('\n');
8249
+ var regex = /\n\n(?=data:)/;
8250
+ var lines = chunk.split(regex);
8246
8251
  var shouldStop = false;
8247
8252
  for (var i = 0; i < lines.length; i++) {
8248
8253
  var line = lines[i];
8249
8254
  if (line.startsWith('data: ')) {
8250
8255
  var content = line.slice(6);
8251
- if (content === '[DONE]') {
8256
+ if (content === '[DONE]\n\n') {
8252
8257
  shouldStop = true;
8253
8258
  if (Promise.resolve(metaInfoPromise) === metaInfoPromise) {
8254
8259
  metaInfoPromise.then(function (resMeta) {
@@ -24776,7 +24781,7 @@
24776
24781
  // eslint-disable-next-line no-nested-ternary
24777
24782
  props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\t}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
24778
24783
  // eslint-disable-next-line no-nested-ternary
24779
- props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\n\t}\n\n\tli{\n\t\tdisplay: unset;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n";
24784
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n";
24780
24785
  };
24781
24786
  var messageBGColor = function messageBGColor(props) {
24782
24787
  var finalBGColor;
@@ -26494,7 +26499,8 @@
26494
26499
  renderError: types.title,
26495
26500
  isLoading: types.boolRequired,
26496
26501
  sessionIdFromStore: Q.string,
26497
- showComponent: types.boolRequired
26502
+ showComponent: types.boolRequired,
26503
+ style: types.style
26498
26504
  },
26499
26505
  mounted: function mounted() {},
26500
26506
  watch: {
@@ -26520,7 +26526,7 @@
26520
26526
  role: constants_7$1.ASSISTANT,
26521
26527
  content: response.answer.text
26522
26528
  });
26523
- this.error = {
26529
+ if (!this.AISessionId) this.error = {
26524
26530
  message: this.errorMessageForMissingSessionId
26525
26531
  };
26526
26532
  }
@@ -26538,7 +26544,6 @@
26538
26544
  });
26539
26545
  },
26540
26546
  isAIResponseLoading: function isAIResponseLoading(newVal) {
26541
- this.isLoadingState = newVal;
26542
26547
  this.$emit('on-data', {
26543
26548
  data: this.messages,
26544
26549
  rawData: this.$props.rawData,
@@ -26547,7 +26552,6 @@
26547
26552
  });
26548
26553
  },
26549
26554
  isLoading: function isLoading(newVal) {
26550
- this.isLoadingState = newVal;
26551
26555
  this.$emit('on-data', {
26552
26556
  data: this.messages,
26553
26557
  rawData: this.$props.rawData,
@@ -26665,6 +26669,7 @@
26665
26669
  return null;
26666
26670
  },
26667
26671
  handleKeyPress: function handleKeyPress(e) {
26672
+ window.console.log('e', e);
26668
26673
  if (e.key === 'Enter') {
26669
26674
  this.handleSendMessage(e);
26670
26675
  this.inputMessage = '';
@@ -26762,7 +26767,7 @@
26762
26767
  "tabIndex": 0,
26763
26768
  "onClick": _this3.handleSendMessage,
26764
26769
  "onKeyPress": _this3.handleKeyPress,
26765
- "class": "enter-btn " + helper_31(innerClass, 'ai-enter-button'),
26770
+ "class": "ask-btn " + helper_31(innerClass, 'ai-enter-button'),
26766
26771
  "disabled": _this3.isLoadingState || !_this3.AISessionId
26767
26772
  }, {
26768
26773
  "default": function _default() {
@@ -26826,7 +26831,10 @@
26826
26831
  if (!this.shouldShowComponent) {
26827
26832
  return null;
26828
26833
  }
26829
- return vue.createVNode(Chatbox, null, {
26834
+ return vue.createVNode(Chatbox, {
26835
+ "style": props.style,
26836
+ "class": "--ai-chat-box-wrapper"
26837
+ }, {
26830
26838
  "default": function _default() {
26831
26839
  return [_this4.$props.title && vue.createVNode(Title, {
26832
26840
  "class": helper_31(_this4.$props.innerClass, 'title') || ''
@@ -26835,6 +26843,7 @@
26835
26843
  return [_this4.$props.title];
26836
26844
  }
26837
26845
  }), vue.createVNode(ChatContainer, {
26846
+ "class": "--ai-chat-container",
26838
26847
  "theme": props.theme,
26839
26848
  "showInput": props.showInput
26840
26849
  }, {
@@ -26912,12 +26921,10 @@
26912
26921
  "default": function _default() {
26913
26922
  return [vue.createVNode(MessageInput, {
26914
26923
  "ref": _inputRef,
26915
- "type": "text",
26916
26924
  "placeholder": props.placeholder,
26917
26925
  "enterButton": props.enterButton,
26918
26926
  "value": _this4.inputMessage,
26919
26927
  "onInput": _this4.handleMessageInputChange,
26920
- "onKeyPress": _this4.handleKeyPress,
26921
26928
  "id": props.componentId + "-ai-input",
26922
26929
  "showIcon": props.showIcon,
26923
26930
  "iconPosition": props.iconPosition,
@@ -39941,7 +39948,7 @@
39941
39948
  }, queryString, renderFunction);
39942
39949
  }
39943
39950
 
39944
- var version = "3.0.0-rc.6.2";
39951
+ var version = "3.0.0-rc.6.4";
39945
39952
 
39946
39953
  var components = [RLConnected, ResultCard, ResultList, ReactiveBase, SBConnected, ListConnected, ListConnected$1, RangeConnected$1, RangeConnected$2, RangeConnected$3, RangeConnected, RcConnected, RcConnected$1, RcConnected$2, TBConnected, ListConnected$2, ListConnected$3, StateProviderConnected, RangeConnected$4, TreeListConnected, AIConnected];
39947
39954
  function install$1 (Vue) {