@appbaseio/reactivesearch-vue 3.0.0-rc.6.4 → 3.0.0-rc.6.5
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/@appbaseio/reactivesearch-vue.umd.js +132 -52
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +4 -4
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/{install-65eec53a.js → install-e8141489.js} +89 -51
- package/dist/cjs/install.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/es/index.js +2 -2
- package/dist/es/{install-cb6c5753.js → install-b785dd55.js} +90 -52
- package/dist/es/install.js +1 -1
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
|
@@ -26,7 +26,7 @@ import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as
|
|
|
26
26
|
import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, a as suggestions } from './Input-11d211d2.js';
|
|
27
27
|
import { C as Container } from './Container-d00219f7.js';
|
|
28
28
|
import Highlight from 'vue-highlight-words';
|
|
29
|
-
import { fetchAIResponse } from '@appbaseio/reactivecore/lib/actions/query';
|
|
29
|
+
import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
|
|
30
30
|
import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
31
31
|
import { C as Checkbox, R as Radio } from './FormControlList-fe6eaee4.js';
|
|
32
32
|
import { s as sanitizeObject } from './utils-d7dd4f4e.js';
|
|
@@ -2542,6 +2542,7 @@ var AIAnswer = defineComponent({
|
|
|
2542
2542
|
isLoading: types.boolRequired,
|
|
2543
2543
|
sessionIdFromStore: VueTypes.string,
|
|
2544
2544
|
showComponent: types.boolRequired,
|
|
2545
|
+
componentError: types.componentObject,
|
|
2545
2546
|
style: types.style
|
|
2546
2547
|
},
|
|
2547
2548
|
mounted: function mounted() {},
|
|
@@ -2625,14 +2626,50 @@ var AIAnswer = defineComponent({
|
|
|
2625
2626
|
},
|
|
2626
2627
|
messages: function messages() {
|
|
2627
2628
|
this.scrollToBottom();
|
|
2629
|
+
},
|
|
2630
|
+
componentError: function componentError(newVal) {
|
|
2631
|
+
var _this = this;
|
|
2632
|
+
if (newVal && newVal._bodyBlob) {
|
|
2633
|
+
this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
|
|
2634
|
+
if (!this.AISessionId) {
|
|
2635
|
+
this.generateNewSessionId();
|
|
2636
|
+
}
|
|
2637
|
+
newVal._bodyBlob.text().then(function (textData) {
|
|
2638
|
+
try {
|
|
2639
|
+
var parsedErrorRes = JSON.parse(textData);
|
|
2640
|
+
if (parsedErrorRes.error) {
|
|
2641
|
+
_this.error = parsedErrorRes.error;
|
|
2642
|
+
_this.$emit('on-data', {
|
|
2643
|
+
data: _this.messages,
|
|
2644
|
+
rawData: _this.$props.rawData,
|
|
2645
|
+
loading: _this.$props.isAIResponseLoading || _this.$props.isLoading,
|
|
2646
|
+
error: parsedErrorRes.error
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
} catch (error) {
|
|
2650
|
+
console.error('Error parsing component error JSON:', error);
|
|
2651
|
+
}
|
|
2652
|
+
})["catch"](function (error) {
|
|
2653
|
+
console.error('Error reading component error text data:', error);
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2628
2656
|
}
|
|
2629
2657
|
},
|
|
2630
2658
|
methods: {
|
|
2659
|
+
generateNewSessionId: function generateNewSessionId() {
|
|
2660
|
+
var _this2 = this;
|
|
2661
|
+
var newSessionPromise = this.createAISession();
|
|
2662
|
+
newSessionPromise.then(function (res) {
|
|
2663
|
+
_this2.AISessionId = res.AIsessionId;
|
|
2664
|
+
})["catch"](function (e) {
|
|
2665
|
+
console.error(e);
|
|
2666
|
+
});
|
|
2667
|
+
},
|
|
2631
2668
|
scrollToBottom: function scrollToBottom() {
|
|
2632
|
-
var
|
|
2669
|
+
var _this3 = this;
|
|
2633
2670
|
this.$nextTick(function () {
|
|
2634
|
-
var
|
|
2635
|
-
var messageContainer = (
|
|
2671
|
+
var _this3$$refs;
|
|
2672
|
+
var messageContainer = (_this3$$refs = _this3.$refs) == null ? void 0 : _this3$$refs[_this3.$props.innerRef];
|
|
2636
2673
|
if (messageContainer && messageContainer.$el) {
|
|
2637
2674
|
messageContainer.$el.scrollTo({
|
|
2638
2675
|
top: messageContainer.$el.scrollHeight,
|
|
@@ -2699,7 +2736,7 @@ var AIAnswer = defineComponent({
|
|
|
2699
2736
|
"class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
|
|
2700
2737
|
}, [createVNode("div", {
|
|
2701
2738
|
"class": "--default-error-element"
|
|
2702
|
-
}, [createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? "Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
|
|
2739
|
+
}, [createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? ", Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
|
|
2703
2740
|
"primary": true,
|
|
2704
2741
|
"onClick": this.handleRetryRequest
|
|
2705
2742
|
}, {
|
|
@@ -2750,7 +2787,7 @@ var AIAnswer = defineComponent({
|
|
|
2750
2787
|
}
|
|
2751
2788
|
},
|
|
2752
2789
|
renderIcons: function renderIcons() {
|
|
2753
|
-
var
|
|
2790
|
+
var _this4 = this;
|
|
2754
2791
|
var _slot, _slot2;
|
|
2755
2792
|
var _this$$props = this.$props,
|
|
2756
2793
|
getMicInstance = _this$$props.getMicInstance,
|
|
@@ -2764,12 +2801,12 @@ var AIAnswer = defineComponent({
|
|
|
2764
2801
|
"positionType": "absolute"
|
|
2765
2802
|
}, {
|
|
2766
2803
|
"default": function _default() {
|
|
2767
|
-
return [!
|
|
2804
|
+
return [!_this4.isLoadingState && _this4.AISessionId && _this4.shouldMicRender(showVoiceInput) && createVNode(Mic, {
|
|
2768
2805
|
"getInstance": getMicInstance,
|
|
2769
2806
|
"render": renderMic,
|
|
2770
|
-
"handleResult":
|
|
2807
|
+
"handleResult": _this4.handleVoiceResults,
|
|
2771
2808
|
"class": getClassName$2(innerClass, 'ai-search-mic') || null
|
|
2772
|
-
}, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot =
|
|
2809
|
+
}, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot = _this4.renderIcon()) ? _slot : {
|
|
2773
2810
|
"default": function _default() {
|
|
2774
2811
|
return [_slot];
|
|
2775
2812
|
}
|
|
@@ -2781,7 +2818,7 @@ var AIAnswer = defineComponent({
|
|
|
2781
2818
|
"positionType": "absolute"
|
|
2782
2819
|
}, {
|
|
2783
2820
|
"default": function _default() {
|
|
2784
|
-
return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 =
|
|
2821
|
+
return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 = _this4.renderIcon()) ? _slot2 : {
|
|
2785
2822
|
"default": function _default() {
|
|
2786
2823
|
return [_slot2];
|
|
2787
2824
|
}
|
|
@@ -2793,7 +2830,7 @@ var AIAnswer = defineComponent({
|
|
|
2793
2830
|
this.handleSendMessage(e);
|
|
2794
2831
|
},
|
|
2795
2832
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
2796
|
-
var
|
|
2833
|
+
var _this5 = this;
|
|
2797
2834
|
var _this$$props2 = this.$props,
|
|
2798
2835
|
enterButton = _this$$props2.enterButton,
|
|
2799
2836
|
innerClass = _this$$props2.innerClass;
|
|
@@ -2801,16 +2838,16 @@ var AIAnswer = defineComponent({
|
|
|
2801
2838
|
if (enterButton) {
|
|
2802
2839
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
2803
2840
|
if (renderEnterButton) {
|
|
2804
|
-
return renderEnterButton(
|
|
2841
|
+
return renderEnterButton(_this5.enterButtonOnClick);
|
|
2805
2842
|
}
|
|
2806
2843
|
return createVNode(SendButton, {
|
|
2807
2844
|
"primary": true,
|
|
2808
2845
|
"type": "submit",
|
|
2809
2846
|
"tabIndex": 0,
|
|
2810
|
-
"onClick":
|
|
2811
|
-
"onKeyPress":
|
|
2847
|
+
"onClick": _this5.handleSendMessage,
|
|
2848
|
+
"onKeyPress": _this5.handleKeyPress,
|
|
2812
2849
|
"class": "ask-btn " + getClassName$2(innerClass, 'ai-enter-button'),
|
|
2813
|
-
"disabled":
|
|
2850
|
+
"disabled": _this5.isLoadingState || !_this5.AISessionId
|
|
2814
2851
|
}, {
|
|
2815
2852
|
"default": function _default() {
|
|
2816
2853
|
return [createTextVNode("Send")];
|
|
@@ -2833,10 +2870,10 @@ var AIAnswer = defineComponent({
|
|
|
2833
2870
|
return getComponent(data, this);
|
|
2834
2871
|
},
|
|
2835
2872
|
handleTextAreaHeightChange: function handleTextAreaHeightChange() {
|
|
2836
|
-
var _this$$
|
|
2837
|
-
var textArea = (_this$$
|
|
2838
|
-
var inputWrapper = (_this$$
|
|
2839
|
-
var errorContainer = (_this$$
|
|
2873
|
+
var _this$$refs, _this$$refs$_inputRef, _this$$refs2, _this$$refs2$_inputWr, _this$$refs3;
|
|
2874
|
+
var textArea = (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$_inputRef = _this$$refs[_inputRef]) == null ? void 0 : _this$$refs$_inputRef.$el;
|
|
2875
|
+
var inputWrapper = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputWr = _this$$refs2[_inputWrapperRef]) == null ? void 0 : _this$$refs2$_inputWr.$el;
|
|
2876
|
+
var errorContainer = (_this$$refs3 = this.$refs) == null ? void 0 : _this$$refs3[_errorContainerRef];
|
|
2840
2877
|
if (textArea) {
|
|
2841
2878
|
textArea.style.height = '42px';
|
|
2842
2879
|
var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
|
|
@@ -2868,21 +2905,20 @@ var AIAnswer = defineComponent({
|
|
|
2868
2905
|
},
|
|
2869
2906
|
render: function render() {
|
|
2870
2907
|
var _slot3;
|
|
2871
|
-
var
|
|
2908
|
+
var _this6 = this;
|
|
2872
2909
|
var props = this.$props;
|
|
2873
2910
|
if (!this.shouldShowComponent) {
|
|
2874
2911
|
return null;
|
|
2875
2912
|
}
|
|
2876
2913
|
return createVNode(Chatbox, {
|
|
2877
|
-
"style": props.style
|
|
2878
|
-
"class": "--ai-chat-box-wrapper"
|
|
2914
|
+
"style": props.style || {}
|
|
2879
2915
|
}, {
|
|
2880
2916
|
"default": function _default() {
|
|
2881
|
-
return [
|
|
2882
|
-
"class": getClassName$2(
|
|
2917
|
+
return [_this6.$props.title && createVNode(Title, {
|
|
2918
|
+
"class": getClassName$2(_this6.$props.innerClass, 'title') || ''
|
|
2883
2919
|
}, {
|
|
2884
2920
|
"default": function _default() {
|
|
2885
|
-
return [
|
|
2921
|
+
return [_this6.$props.title];
|
|
2886
2922
|
}
|
|
2887
2923
|
}), createVNode(ChatContainer, {
|
|
2888
2924
|
"class": "--ai-chat-container",
|
|
@@ -2890,33 +2926,33 @@ var AIAnswer = defineComponent({
|
|
|
2890
2926
|
"showInput": props.showInput
|
|
2891
2927
|
}, {
|
|
2892
2928
|
"default": function _default() {
|
|
2893
|
-
return [
|
|
2894
|
-
"themePreset":
|
|
2929
|
+
return [_this6.hasCustomRenderer && createVNode(MessagesContainer, {
|
|
2930
|
+
"themePreset": _this6.themePreset,
|
|
2895
2931
|
"theme": props.theme,
|
|
2896
|
-
"ref":
|
|
2932
|
+
"ref": _this6.$props.innerRef,
|
|
2897
2933
|
"class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
|
|
2898
|
-
}, _isSlot$1(_slot3 =
|
|
2934
|
+
}, _isSlot$1(_slot3 = _this6.getComponent()) ? _slot3 : {
|
|
2899
2935
|
"default": function _default() {
|
|
2900
2936
|
return [_slot3];
|
|
2901
2937
|
}
|
|
2902
|
-
}), !
|
|
2903
|
-
"themePreset":
|
|
2938
|
+
}), !_this6.hasCustomRenderer && createVNode(MessagesContainer, {
|
|
2939
|
+
"themePreset": _this6.themePreset,
|
|
2904
2940
|
"theme": props.theme,
|
|
2905
|
-
"ref":
|
|
2941
|
+
"ref": _this6.$props.innerRef,
|
|
2906
2942
|
"class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
|
|
2907
2943
|
}, {
|
|
2908
2944
|
"default": function _default() {
|
|
2909
|
-
return [
|
|
2945
|
+
return [_this6.messages.map(function (message, index) {
|
|
2910
2946
|
return createVNode(Message, {
|
|
2911
2947
|
"key": index,
|
|
2912
2948
|
"isSender": message.role === AI_ROLES.USER,
|
|
2913
2949
|
"innerHTML": md$1.render(message.content),
|
|
2914
|
-
"themePreset":
|
|
2950
|
+
"themePreset": _this6.themePreset,
|
|
2915
2951
|
"theme": props.theme,
|
|
2916
2952
|
"class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
|
|
2917
2953
|
}, null);
|
|
2918
|
-
}),
|
|
2919
|
-
"themePreset":
|
|
2954
|
+
}), _this6.isLoadingState && createVNode(Message, {
|
|
2955
|
+
"themePreset": _this6.themePreset,
|
|
2920
2956
|
"theme": props.theme,
|
|
2921
2957
|
"isSender": false,
|
|
2922
2958
|
"class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
|
|
@@ -2925,31 +2961,31 @@ var AIAnswer = defineComponent({
|
|
|
2925
2961
|
return [createVNode(TypingIndicator, null, {
|
|
2926
2962
|
"default": function _default() {
|
|
2927
2963
|
return [createVNode(TypingDot, {
|
|
2928
|
-
"themePreset":
|
|
2964
|
+
"themePreset": _this6.themePreset
|
|
2929
2965
|
}, null), createVNode(TypingDot, {
|
|
2930
|
-
"themePreset":
|
|
2966
|
+
"themePreset": _this6.themePreset
|
|
2931
2967
|
}, null), createVNode(TypingDot, {
|
|
2932
|
-
"themePreset":
|
|
2968
|
+
"themePreset": _this6.themePreset
|
|
2933
2969
|
}, null)];
|
|
2934
2970
|
}
|
|
2935
2971
|
})];
|
|
2936
2972
|
}
|
|
2937
2973
|
})];
|
|
2938
2974
|
}
|
|
2939
|
-
}),
|
|
2975
|
+
}), _this6.renderErrorComponent(), ' ', props.showFeedback && createVNode("div", {
|
|
2940
2976
|
"class": "--ai-answer-feedback-container " + (getClassName$2(props.innerClass, 'ai-feedback') || '')
|
|
2941
2977
|
}, [createVNode(AIFeedback, {
|
|
2942
|
-
"hideUI":
|
|
2943
|
-
"key":
|
|
2978
|
+
"hideUI": _this6.isLoadingState || !_this6.sessionId,
|
|
2979
|
+
"key": _this6.sessionId,
|
|
2944
2980
|
"onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
|
|
2945
|
-
|
|
2981
|
+
_this6.trackUsefullness(_this6.sessionId, {
|
|
2946
2982
|
useful: useful,
|
|
2947
2983
|
reason: reason
|
|
2948
2984
|
});
|
|
2949
2985
|
}
|
|
2950
2986
|
}, null)]), props.showInput && createVNode(MessageInputContainer, {
|
|
2951
2987
|
"class": "--ai-input-container",
|
|
2952
|
-
"onSubmit":
|
|
2988
|
+
"onSubmit": _this6.handleSendMessage
|
|
2953
2989
|
}, {
|
|
2954
2990
|
"default": function _default() {
|
|
2955
2991
|
return [createVNode(InputGroup, {
|
|
@@ -2965,19 +3001,19 @@ var AIAnswer = defineComponent({
|
|
|
2965
3001
|
"ref": _inputRef,
|
|
2966
3002
|
"placeholder": props.placeholder,
|
|
2967
3003
|
"enterButton": props.enterButton,
|
|
2968
|
-
"value":
|
|
2969
|
-
"onInput":
|
|
3004
|
+
"value": _this6.inputMessage,
|
|
3005
|
+
"onInput": _this6.handleMessageInputChange,
|
|
2970
3006
|
"id": props.componentId + "-ai-input",
|
|
2971
3007
|
"showIcon": props.showIcon,
|
|
2972
3008
|
"iconPosition": props.iconPosition,
|
|
2973
|
-
"themePreset":
|
|
2974
|
-
"disabled":
|
|
3009
|
+
"themePreset": _this6.themePreset,
|
|
3010
|
+
"disabled": _this6.isLoadingState || !_this6.AISessionId,
|
|
2975
3011
|
"class": getClassName$2(props.innerClass, 'ai-input') || null
|
|
2976
|
-
}, null), ' ',
|
|
3012
|
+
}, null), ' ', _this6.renderIcons()];
|
|
2977
3013
|
}
|
|
2978
3014
|
})];
|
|
2979
3015
|
}
|
|
2980
|
-
}),
|
|
3016
|
+
}), _this6.renderEnterButtonElement()];
|
|
2981
3017
|
}
|
|
2982
3018
|
}), ' '];
|
|
2983
3019
|
}
|
|
@@ -3004,12 +3040,14 @@ var mapStateToProps$1 = function mapStateToProps(state, props) {
|
|
|
3004
3040
|
rawData: state.rawData[props.componentId],
|
|
3005
3041
|
themePreset: state.config.themePreset,
|
|
3006
3042
|
isLoading: state.isLoading[props.componentId] || false,
|
|
3007
|
-
sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || ''
|
|
3043
|
+
sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
|
|
3044
|
+
componentError: state.error[props.componentId]
|
|
3008
3045
|
};
|
|
3009
3046
|
};
|
|
3010
3047
|
var mapDispatchToProps$1 = {
|
|
3011
3048
|
getAIResponse: fetchAIResponse,
|
|
3012
|
-
trackUsefullness: recordAISessionUsefulness
|
|
3049
|
+
trackUsefullness: recordAISessionUsefulness,
|
|
3050
|
+
createAISession: createAISession
|
|
3013
3051
|
};
|
|
3014
3052
|
var AIConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
|
|
3015
3053
|
componentType: componentTypes.AIAnswer,
|
package/dist/es/install.js
CHANGED
|
@@ -29,7 +29,7 @@ import 'url-search-params-polyfill';
|
|
|
29
29
|
import './ReactiveBase.js';
|
|
30
30
|
import 'hotkeys-js';
|
|
31
31
|
import 'remarkable';
|
|
32
|
-
export { i as default } from './install-
|
|
32
|
+
export { i as default } from './install-b785dd55.js';
|
|
33
33
|
import './DropDown-39fedff8.js';
|
|
34
34
|
import './Input-11d211d2.js';
|
|
35
35
|
import 'compute-scroll-into-view';
|
package/dist/es/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appbaseio/reactivesearch-vue",
|
|
3
|
-
"version": "3.0.0-rc.6.
|
|
3
|
+
"version": "3.0.0-rc.6.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"jsnext:main": "dist/es/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@appbaseio/analytics": "^1.2.0-alpha.1",
|
|
38
|
-
"@appbaseio/reactivecore": "10.0.0-alpha.
|
|
38
|
+
"@appbaseio/reactivecore": "10.0.0-alpha.26",
|
|
39
39
|
"@appbaseio/vue-emotion": "0.6.0-alpha.6",
|
|
40
40
|
"@emotion/css": "^11.10.5",
|
|
41
41
|
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
|