@getlupa/vue 0.7.2 → 0.7.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.
package/dist/lupaSearch.js
CHANGED
|
@@ -16347,7 +16347,7 @@ const suggestSearchChatPhrases = (options, request, chatSettings) => __async(exp
|
|
|
16347
16347
|
return { success: false, errors: [e] };
|
|
16348
16348
|
}
|
|
16349
16349
|
});
|
|
16350
|
-
const suggestPhraseAlternatives = (
|
|
16350
|
+
const suggestPhraseAlternatives = (options, request, chatSettings) => __async(exports, null, function* () {
|
|
16351
16351
|
var _a, _b, _c;
|
|
16352
16352
|
const { environment, customBaseUrl } = options;
|
|
16353
16353
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
@@ -16355,7 +16355,7 @@ const suggestPhraseAlternatives = (_0, _1, _2) => __async(exports, [_0, _1, _2],
|
|
|
16355
16355
|
const res = yield fetch(
|
|
16356
16356
|
`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
|
|
16357
16357
|
__spreadProps(__spreadValues({}, defaultConfig), {
|
|
16358
|
-
body: JSON.stringify(
|
|
16358
|
+
body: JSON.stringify(request),
|
|
16359
16359
|
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16360
16360
|
})
|
|
16361
16361
|
);
|
|
@@ -16371,38 +16371,13 @@ const suggestPhraseAlternatives = (_0, _1, _2) => __async(exports, [_0, _1, _2],
|
|
|
16371
16371
|
return { success: false, errors: [e] };
|
|
16372
16372
|
}
|
|
16373
16373
|
});
|
|
16374
|
-
const
|
|
16375
|
-
var _a, _b, _c;
|
|
16376
|
-
const { environment, customBaseUrl } = options;
|
|
16377
|
-
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
16378
|
-
try {
|
|
16379
|
-
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify${model}`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16380
|
-
body: JSON.stringify({ phrases }),
|
|
16381
|
-
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16382
|
-
}));
|
|
16383
|
-
if (res.status < 400) {
|
|
16384
|
-
const data = yield res.json();
|
|
16385
|
-
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16386
|
-
}
|
|
16387
|
-
const errors = yield res.json();
|
|
16388
|
-
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
16389
|
-
return { success: false, errors };
|
|
16390
|
-
} catch (e) {
|
|
16391
|
-
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
16392
|
-
return { success: false, errors: [e] };
|
|
16393
|
-
}
|
|
16394
|
-
});
|
|
16395
|
-
const suggestBestProductMatches = (_0, _1, _2) => __async(exports, [_0, _1, _2], function* (options, {
|
|
16396
|
-
initialQuery,
|
|
16397
|
-
productStrings,
|
|
16398
|
-
messageHistory
|
|
16399
|
-
}, chatSettings) {
|
|
16374
|
+
const suggestBestProductMatches = (options, request, chatSettings) => __async(exports, null, function* () {
|
|
16400
16375
|
var _a, _b, _c;
|
|
16401
16376
|
const { environment, customBaseUrl } = options;
|
|
16402
16377
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
16403
16378
|
try {
|
|
16404
16379
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16405
|
-
body: JSON.stringify(
|
|
16380
|
+
body: JSON.stringify(request),
|
|
16406
16381
|
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16407
16382
|
}));
|
|
16408
16383
|
if (res.status < 400) {
|
|
@@ -16438,11 +16413,11 @@ const prepareChatHistory = (chatLog) => {
|
|
|
16438
16413
|
}
|
|
16439
16414
|
return history;
|
|
16440
16415
|
};
|
|
16441
|
-
const getTextResponseChunkStream = (options,
|
|
16416
|
+
const getTextResponseChunkStream = (options, request, onChunkReceived, chatSettings) => {
|
|
16442
16417
|
var _a;
|
|
16443
16418
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
16444
16419
|
fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16445
|
-
body: JSON.stringify(
|
|
16420
|
+
body: JSON.stringify(request),
|
|
16446
16421
|
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16447
16422
|
})).then((response) => {
|
|
16448
16423
|
const reader = response.body.getReader();
|
|
@@ -16462,7 +16437,6 @@ const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, o
|
|
|
16462
16437
|
const ChatService = {
|
|
16463
16438
|
suggestSearchChatPhrases,
|
|
16464
16439
|
suggestPhraseAlternatives,
|
|
16465
|
-
suggestSimplifiedPhrases,
|
|
16466
16440
|
suggestBestProductMatches,
|
|
16467
16441
|
prepareChatHistory,
|
|
16468
16442
|
getTextResponseChunkStream
|
|
@@ -16584,7 +16558,8 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
16584
16558
|
const { phrases } = yield ChatService.suggestPhraseAlternatives(
|
|
16585
16559
|
props.options.sdkOptions,
|
|
16586
16560
|
{
|
|
16587
|
-
phrases: [props.phrase]
|
|
16561
|
+
phrases: [props.phrase],
|
|
16562
|
+
queryKey: props.options.displayOptions.queryKey
|
|
16588
16563
|
},
|
|
16589
16564
|
props.options.chatSettings
|
|
16590
16565
|
);
|
|
@@ -16657,7 +16632,8 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
16657
16632
|
{
|
|
16658
16633
|
initialQuery: props.entry.userInput,
|
|
16659
16634
|
productStrings: productResultStrings,
|
|
16660
|
-
messageHistory: (_a = props.history) != null ? _a : []
|
|
16635
|
+
messageHistory: (_a = props.history) != null ? _a : [],
|
|
16636
|
+
queryKey: props.options.displayOptions.queryKey
|
|
16661
16637
|
},
|
|
16662
16638
|
props.options.chatSettings
|
|
16663
16639
|
);
|
|
@@ -16731,7 +16707,8 @@ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
|
16731
16707
|
props.options.sdkOptions,
|
|
16732
16708
|
{
|
|
16733
16709
|
initialQuery: props.content,
|
|
16734
|
-
messageHistory: (_a = props.history) != null ? _a : []
|
|
16710
|
+
messageHistory: (_a = props.history) != null ? _a : [],
|
|
16711
|
+
queryKey: props.options.displayOptions.queryKey
|
|
16735
16712
|
},
|
|
16736
16713
|
processChunk,
|
|
16737
16714
|
props.options.chatSettings
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -16345,7 +16345,7 @@ const suggestSearchChatPhrases = (options, request, chatSettings) => __async(voi
|
|
|
16345
16345
|
return { success: false, errors: [e] };
|
|
16346
16346
|
}
|
|
16347
16347
|
});
|
|
16348
|
-
const suggestPhraseAlternatives = (
|
|
16348
|
+
const suggestPhraseAlternatives = (options, request, chatSettings) => __async(void 0, null, function* () {
|
|
16349
16349
|
var _a, _b, _c;
|
|
16350
16350
|
const { environment, customBaseUrl } = options;
|
|
16351
16351
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
@@ -16353,7 +16353,7 @@ const suggestPhraseAlternatives = (_0, _1, _2) => __async(void 0, [_0, _1, _2],
|
|
|
16353
16353
|
const res = yield fetch(
|
|
16354
16354
|
`${getApiUrl(environment, customBaseUrl)}chat/phraseAlternatives${model}`,
|
|
16355
16355
|
__spreadProps(__spreadValues({}, defaultConfig), {
|
|
16356
|
-
body: JSON.stringify(
|
|
16356
|
+
body: JSON.stringify(request),
|
|
16357
16357
|
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16358
16358
|
})
|
|
16359
16359
|
);
|
|
@@ -16369,38 +16369,13 @@ const suggestPhraseAlternatives = (_0, _1, _2) => __async(void 0, [_0, _1, _2],
|
|
|
16369
16369
|
return { success: false, errors: [e] };
|
|
16370
16370
|
}
|
|
16371
16371
|
});
|
|
16372
|
-
const
|
|
16373
|
-
var _a, _b, _c;
|
|
16374
|
-
const { environment, customBaseUrl } = options;
|
|
16375
|
-
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
16376
|
-
try {
|
|
16377
|
-
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/simplify${model}`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16378
|
-
body: JSON.stringify({ phrases }),
|
|
16379
|
-
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16380
|
-
}));
|
|
16381
|
-
if (res.status < 400) {
|
|
16382
|
-
const data = yield res.json();
|
|
16383
|
-
return __spreadProps(__spreadValues({}, data), { success: true });
|
|
16384
|
-
}
|
|
16385
|
-
const errors = yield res.json();
|
|
16386
|
-
(_b = options == null ? void 0 : options.onError) == null ? void 0 : _b.call(options, errors);
|
|
16387
|
-
return { success: false, errors };
|
|
16388
|
-
} catch (e) {
|
|
16389
|
-
(_c = options == null ? void 0 : options.onError) == null ? void 0 : _c.call(options, e);
|
|
16390
|
-
return { success: false, errors: [e] };
|
|
16391
|
-
}
|
|
16392
|
-
});
|
|
16393
|
-
const suggestBestProductMatches = (_0, _1, _2) => __async(void 0, [_0, _1, _2], function* (options, {
|
|
16394
|
-
initialQuery,
|
|
16395
|
-
productStrings,
|
|
16396
|
-
messageHistory
|
|
16397
|
-
}, chatSettings) {
|
|
16372
|
+
const suggestBestProductMatches = (options, request, chatSettings) => __async(void 0, null, function* () {
|
|
16398
16373
|
var _a, _b, _c;
|
|
16399
16374
|
const { environment, customBaseUrl } = options;
|
|
16400
16375
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
16401
16376
|
try {
|
|
16402
16377
|
const res = yield fetch(`${getApiUrl(environment, customBaseUrl)}chat/bestProducts${model}`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16403
|
-
body: JSON.stringify(
|
|
16378
|
+
body: JSON.stringify(request),
|
|
16404
16379
|
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16405
16380
|
}));
|
|
16406
16381
|
if (res.status < 400) {
|
|
@@ -16436,11 +16411,11 @@ const prepareChatHistory = (chatLog) => {
|
|
|
16436
16411
|
}
|
|
16437
16412
|
return history;
|
|
16438
16413
|
};
|
|
16439
|
-
const getTextResponseChunkStream = (options,
|
|
16414
|
+
const getTextResponseChunkStream = (options, request, onChunkReceived, chatSettings) => {
|
|
16440
16415
|
var _a;
|
|
16441
16416
|
const model = (chatSettings == null ? void 0 : chatSettings.model) ? `?model=${chatSettings.model}` : ``;
|
|
16442
16417
|
fetch(`${getApiUrl(options.environment, options.customBaseUrl)}chat/text${model}`, __spreadProps(__spreadValues({}, defaultConfig), {
|
|
16443
|
-
body: JSON.stringify(
|
|
16418
|
+
body: JSON.stringify(request),
|
|
16444
16419
|
headers: __spreadValues(__spreadValues({}, headers), (_a = options.customHeaders) != null ? _a : {})
|
|
16445
16420
|
})).then((response) => {
|
|
16446
16421
|
const reader = response.body.getReader();
|
|
@@ -16460,7 +16435,6 @@ const getTextResponseChunkStream = (options, { initialQuery, messageHistory }, o
|
|
|
16460
16435
|
const ChatService = {
|
|
16461
16436
|
suggestSearchChatPhrases,
|
|
16462
16437
|
suggestPhraseAlternatives,
|
|
16463
|
-
suggestSimplifiedPhrases,
|
|
16464
16438
|
suggestBestProductMatches,
|
|
16465
16439
|
prepareChatHistory,
|
|
16466
16440
|
getTextResponseChunkStream
|
|
@@ -16582,7 +16556,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
16582
16556
|
const { phrases } = yield ChatService.suggestPhraseAlternatives(
|
|
16583
16557
|
props.options.sdkOptions,
|
|
16584
16558
|
{
|
|
16585
|
-
phrases: [props.phrase]
|
|
16559
|
+
phrases: [props.phrase],
|
|
16560
|
+
queryKey: props.options.displayOptions.queryKey
|
|
16586
16561
|
},
|
|
16587
16562
|
props.options.chatSettings
|
|
16588
16563
|
);
|
|
@@ -16655,7 +16630,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
16655
16630
|
{
|
|
16656
16631
|
initialQuery: props.entry.userInput,
|
|
16657
16632
|
productStrings: productResultStrings,
|
|
16658
|
-
messageHistory: (_a = props.history) != null ? _a : []
|
|
16633
|
+
messageHistory: (_a = props.history) != null ? _a : [],
|
|
16634
|
+
queryKey: props.options.displayOptions.queryKey
|
|
16659
16635
|
},
|
|
16660
16636
|
props.options.chatSettings
|
|
16661
16637
|
);
|
|
@@ -16729,7 +16705,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
16729
16705
|
props.options.sdkOptions,
|
|
16730
16706
|
{
|
|
16731
16707
|
initialQuery: props.content,
|
|
16732
|
-
messageHistory: (_a = props.history) != null ? _a : []
|
|
16708
|
+
messageHistory: (_a = props.history) != null ? _a : [],
|
|
16709
|
+
queryKey: props.options.displayOptions.queryKey
|
|
16733
16710
|
},
|
|
16734
16711
|
processChunk,
|
|
16735
16712
|
props.options.chatSettings
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SdkOptions } from '..';
|
|
2
|
-
import { ChatMessage, SearchChatRequest } from '../types/chat/SearchChatRequest';
|
|
2
|
+
import { ChatMessage, SearchChatBestProductMatchesRequest, SearchChatPraseAlternativesRequest, SearchChatRequest, SearchChatTextRequest } from '../types/chat/SearchChatRequest';
|
|
3
3
|
import { SearchChatResponse } from '../types/chat/SearchChatResponse';
|
|
4
4
|
import { ChatContent } from '../types/chat/ChatLog';
|
|
5
5
|
import { ChatSettings } from '../types/chat/ChatOptions';
|
|
@@ -8,31 +8,16 @@ declare const _default: {
|
|
|
8
8
|
success: boolean;
|
|
9
9
|
errors: any;
|
|
10
10
|
}>;
|
|
11
|
-
suggestPhraseAlternatives: (options: SdkOptions,
|
|
12
|
-
phrases: string[];
|
|
13
|
-
}, chatSettings?: ChatSettings) => Promise<Partial<SearchChatResponse> & {
|
|
11
|
+
suggestPhraseAlternatives: (options: SdkOptions, request: SearchChatPraseAlternativesRequest, chatSettings?: ChatSettings) => Promise<Partial<SearchChatResponse> & {
|
|
14
12
|
success: boolean;
|
|
15
13
|
errors: any;
|
|
16
14
|
}>;
|
|
17
|
-
|
|
18
|
-
phrases: string[];
|
|
19
|
-
}, chatSettings?: ChatSettings) => Promise<Partial<SearchChatResponse> & {
|
|
20
|
-
success: boolean;
|
|
21
|
-
errors: any;
|
|
22
|
-
}>;
|
|
23
|
-
suggestBestProductMatches: (options: SdkOptions, { initialQuery, productStrings, messageHistory }: {
|
|
24
|
-
initialQuery: string;
|
|
25
|
-
productStrings: string[];
|
|
26
|
-
messageHistory: ChatMessage[];
|
|
27
|
-
}, chatSettings?: ChatSettings) => Promise<{
|
|
15
|
+
suggestBestProductMatches: (options: SdkOptions, request: SearchChatBestProductMatchesRequest, chatSettings?: ChatSettings) => Promise<{
|
|
28
16
|
products?: string[];
|
|
29
17
|
success: boolean;
|
|
30
18
|
errors: any;
|
|
31
19
|
}>;
|
|
32
20
|
prepareChatHistory: (chatLog: ChatContent[]) => ChatMessage[];
|
|
33
|
-
getTextResponseChunkStream: (options: SdkOptions,
|
|
34
|
-
initialQuery: string;
|
|
35
|
-
messageHistory: ChatMessage[];
|
|
36
|
-
}, onChunkReceived: (chunk: string) => void, chatSettings?: ChatSettings) => void;
|
|
21
|
+
getTextResponseChunkStream: (options: SdkOptions, request: SearchChatTextRequest, onChunkReceived: (chunk: string) => void, chatSettings?: ChatSettings) => void;
|
|
37
22
|
};
|
|
38
23
|
export default _default;
|
|
@@ -2,8 +2,22 @@ export type ChatMessage = {
|
|
|
2
2
|
role: 'user' | 'assistant';
|
|
3
3
|
content: string;
|
|
4
4
|
};
|
|
5
|
-
export type
|
|
5
|
+
export type SearchChatRequestBase = {
|
|
6
|
+
queryKey: string;
|
|
7
|
+
};
|
|
8
|
+
export type SearchChatRequest = SearchChatRequestBase & {
|
|
6
9
|
userPrompt: string;
|
|
7
10
|
messageHistory: ChatMessage[];
|
|
8
|
-
|
|
11
|
+
};
|
|
12
|
+
export type SearchChatPraseAlternativesRequest = SearchChatRequestBase & {
|
|
13
|
+
phrases: string[];
|
|
14
|
+
};
|
|
15
|
+
export type SearchChatBestProductMatchesRequest = SearchChatRequestBase & {
|
|
16
|
+
initialQuery: string;
|
|
17
|
+
productStrings: string[];
|
|
18
|
+
messageHistory: ChatMessage[];
|
|
19
|
+
};
|
|
20
|
+
export type SearchChatTextRequest = SearchChatRequestBase & {
|
|
21
|
+
initialQuery: string;
|
|
22
|
+
messageHistory: ChatMessage[];
|
|
9
23
|
};
|