@websolutespa/bom-llm 2.0.2 → 2.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @websolutespa/bom-llm
2
2
 
3
+ ## 2.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - Modified: useLlmView clear with openingContext
8
+
9
+ ## 2.0.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Added: setCurrentContext with openingContext
14
+
3
15
  ## 2.0.2
4
16
 
5
17
  ### Patch Changes
package/dist/esm/index.js CHANGED
@@ -19895,8 +19895,10 @@ const createLlmViewStore = _ref => {
19895
19895
  opened,
19896
19896
  embedded,
19897
19897
  portal,
19898
+ clear,
19898
19899
  send,
19899
- setEmbed
19900
+ setEmbed,
19901
+ setCurrentContext
19900
19902
  } = _ref;
19901
19903
  const props = {
19902
19904
  opened: opened != null ? opened : embedded != null || threadId != null ? true : false,
@@ -20065,6 +20067,15 @@ const createLlmViewStore = _ref => {
20065
20067
  const opened = !state.opened;
20066
20068
  if (opened) {
20067
20069
  state.openingContext = openingContext;
20070
+ if (openingContext) {
20071
+ clear();
20072
+ setCurrentContext({
20073
+ context: openingContext,
20074
+ title: 'opening-context'
20075
+ });
20076
+ } else {
20077
+ setCurrentContext();
20078
+ }
20068
20079
  }
20069
20080
  pushDataLayer({
20070
20081
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close',
@@ -20088,6 +20099,15 @@ const createLlmViewStore = _ref => {
20088
20099
  set(state => {
20089
20100
  if (opened) {
20090
20101
  state.openingContext = openingContext;
20102
+ if (openingContext) {
20103
+ clear();
20104
+ setCurrentContext({
20105
+ context: openingContext,
20106
+ title: 'opening-context'
20107
+ });
20108
+ } else {
20109
+ setCurrentContext();
20110
+ }
20091
20111
  }
20092
20112
  pushDataLayer({
20093
20113
  event: opened ? state.openingContext ? 'llm_open_context' : 'llm_open' : 'llm_close',
@@ -20157,15 +20177,19 @@ function LlmViewProvider(_ref2) {
20157
20177
  ...props
20158
20178
  } = _ref2;
20159
20179
  const {
20180
+ clear,
20160
20181
  send,
20161
- setEmbed
20182
+ setEmbed,
20183
+ setCurrentContext
20162
20184
  } = useLlm(state => state.actions);
20163
20185
  const storeRef = reactExports.useRef();
20164
20186
  if (!storeRef.current) {
20165
20187
  storeRef.current = createLlmViewStore({
20166
20188
  ...props,
20189
+ clear,
20167
20190
  send,
20168
- setEmbed
20191
+ setEmbed,
20192
+ setCurrentContext
20169
20193
  });
20170
20194
  }
20171
20195
  return storeRef.current && /*#__PURE__*/jsxRuntimeExports.jsx(LlmViewContext.Provider, {
@@ -45681,7 +45705,7 @@ const createLlmStore = config => {
45681
45705
  currentContext,
45682
45706
  systemContext: {
45683
45707
  ...systemContext,
45684
- ...currentContext.context
45708
+ ...currentContext?.context
45685
45709
  }
45686
45710
  }));
45687
45711
  },