@getlupa/client 1.4.2 → 1.4.3

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.
@@ -20769,11 +20769,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20769
20769
  }
20770
20770
  return Env[environment] || Env["production"];
20771
20771
  };
20772
- const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
20772
+ const suggestSearchChatPhrases = (options, request, chatSettings) => __async(void 0, null, function* () {
20773
20773
  var _a, _b, _c;
20774
20774
  const { environment, customBaseUrl } = options;
20775
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20775
20776
  try {
20776
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20777
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20777
20778
  body: JSON.stringify(request),
20778
20779
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20779
20780
  }));
@@ -20789,14 +20790,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20789
20790
  return { success: false, errors: [e] };
20790
20791
  }
20791
20792
  });
20792
- const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20793
+ const suggestPhraseAlternatives = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20793
20794
  var _a, _b, _c;
20794
20795
  const { environment, customBaseUrl } = options;
20796
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20795
20797
  try {
20796
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20797
- body: JSON.stringify({ phrases }),
20798
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20799
- }));
20798
+ const res = yield fetch(
20799
+ `${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
20800
+ __spreadProps2(__spreadValues2({}, defaultConfig), {
20801
+ body: JSON.stringify({ phrases }),
20802
+ headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20803
+ })
20804
+ );
20800
20805
  if (res.status < 400) {
20801
20806
  const data = yield res.json();
20802
20807
  return __spreadProps2(__spreadValues2({}, data), { success: true });
@@ -20809,11 +20814,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20809
20814
  return { success: false, errors: [e] };
20810
20815
  }
20811
20816
  });
20812
- const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20817
+ const suggestSimplifiedPhrases = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20813
20818
  var _a, _b, _c;
20814
20819
  const { environment, customBaseUrl } = options;
20820
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20815
20821
  try {
20816
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20822
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20817
20823
  body: JSON.stringify({ phrases }),
20818
20824
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20819
20825
  }));
@@ -20829,15 +20835,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20829
20835
  return { success: false, errors: [e] };
20830
20836
  }
20831
20837
  });
20832
- const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
20838
+ const suggestBestProductMatches = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, {
20833
20839
  initialQuery,
20834
20840
  productStrings,
20835
20841
  messageHistory
20836
- }) {
20842
+ }, chatSettings) {
20837
20843
  var _a, _b, _c;
20838
20844
  const { environment, customBaseUrl } = options;
20845
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20839
20846
  try {
20840
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20847
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20841
20848
  body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
20842
20849
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20843
20850
  }));
@@ -20874,9 +20881,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20874
20881
  }
20875
20882
  return history;
20876
20883
  };
20877
- const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived) => {
20884
+ const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived, chatSettings) => {
20878
20885
  var _a;
20879
- fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20886
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20887
+ fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20880
20888
  body: JSON.stringify({ initialQuery, messageHistory }),
20881
20889
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20882
20890
  })).then((response) => {
@@ -21016,9 +21024,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21016
21024
  return result.items;
21017
21025
  });
21018
21026
  const getPhraseAlternatives = () => __async(this, null, function* () {
21019
- const { phrases } = yield ChatService.suggestPhraseAlternatives(props.options.sdkOptions, {
21020
- phrases: [props.phrase]
21021
- });
21027
+ const { phrases } = yield ChatService.suggestPhraseAlternatives(
21028
+ props.options.sdkOptions,
21029
+ {
21030
+ phrases: [props.phrase]
21031
+ },
21032
+ props.options.chatSettings
21033
+ );
21022
21034
  return phrases != null ? phrases : [];
21023
21035
  });
21024
21036
  return (_ctx, _cache) => {
@@ -21083,11 +21095,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21083
21095
  return (_b = (_a2 = result[titleKey.value]) == null ? void 0 : _a2.toString()) != null ? _b : "";
21084
21096
  }
21085
21097
  );
21086
- const { products } = yield ChatService.suggestBestProductMatches(props.options.sdkOptions, {
21087
- initialQuery: props.entry.userInput,
21088
- productStrings: productResultStrings,
21089
- messageHistory: (_a = props.history) != null ? _a : []
21090
- });
21098
+ const { products } = yield ChatService.suggestBestProductMatches(
21099
+ props.options.sdkOptions,
21100
+ {
21101
+ initialQuery: props.entry.userInput,
21102
+ productStrings: productResultStrings,
21103
+ messageHistory: (_a = props.history) != null ? _a : []
21104
+ },
21105
+ props.options.chatSettings
21106
+ );
21091
21107
  bestMatches.value = products;
21092
21108
  emit2("loaded", products);
21093
21109
  } finally {
@@ -21160,7 +21176,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21160
21176
  initialQuery: props.content,
21161
21177
  messageHistory: (_a = props.history) != null ? _a : []
21162
21178
  },
21163
- processChunk
21179
+ processChunk,
21180
+ props.options.chatSettings
21164
21181
  );
21165
21182
  });
21166
21183
  return (_ctx, _cache) => {
@@ -21257,7 +21274,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21257
21274
  };
21258
21275
  const { phrases, success } = yield ChatService.suggestSearchChatPhrases(
21259
21276
  props.options.sdkOptions,
21260
- request
21277
+ request,
21278
+ props.options.chatSettings
21261
21279
  );
21262
21280
  if (!success || !phrases.length) {
21263
21281
  error.value = "Something went wrong";
@@ -20769,11 +20769,12 @@ const getApiUrl = (environment, customBaseUrl) => {
20769
20769
  }
20770
20770
  return Env[environment] || Env["production"];
20771
20771
  };
20772
- const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
20772
+ const suggestSearchChatPhrases = (options, request, chatSettings) => __async(void 0, null, function* () {
20773
20773
  var _a, _b, _c;
20774
20774
  const { environment, customBaseUrl } = options;
20775
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20775
20776
  try {
20776
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20777
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20777
20778
  body: JSON.stringify(request),
20778
20779
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20779
20780
  }));
@@ -20789,14 +20790,18 @@ const suggestSearchChatPhrases = (options, request) => __async(void 0, null, fun
20789
20790
  return { success: false, errors: [e] };
20790
20791
  }
20791
20792
  });
20792
- const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20793
+ const suggestPhraseAlternatives = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20793
20794
  var _a, _b, _c;
20794
20795
  const { environment, customBaseUrl } = options;
20796
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20795
20797
  try {
20796
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20797
- body: JSON.stringify({ phrases }),
20798
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20799
- }));
20798
+ const res = yield fetch(
20799
+ `${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
20800
+ __spreadProps2(__spreadValues2({}, defaultConfig), {
20801
+ body: JSON.stringify({ phrases }),
20802
+ headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20803
+ })
20804
+ );
20800
20805
  if (res.status < 400) {
20801
20806
  const data = yield res.json();
20802
20807
  return __spreadProps2(__spreadValues2({}, data), { success: true });
@@ -20809,11 +20814,12 @@ const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function
20809
20814
  return { success: false, errors: [e] };
20810
20815
  }
20811
20816
  });
20812
- const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20817
+ const suggestSimplifiedPhrases = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20813
20818
  var _a, _b, _c;
20814
20819
  const { environment, customBaseUrl } = options;
20820
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20815
20821
  try {
20816
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20822
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20817
20823
  body: JSON.stringify({ phrases }),
20818
20824
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20819
20825
  }));
@@ -20829,15 +20835,16 @@ const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function*
20829
20835
  return { success: false, errors: [e] };
20830
20836
  }
20831
20837
  });
20832
- const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
20838
+ const suggestBestProductMatches = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, {
20833
20839
  initialQuery,
20834
20840
  productStrings,
20835
20841
  messageHistory
20836
- }) {
20842
+ }, chatSettings) {
20837
20843
  var _a, _b, _c;
20838
20844
  const { environment, customBaseUrl } = options;
20845
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20839
20846
  try {
20840
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20847
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20841
20848
  body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
20842
20849
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20843
20850
  }));
@@ -20874,9 +20881,10 @@ const prepareChatHistory = (chatLog) => {
20874
20881
  }
20875
20882
  return history;
20876
20883
  };
20877
- const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived) => {
20884
+ const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived, chatSettings) => {
20878
20885
  var _a;
20879
- fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20886
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20887
+ fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20880
20888
  body: JSON.stringify({ initialQuery, messageHistory }),
20881
20889
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20882
20890
  })).then((response) => {
@@ -21016,9 +21024,13 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
21016
21024
  return result.items;
21017
21025
  });
21018
21026
  const getPhraseAlternatives = () => __async(this, null, function* () {
21019
- const { phrases } = yield ChatService.suggestPhraseAlternatives(props.options.sdkOptions, {
21020
- phrases: [props.phrase]
21021
- });
21027
+ const { phrases } = yield ChatService.suggestPhraseAlternatives(
21028
+ props.options.sdkOptions,
21029
+ {
21030
+ phrases: [props.phrase]
21031
+ },
21032
+ props.options.chatSettings
21033
+ );
21022
21034
  return phrases != null ? phrases : [];
21023
21035
  });
21024
21036
  return (_ctx, _cache) => {
@@ -21083,11 +21095,15 @@ const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
21083
21095
  return (_b = (_a2 = result[titleKey.value]) == null ? void 0 : _a2.toString()) != null ? _b : "";
21084
21096
  }
21085
21097
  );
21086
- const { products } = yield ChatService.suggestBestProductMatches(props.options.sdkOptions, {
21087
- initialQuery: props.entry.userInput,
21088
- productStrings: productResultStrings,
21089
- messageHistory: (_a = props.history) != null ? _a : []
21090
- });
21098
+ const { products } = yield ChatService.suggestBestProductMatches(
21099
+ props.options.sdkOptions,
21100
+ {
21101
+ initialQuery: props.entry.userInput,
21102
+ productStrings: productResultStrings,
21103
+ messageHistory: (_a = props.history) != null ? _a : []
21104
+ },
21105
+ props.options.chatSettings
21106
+ );
21091
21107
  bestMatches.value = products;
21092
21108
  emit2("loaded", products);
21093
21109
  } finally {
@@ -21160,7 +21176,8 @@ const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
21160
21176
  initialQuery: props.content,
21161
21177
  messageHistory: (_a = props.history) != null ? _a : []
21162
21178
  },
21163
- processChunk
21179
+ processChunk,
21180
+ props.options.chatSettings
21164
21181
  );
21165
21182
  });
21166
21183
  return (_ctx, _cache) => {
@@ -21257,7 +21274,8 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
21257
21274
  };
21258
21275
  const { phrases, success } = yield ChatService.suggestSearchChatPhrases(
21259
21276
  props.options.sdkOptions,
21260
- request
21277
+ request,
21278
+ props.options.chatSettings
21261
21279
  );
21262
21280
  if (!success || !phrases.length) {
21263
21281
  error.value = "Something went wrong";
@@ -20767,11 +20767,12 @@ const getApiUrl = (environment, customBaseUrl) => {
20767
20767
  }
20768
20768
  return Env[environment] || Env["production"];
20769
20769
  };
20770
- const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
20770
+ const suggestSearchChatPhrases = (options, request, chatSettings) => __async(void 0, null, function* () {
20771
20771
  var _a, _b, _c;
20772
20772
  const { environment, customBaseUrl } = options;
20773
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20773
20774
  try {
20774
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20775
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20775
20776
  body: JSON.stringify(request),
20776
20777
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20777
20778
  }));
@@ -20787,14 +20788,18 @@ const suggestSearchChatPhrases = (options, request) => __async(void 0, null, fun
20787
20788
  return { success: false, errors: [e] };
20788
20789
  }
20789
20790
  });
20790
- const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20791
+ const suggestPhraseAlternatives = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20791
20792
  var _a, _b, _c;
20792
20793
  const { environment, customBaseUrl } = options;
20794
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20793
20795
  try {
20794
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20795
- body: JSON.stringify({ phrases }),
20796
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20797
- }));
20796
+ const res = yield fetch(
20797
+ `${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
20798
+ __spreadProps2(__spreadValues2({}, defaultConfig), {
20799
+ body: JSON.stringify({ phrases }),
20800
+ headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20801
+ })
20802
+ );
20798
20803
  if (res.status < 400) {
20799
20804
  const data = yield res.json();
20800
20805
  return __spreadProps2(__spreadValues2({}, data), { success: true });
@@ -20807,11 +20812,12 @@ const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function
20807
20812
  return { success: false, errors: [e] };
20808
20813
  }
20809
20814
  });
20810
- const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20815
+ const suggestSimplifiedPhrases = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20811
20816
  var _a, _b, _c;
20812
20817
  const { environment, customBaseUrl } = options;
20818
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20813
20819
  try {
20814
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20820
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20815
20821
  body: JSON.stringify({ phrases }),
20816
20822
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20817
20823
  }));
@@ -20827,15 +20833,16 @@ const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function*
20827
20833
  return { success: false, errors: [e] };
20828
20834
  }
20829
20835
  });
20830
- const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
20836
+ const suggestBestProductMatches = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, {
20831
20837
  initialQuery,
20832
20838
  productStrings,
20833
20839
  messageHistory
20834
- }) {
20840
+ }, chatSettings) {
20835
20841
  var _a, _b, _c;
20836
20842
  const { environment, customBaseUrl } = options;
20843
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20837
20844
  try {
20838
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20845
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20839
20846
  body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
20840
20847
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20841
20848
  }));
@@ -20872,9 +20879,10 @@ const prepareChatHistory = (chatLog) => {
20872
20879
  }
20873
20880
  return history;
20874
20881
  };
20875
- const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived) => {
20882
+ const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived, chatSettings) => {
20876
20883
  var _a;
20877
- fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20884
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20885
+ fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20878
20886
  body: JSON.stringify({ initialQuery, messageHistory }),
20879
20887
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20880
20888
  })).then((response) => {
@@ -21014,9 +21022,13 @@ const _sfc_main$4$1 = /* @__PURE__ */ defineComponent({
21014
21022
  return result.items;
21015
21023
  });
21016
21024
  const getPhraseAlternatives = () => __async(this, null, function* () {
21017
- const { phrases } = yield ChatService.suggestPhraseAlternatives(props.options.sdkOptions, {
21018
- phrases: [props.phrase]
21019
- });
21025
+ const { phrases } = yield ChatService.suggestPhraseAlternatives(
21026
+ props.options.sdkOptions,
21027
+ {
21028
+ phrases: [props.phrase]
21029
+ },
21030
+ props.options.chatSettings
21031
+ );
21020
21032
  return phrases != null ? phrases : [];
21021
21033
  });
21022
21034
  return (_ctx, _cache) => {
@@ -21081,11 +21093,15 @@ const _sfc_main$3$1 = /* @__PURE__ */ defineComponent({
21081
21093
  return (_b = (_a2 = result[titleKey.value]) == null ? void 0 : _a2.toString()) != null ? _b : "";
21082
21094
  }
21083
21095
  );
21084
- const { products } = yield ChatService.suggestBestProductMatches(props.options.sdkOptions, {
21085
- initialQuery: props.entry.userInput,
21086
- productStrings: productResultStrings,
21087
- messageHistory: (_a = props.history) != null ? _a : []
21088
- });
21096
+ const { products } = yield ChatService.suggestBestProductMatches(
21097
+ props.options.sdkOptions,
21098
+ {
21099
+ initialQuery: props.entry.userInput,
21100
+ productStrings: productResultStrings,
21101
+ messageHistory: (_a = props.history) != null ? _a : []
21102
+ },
21103
+ props.options.chatSettings
21104
+ );
21089
21105
  bestMatches.value = products;
21090
21106
  emit2("loaded", products);
21091
21107
  } finally {
@@ -21158,7 +21174,8 @@ const _sfc_main$2$1 = /* @__PURE__ */ defineComponent({
21158
21174
  initialQuery: props.content,
21159
21175
  messageHistory: (_a = props.history) != null ? _a : []
21160
21176
  },
21161
- processChunk
21177
+ processChunk,
21178
+ props.options.chatSettings
21162
21179
  );
21163
21180
  });
21164
21181
  return (_ctx, _cache) => {
@@ -21255,7 +21272,8 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
21255
21272
  };
21256
21273
  const { phrases, success } = yield ChatService.suggestSearchChatPhrases(
21257
21274
  props.options.sdkOptions,
21258
- request
21275
+ request,
21276
+ props.options.chatSettings
21259
21277
  );
21260
21278
  if (!success || !phrases.length) {
21261
21279
  error.value = "Something went wrong";
@@ -20771,11 +20771,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20771
20771
  }
20772
20772
  return Env[environment] || Env["production"];
20773
20773
  };
20774
- const suggestSearchChatPhrases = (options, request) => __async(void 0, null, function* () {
20774
+ const suggestSearchChatPhrases = (options, request, chatSettings) => __async(void 0, null, function* () {
20775
20775
  var _a, _b, _c;
20776
20776
  const { environment, customBaseUrl } = options;
20777
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20777
20778
  try {
20778
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20779
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20779
20780
  body: JSON.stringify(request),
20780
20781
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20781
20782
  }));
@@ -20791,14 +20792,18 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20791
20792
  return { success: false, errors: [e] };
20792
20793
  }
20793
20794
  });
20794
- const suggestPhraseAlternatives = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20795
+ const suggestPhraseAlternatives = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20795
20796
  var _a, _b, _c;
20796
20797
  const { environment, customBaseUrl } = options;
20798
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20797
20799
  try {
20798
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20799
- body: JSON.stringify({ phrases }),
20800
- headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20801
- }));
20800
+ const res = yield fetch(
20801
+ `${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
20802
+ __spreadProps2(__spreadValues2({}, defaultConfig), {
20803
+ body: JSON.stringify({ phrases }),
20804
+ headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20805
+ })
20806
+ );
20802
20807
  if (res.status < 400) {
20803
20808
  const data = yield res.json();
20804
20809
  return __spreadProps2(__spreadValues2({}, data), { success: true });
@@ -20811,11 +20816,12 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20811
20816
  return { success: false, errors: [e] };
20812
20817
  }
20813
20818
  });
20814
- const suggestSimplifiedPhrases = (_0, _1) => __async(void 0, [_0, _1], function* (options, { phrases }) {
20819
+ const suggestSimplifiedPhrases = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, { phrases }, chatSettings) {
20815
20820
  var _a, _b, _c;
20816
20821
  const { environment, customBaseUrl } = options;
20822
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20817
20823
  try {
20818
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20824
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20819
20825
  body: JSON.stringify({ phrases }),
20820
20826
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20821
20827
  }));
@@ -20831,15 +20837,16 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20831
20837
  return { success: false, errors: [e] };
20832
20838
  }
20833
20839
  });
20834
- const suggestBestProductMatches = (_0, _1) => __async(void 0, [_0, _1], function* (options, {
20840
+ const suggestBestProductMatches = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, {
20835
20841
  initialQuery,
20836
20842
  productStrings,
20837
20843
  messageHistory
20838
- }) {
20844
+ }, chatSettings) {
20839
20845
  var _a, _b, _c;
20840
20846
  const { environment, customBaseUrl } = options;
20847
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20841
20848
  try {
20842
- const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20849
+ const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20843
20850
  body: JSON.stringify({ initialQuery, messageHistory, productStrings }),
20844
20851
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20845
20852
  }));
@@ -20876,9 +20883,10 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20876
20883
  }
20877
20884
  return history;
20878
20885
  };
20879
- const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived) => {
20886
+ const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, onChunkReceived, chatSettings) => {
20880
20887
  var _a;
20881
- fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20888
+ const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
20889
+ fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps2(__spreadValues2({}, defaultConfig), {
20882
20890
  body: JSON.stringify({ initialQuery, messageHistory }),
20883
20891
  headers: __spreadValues2(__spreadValues2({}, headers), (_a = options.customHeaders) != null ? _a : {})
20884
20892
  })).then((response) => {
@@ -21018,9 +21026,13 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21018
21026
  return result.items;
21019
21027
  });
21020
21028
  const getPhraseAlternatives = () => __async(this, null, function* () {
21021
- const { phrases } = yield ChatService.suggestPhraseAlternatives(props.options.sdkOptions, {
21022
- phrases: [props.phrase]
21023
- });
21029
+ const { phrases } = yield ChatService.suggestPhraseAlternatives(
21030
+ props.options.sdkOptions,
21031
+ {
21032
+ phrases: [props.phrase]
21033
+ },
21034
+ props.options.chatSettings
21035
+ );
21024
21036
  return phrases != null ? phrases : [];
21025
21037
  });
21026
21038
  return (_ctx, _cache) => {
@@ -21085,11 +21097,15 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21085
21097
  return (_b = (_a2 = result[titleKey.value]) == null ? void 0 : _a2.toString()) != null ? _b : "";
21086
21098
  }
21087
21099
  );
21088
- const { products } = yield ChatService.suggestBestProductMatches(props.options.sdkOptions, {
21089
- initialQuery: props.entry.userInput,
21090
- productStrings: productResultStrings,
21091
- messageHistory: (_a = props.history) != null ? _a : []
21092
- });
21100
+ const { products } = yield ChatService.suggestBestProductMatches(
21101
+ props.options.sdkOptions,
21102
+ {
21103
+ initialQuery: props.entry.userInput,
21104
+ productStrings: productResultStrings,
21105
+ messageHistory: (_a = props.history) != null ? _a : []
21106
+ },
21107
+ props.options.chatSettings
21108
+ );
21093
21109
  bestMatches.value = products;
21094
21110
  emit2("loaded", products);
21095
21111
  } finally {
@@ -21162,7 +21178,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21162
21178
  initialQuery: props.content,
21163
21179
  messageHistory: (_a = props.history) != null ? _a : []
21164
21180
  },
21165
- processChunk
21181
+ processChunk,
21182
+ props.options.chatSettings
21166
21183
  );
21167
21184
  });
21168
21185
  return (_ctx, _cache) => {
@@ -21259,7 +21276,8 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21259
21276
  };
21260
21277
  const { phrases, success } = yield ChatService.suggestSearchChatPhrases(
21261
21278
  props.options.sdkOptions,
21262
- request
21279
+ request,
21280
+ props.options.chatSettings
21263
21281
  );
21264
21282
  if (!success || !phrases.length) {
21265
21283
  error.value = "Something went wrong";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/client",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "main": "dist/lupaSearch.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/src/index.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@getlupa/client-sdk": "^1.3.4",
23
- "@getlupa/vue": "0.5.1",
23
+ "@getlupa/vue": "0.5.2",
24
24
  "@rushstack/eslint-patch": "^1.3.2",
25
25
  "@tsconfig/node18": "^2.0.1",
26
26
  "@types/jsdom": "^21.1.1",