@websolutespa/bom-llm 0.2.4 → 0.2.6
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 +12 -0
- package/README.md +153 -153
- package/dist/esm/index.js +672 -570
- package/dist/esm/index.js.map +1 -1
- package/dist/index.css +69 -0
- package/dist/index.css.map +1 -1
- package/dist/umd/index.css +69 -0
- package/dist/umd/index.css.map +1 -1
- package/dist/umd/index.js +672 -570
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -13,36 +13,36 @@ function _mergeNamespaces(n, m) {
|
|
|
13
13
|
return Object.freeze(n);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Checks if the given item is a number.
|
|
18
|
-
* @param item The item to check.
|
|
19
|
-
* @returns True if the item is a number, false otherwise.
|
|
16
|
+
/**
|
|
17
|
+
* Checks if the given item is a number.
|
|
18
|
+
* @param item The item to check.
|
|
19
|
+
* @returns True if the item is a number, false otherwise.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Checks if the given item is an array.
|
|
24
|
-
* @param item The item to check.
|
|
25
|
-
* @returns True if the item is an array, false otherwise.
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the given item is an array.
|
|
24
|
+
* @param item The item to check.
|
|
25
|
+
* @returns True if the item is an array, false otherwise.
|
|
26
26
|
*/
|
|
27
27
|
function isArray(item) {
|
|
28
28
|
return Array.isArray(item);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* Checks if the given item is an object.
|
|
33
|
-
* @param item The item to check.
|
|
34
|
-
* @returns True if the item is an object, false otherwise.
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the given item is an object.
|
|
33
|
+
* @param item The item to check.
|
|
34
|
+
* @returns True if the item is an object, false otherwise.
|
|
35
35
|
*/
|
|
36
36
|
function isObject$3(item) {
|
|
37
37
|
return item != null && typeof item === 'object' && !isArray(item);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/**
|
|
41
|
-
* PascalCase
|
|
42
|
-
* camelCase
|
|
43
|
-
* kebab-case
|
|
44
|
-
* snake_case
|
|
45
|
-
* char*case
|
|
40
|
+
/**
|
|
41
|
+
* PascalCase
|
|
42
|
+
* camelCase
|
|
43
|
+
* kebab-case
|
|
44
|
+
* snake_case
|
|
45
|
+
* char*case
|
|
46
46
|
**/
|
|
47
47
|
|
|
48
48
|
function unknownCaseToPascalCase(unknownCase) {
|
|
@@ -79,20 +79,20 @@ function toKebabCase(unknownCase) {
|
|
|
79
79
|
return kebabCase;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
/**
|
|
83
|
-
* Represents a primitive value that can be used in the deep merge operation.
|
|
82
|
+
/**
|
|
83
|
+
* Represents a primitive value that can be used in the deep merge operation.
|
|
84
84
|
*/
|
|
85
85
|
|
|
86
|
-
/**
|
|
87
|
-
* Represents a dynamic value that can be used in the deep merge operation.
|
|
86
|
+
/**
|
|
87
|
+
* Represents a dynamic value that can be used in the deep merge operation.
|
|
88
88
|
*/
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* Deeply merges two objects or arrays.
|
|
92
|
-
*
|
|
93
|
-
* @param target - The target object or array to merge into.
|
|
94
|
-
* @param source - The source object or array to merge from.
|
|
95
|
-
* @returns The merged object or array.
|
|
90
|
+
/**
|
|
91
|
+
* Deeply merges two objects or arrays.
|
|
92
|
+
*
|
|
93
|
+
* @param target - The target object or array to merge into.
|
|
94
|
+
* @param source - The source object or array to merge from.
|
|
95
|
+
* @returns The merged object or array.
|
|
96
96
|
*/
|
|
97
97
|
function deepMerge(target, source) {
|
|
98
98
|
const output = {
|
|
@@ -116,19 +116,19 @@ function deepMerge(target, source) {
|
|
|
116
116
|
|
|
117
117
|
const isBrowser$1 = typeof window !== 'undefined';
|
|
118
118
|
|
|
119
|
-
/**
|
|
120
|
-
* Checks if the given value is an instance of IClassNameCollection.
|
|
121
|
-
* @param value - The value to check.
|
|
122
|
-
* @returns True if the value is an instance of IClassNameCollection, false otherwise.
|
|
119
|
+
/**
|
|
120
|
+
* Checks if the given value is an instance of IClassNameCollection.
|
|
121
|
+
* @param value - The value to check.
|
|
122
|
+
* @returns True if the value is an instance of IClassNameCollection, false otherwise.
|
|
123
123
|
*/
|
|
124
124
|
function isClassNameCollection(value) {
|
|
125
125
|
return typeof value === 'object' && !Array.isArray(value);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
/**
|
|
129
|
-
* Converts an IClassNameCollection object to a string of class names.
|
|
130
|
-
* @param className - The IClassNameCollection object.
|
|
131
|
-
* @returns A string of class names.
|
|
128
|
+
/**
|
|
129
|
+
* Converts an IClassNameCollection object to a string of class names.
|
|
130
|
+
* @param className - The IClassNameCollection object.
|
|
131
|
+
* @returns A string of class names.
|
|
132
132
|
*/
|
|
133
133
|
function classNameCollectionToString(className) {
|
|
134
134
|
const keys = Object.keys(className);
|
|
@@ -145,10 +145,10 @@ function classNameCollectionToString(className) {
|
|
|
145
145
|
return classNames;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
/**
|
|
149
|
-
* Combines multiple IClassName objects into a single string of class names.
|
|
150
|
-
* @param props - The IClassName objects to combine.
|
|
151
|
-
* @returns A string of class names.
|
|
148
|
+
/**
|
|
149
|
+
* Combines multiple IClassName objects into a single string of class names.
|
|
150
|
+
* @param props - The IClassName objects to combine.
|
|
151
|
+
* @returns A string of class names.
|
|
152
152
|
*/
|
|
153
153
|
function getClassNames() {
|
|
154
154
|
const total = arguments.length;
|
|
@@ -176,11 +176,11 @@ function getDefaultExportFromCjs (x) {
|
|
|
176
176
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
/**
|
|
180
|
-
* Retrieves the default locale.
|
|
181
|
-
* If the process environment variable DEFAULT_LOCALE is defined, it will be used as the default locale.
|
|
182
|
-
* Otherwise, the default locale will be set to 'en'.
|
|
183
|
-
* @returns The default locale.
|
|
179
|
+
/**
|
|
180
|
+
* Retrieves the default locale.
|
|
181
|
+
* If the process environment variable DEFAULT_LOCALE is defined, it will be used as the default locale.
|
|
182
|
+
* Otherwise, the default locale will be set to 'en'.
|
|
183
|
+
* @returns The default locale.
|
|
184
184
|
*/
|
|
185
185
|
function getDefaultLocale() {
|
|
186
186
|
let defaultLocale = 'en';
|
|
@@ -193,10 +193,10 @@ const defaultLocale = getDefaultLocale();
|
|
|
193
193
|
|
|
194
194
|
const DEFAULT_LOCALE = defaultLocale;
|
|
195
195
|
|
|
196
|
-
/**
|
|
197
|
-
* Checks if a value is a localized string.
|
|
198
|
-
* @param value - The value to check.
|
|
199
|
-
* @returns A boolean indicating whether the value is a localized string.
|
|
196
|
+
/**
|
|
197
|
+
* Checks if a value is a localized string.
|
|
198
|
+
* @param value - The value to check.
|
|
199
|
+
* @returns A boolean indicating whether the value is a localized string.
|
|
200
200
|
*/
|
|
201
201
|
function isLocalizedString(value) {
|
|
202
202
|
let isLocalizedString = false;
|
|
@@ -209,12 +209,12 @@ function isLocalizedString(value) {
|
|
|
209
209
|
return isLocalizedString;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
/**
|
|
213
|
-
* Converts a localized string object to a string based on the specified locale.
|
|
214
|
-
* @param json - The localized string object.
|
|
215
|
-
* @param locale - The locale to use.
|
|
216
|
-
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
217
|
-
* @returns The localized string.
|
|
212
|
+
/**
|
|
213
|
+
* Converts a localized string object to a string based on the specified locale.
|
|
214
|
+
* @param json - The localized string object.
|
|
215
|
+
* @param locale - The locale to use.
|
|
216
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
217
|
+
* @returns The localized string.
|
|
218
218
|
*/
|
|
219
219
|
function localizedToString(json, locale, defaultLocale) {
|
|
220
220
|
if (defaultLocale === void 0) {
|
|
@@ -224,12 +224,12 @@ function localizedToString(json, locale, defaultLocale) {
|
|
|
224
224
|
return localizedString;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
/**
|
|
228
|
-
* Localizes a value or an array/object of values based on the specified locale.
|
|
229
|
-
* @param value - The value or array/object of values to localize.
|
|
230
|
-
* @param locale - The locale to use.
|
|
231
|
-
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
232
|
-
* @returns The localized value or array/object of localized values.
|
|
227
|
+
/**
|
|
228
|
+
* Localizes a value or an array/object of values based on the specified locale.
|
|
229
|
+
* @param value - The value or array/object of values to localize.
|
|
230
|
+
* @param locale - The locale to use.
|
|
231
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
232
|
+
* @returns The localized value or array/object of localized values.
|
|
233
233
|
*/
|
|
234
234
|
function localizeValue(value, locale, defaultLocale) {
|
|
235
235
|
if (defaultLocale === void 0) {
|
|
@@ -244,12 +244,12 @@ function localizeValue(value, locale, defaultLocale) {
|
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
/**
|
|
248
|
-
* Localizes an array/object of values based on the specified locale.
|
|
249
|
-
* @param item - The array/object of values to localize.
|
|
250
|
-
* @param locale - The locale to use.
|
|
251
|
-
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
252
|
-
* @returns The localized array/object of values.
|
|
247
|
+
/**
|
|
248
|
+
* Localizes an array/object of values based on the specified locale.
|
|
249
|
+
* @param item - The array/object of values to localize.
|
|
250
|
+
* @param locale - The locale to use.
|
|
251
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
252
|
+
* @returns The localized array/object of values.
|
|
253
253
|
*/
|
|
254
254
|
function localizeItem(item, locale, defaultLocale) {
|
|
255
255
|
if (defaultLocale === void 0) {
|
|
@@ -8786,41 +8786,41 @@ function useCurrency(currency, locale) {
|
|
|
8786
8786
|
}, locale);
|
|
8787
8787
|
}
|
|
8788
8788
|
|
|
8789
|
-
/*
|
|
8790
|
-
import { useMemo } from 'react';
|
|
8791
|
-
import { useNumber } from '../useNumber/useNumber';
|
|
8792
|
-
import { useLayout } from '../useLayout/useLayout';
|
|
8793
|
-
|
|
8794
|
-
export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
|
|
8795
|
-
const layout = useLayout();
|
|
8796
|
-
const currentLocale = locale || layout.locale;
|
|
8797
|
-
|
|
8798
|
-
const formatter = useMemo(() => {
|
|
8799
|
-
const options = { style: 'currency', currency };
|
|
8800
|
-
const formatter = new Intl.NumberFormat(currentLocale, options).format;
|
|
8801
|
-
return formatter;
|
|
8802
|
-
}, [currency, currentLocale]);
|
|
8803
|
-
|
|
8804
|
-
return formatter;
|
|
8805
|
-
}
|
|
8806
|
-
|
|
8789
|
+
/*
|
|
8790
|
+
import { useMemo } from 'react';
|
|
8791
|
+
import { useNumber } from '../useNumber/useNumber';
|
|
8792
|
+
import { useLayout } from '../useLayout/useLayout';
|
|
8793
|
+
|
|
8794
|
+
export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
|
|
8795
|
+
const layout = useLayout();
|
|
8796
|
+
const currentLocale = locale || layout.locale;
|
|
8797
|
+
|
|
8798
|
+
const formatter = useMemo(() => {
|
|
8799
|
+
const options = { style: 'currency', currency };
|
|
8800
|
+
const formatter = new Intl.NumberFormat(currentLocale, options).format;
|
|
8801
|
+
return formatter;
|
|
8802
|
+
}, [currency, currentLocale]);
|
|
8803
|
+
|
|
8804
|
+
return formatter;
|
|
8805
|
+
}
|
|
8806
|
+
|
|
8807
8807
|
*/
|
|
8808
8808
|
|
|
8809
|
-
/*
|
|
8810
|
-
|
|
8811
|
-
export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
|
|
8812
|
-
|
|
8813
|
-
const layout = useLayout();
|
|
8814
|
-
|
|
8815
|
-
const currentLocale = locale || layout.locale;
|
|
8816
|
-
|
|
8817
|
-
return useMemo(() => {
|
|
8818
|
-
const options = { style: 'currency', currency };
|
|
8819
|
-
const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
|
|
8820
|
-
return formattedValue;
|
|
8821
|
-
}, [value, currency, currentLocale]);
|
|
8822
|
-
}
|
|
8823
|
-
|
|
8809
|
+
/*
|
|
8810
|
+
|
|
8811
|
+
export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
|
|
8812
|
+
|
|
8813
|
+
const layout = useLayout();
|
|
8814
|
+
|
|
8815
|
+
const currentLocale = locale || layout.locale;
|
|
8816
|
+
|
|
8817
|
+
return useMemo(() => {
|
|
8818
|
+
const options = { style: 'currency', currency };
|
|
8819
|
+
const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
|
|
8820
|
+
return formattedValue;
|
|
8821
|
+
}, [value, currency, currentLocale]);
|
|
8822
|
+
}
|
|
8823
|
+
|
|
8824
8824
|
*/
|
|
8825
8825
|
|
|
8826
8826
|
function useDateTimeFormat(options, locale) {
|
|
@@ -8895,13 +8895,13 @@ function useFocusTrap$1(ref, options) {
|
|
|
8895
8895
|
return [state, setState];
|
|
8896
8896
|
}
|
|
8897
8897
|
|
|
8898
|
-
/**
|
|
8899
|
-
* KeyBinding Codes
|
|
8900
|
-
* The content of this file is based on the design of the open source project "microsoft/vscode",
|
|
8901
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8902
|
-
*
|
|
8903
|
-
* We inherit the KeyMod values from "microsoft/vscode",
|
|
8904
|
-
* but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
|
|
8898
|
+
/**
|
|
8899
|
+
* KeyBinding Codes
|
|
8900
|
+
* The content of this file is based on the design of the open source project "microsoft/vscode",
|
|
8901
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8902
|
+
*
|
|
8903
|
+
* We inherit the KeyMod values from "microsoft/vscode",
|
|
8904
|
+
* but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
|
|
8905
8905
|
*/
|
|
8906
8906
|
|
|
8907
8907
|
let KeyCode = /*#__PURE__*/function (KeyCode) {
|
|
@@ -9135,20 +9135,20 @@ function parseParams(label, params) {
|
|
|
9135
9135
|
});
|
|
9136
9136
|
}
|
|
9137
9137
|
|
|
9138
|
-
/*
|
|
9139
|
-
import { useCallback, useEffect, useRef } from 'react';
|
|
9140
|
-
|
|
9141
|
-
export function useMounted(): () => boolean {
|
|
9142
|
-
const ref = useRef<boolean>(false);
|
|
9143
|
-
const get = useCallback(() => ref.current, []);
|
|
9144
|
-
useEffect(() => {
|
|
9145
|
-
ref.current = true;
|
|
9146
|
-
return () => {
|
|
9147
|
-
ref.current = false;
|
|
9148
|
-
};
|
|
9149
|
-
}, []);
|
|
9150
|
-
return get;
|
|
9151
|
-
}
|
|
9138
|
+
/*
|
|
9139
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
9140
|
+
|
|
9141
|
+
export function useMounted(): () => boolean {
|
|
9142
|
+
const ref = useRef<boolean>(false);
|
|
9143
|
+
const get = useCallback(() => ref.current, []);
|
|
9144
|
+
useEffect(() => {
|
|
9145
|
+
ref.current = true;
|
|
9146
|
+
return () => {
|
|
9147
|
+
ref.current = false;
|
|
9148
|
+
};
|
|
9149
|
+
}, []);
|
|
9150
|
+
return get;
|
|
9151
|
+
}
|
|
9152
9152
|
*/
|
|
9153
9153
|
|
|
9154
9154
|
function useMounted() {
|
|
@@ -19863,6 +19863,27 @@ const IconX = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
19863
19863
|
});
|
|
19864
19864
|
IconX.displayName = 'IconX';
|
|
19865
19865
|
|
|
19866
|
+
function pushDataLayer(record) {
|
|
19867
|
+
if (isBrowser$1) {
|
|
19868
|
+
window.dataLayer?.push(record);
|
|
19869
|
+
}
|
|
19870
|
+
}
|
|
19871
|
+
|
|
19872
|
+
const LLM_MINIMIZED_KEY = 'llm-minimized';
|
|
19873
|
+
function getPersistedMinimized() {
|
|
19874
|
+
try {
|
|
19875
|
+
return sessionStorage.getItem(LLM_MINIMIZED_KEY) === 'true';
|
|
19876
|
+
} catch {
|
|
19877
|
+
return false;
|
|
19878
|
+
}
|
|
19879
|
+
}
|
|
19880
|
+
function persistMinimized(minimized) {
|
|
19881
|
+
try {
|
|
19882
|
+
sessionStorage.setItem(LLM_MINIMIZED_KEY, String(minimized));
|
|
19883
|
+
} catch {
|
|
19884
|
+
// error
|
|
19885
|
+
}
|
|
19886
|
+
}
|
|
19866
19887
|
const createLlmViewStore = _ref => {
|
|
19867
19888
|
let {
|
|
19868
19889
|
threadId,
|
|
@@ -19893,6 +19914,7 @@ const createLlmViewStore = _ref => {
|
|
|
19893
19914
|
fixed: false,
|
|
19894
19915
|
idle: true,
|
|
19895
19916
|
visible: false,
|
|
19917
|
+
minimized: getPersistedMinimized(),
|
|
19896
19918
|
scrollable: false,
|
|
19897
19919
|
direction: 0
|
|
19898
19920
|
};
|
|
@@ -19968,13 +19990,13 @@ const createLlmViewStore = _ref => {
|
|
|
19968
19990
|
lastScrollTop = 0;
|
|
19969
19991
|
}
|
|
19970
19992
|
};
|
|
19971
|
-
/*
|
|
19972
|
-
if ('ResizeObserver' in window) {
|
|
19973
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
19974
|
-
onScroll();
|
|
19975
|
-
});
|
|
19976
|
-
resizeObserver.observe(document.scrollingElement as HTMLElement);
|
|
19977
|
-
}
|
|
19993
|
+
/*
|
|
19994
|
+
if ('ResizeObserver' in window) {
|
|
19995
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
19996
|
+
onScroll();
|
|
19997
|
+
});
|
|
19998
|
+
resizeObserver.observe(document.scrollingElement as HTMLElement);
|
|
19999
|
+
}
|
|
19978
20000
|
*/
|
|
19979
20001
|
window.addEventListener('scroll', onScroll);
|
|
19980
20002
|
window.addEventListener('resize', onResize);
|
|
@@ -20018,9 +20040,11 @@ const createLlmViewStore = _ref => {
|
|
|
20018
20040
|
},
|
|
20019
20041
|
send: async (prompt, onMessage, onEnd) => {
|
|
20020
20042
|
await send(prompt, () => {
|
|
20043
|
+
persistMinimized(false);
|
|
20021
20044
|
set({
|
|
20022
20045
|
skipCustomIntro: true,
|
|
20023
|
-
opened: true
|
|
20046
|
+
opened: true,
|
|
20047
|
+
minimized: false
|
|
20024
20048
|
});
|
|
20025
20049
|
setTimeout(() => {
|
|
20026
20050
|
}, 50);
|
|
@@ -20036,9 +20060,17 @@ const createLlmViewStore = _ref => {
|
|
|
20036
20060
|
},
|
|
20037
20061
|
open: () => {
|
|
20038
20062
|
setIdleTimeout();
|
|
20039
|
-
set(state =>
|
|
20040
|
-
opened
|
|
20041
|
-
|
|
20063
|
+
set(state => {
|
|
20064
|
+
const opened = !state.opened;
|
|
20065
|
+
pushDataLayer({
|
|
20066
|
+
event: opened ? 'llm_open' : 'llm_close'
|
|
20067
|
+
});
|
|
20068
|
+
persistMinimized(false);
|
|
20069
|
+
return {
|
|
20070
|
+
opened,
|
|
20071
|
+
minimized: false
|
|
20072
|
+
};
|
|
20073
|
+
});
|
|
20042
20074
|
},
|
|
20043
20075
|
isOpened: () => {
|
|
20044
20076
|
const {
|
|
@@ -20048,9 +20080,14 @@ const createLlmViewStore = _ref => {
|
|
|
20048
20080
|
},
|
|
20049
20081
|
setOpened: opened => {
|
|
20050
20082
|
setIdleTimeout();
|
|
20051
|
-
set(state =>
|
|
20052
|
-
|
|
20053
|
-
|
|
20083
|
+
set(state => {
|
|
20084
|
+
pushDataLayer({
|
|
20085
|
+
event: opened ? 'llm_open' : 'llm_close'
|
|
20086
|
+
});
|
|
20087
|
+
return {
|
|
20088
|
+
opened
|
|
20089
|
+
};
|
|
20090
|
+
});
|
|
20054
20091
|
},
|
|
20055
20092
|
setIntroed: introed => {
|
|
20056
20093
|
const state = get();
|
|
@@ -20059,6 +20096,12 @@ const createLlmViewStore = _ref => {
|
|
|
20059
20096
|
introed
|
|
20060
20097
|
}));
|
|
20061
20098
|
},
|
|
20099
|
+
setMinimized: minimized => {
|
|
20100
|
+
persistMinimized(minimized);
|
|
20101
|
+
set(state => ({
|
|
20102
|
+
minimized
|
|
20103
|
+
}));
|
|
20104
|
+
},
|
|
20062
20105
|
setVisible: visible => set(state => ({
|
|
20063
20106
|
visible
|
|
20064
20107
|
})),
|
|
@@ -23303,11 +23346,11 @@ const Text = props => {
|
|
|
23303
23346
|
<img src="${href}"${title ? ` title="${title}"` : ''} alt="" />
|
|
23304
23347
|
</a>`;
|
|
23305
23348
|
}
|
|
23306
|
-
/*
|
|
23307
|
-
html(html: string, block?: boolean) {
|
|
23308
|
-
console.log('html', html);
|
|
23309
|
-
return html;
|
|
23310
|
-
},
|
|
23349
|
+
/*
|
|
23350
|
+
html(html: string, block?: boolean) {
|
|
23351
|
+
console.log('html', html);
|
|
23352
|
+
return html;
|
|
23353
|
+
},
|
|
23311
23354
|
*/
|
|
23312
23355
|
}
|
|
23313
23356
|
});
|
|
@@ -31923,12 +31966,12 @@ function sanitizeBlockType(type) {
|
|
|
31923
31966
|
return type.replace(/Item$/, '');
|
|
31924
31967
|
}
|
|
31925
31968
|
|
|
31926
|
-
/*
|
|
31927
|
-
export type LlmChunkImage = {
|
|
31928
|
-
type: 'image';
|
|
31929
|
-
id: string;
|
|
31930
|
-
src: string;
|
|
31931
|
-
};
|
|
31969
|
+
/*
|
|
31970
|
+
export type LlmChunkImage = {
|
|
31971
|
+
type: 'image';
|
|
31972
|
+
id: string;
|
|
31973
|
+
src: string;
|
|
31974
|
+
};
|
|
31932
31975
|
*/
|
|
31933
31976
|
|
|
31934
31977
|
// media
|
|
@@ -31951,11 +31994,11 @@ export type LlmChunkImage = {
|
|
|
31951
31994
|
|
|
31952
31995
|
// !!! todo move to bom-core
|
|
31953
31996
|
|
|
31954
|
-
/*
|
|
31955
|
-
export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
|
|
31956
|
-
type: LlmChunkUnknownItemType;
|
|
31957
|
-
id: IEquatable;
|
|
31958
|
-
};
|
|
31997
|
+
/*
|
|
31998
|
+
export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
|
|
31999
|
+
type: LlmChunkUnknownItemType;
|
|
32000
|
+
id: IEquatable;
|
|
32001
|
+
};
|
|
31959
32002
|
*/
|
|
31960
32003
|
|
|
31961
32004
|
// !!! todo
|
|
@@ -31964,55 +32007,55 @@ export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> &
|
|
|
31964
32007
|
// type StuctureMappedType<T extends LlmChunkType> = { [K in T]: Array<LlmChunkItem<K>> };
|
|
31965
32008
|
// export type LlmChunkItems<T extends LlmChunkType = LlmChunkType> = Record<T, (item: Extract<LlmChunkItem, { type: T }>) => string>;
|
|
31966
32009
|
|
|
31967
|
-
/*
|
|
31968
|
-
export type LlmThemeItem = Record<string, CSSProperties> & {
|
|
31969
|
-
[key: string]: string | boolean | number;
|
|
31970
|
-
};
|
|
31971
|
-
|
|
31972
|
-
export type LlmThemeTypography = Omit<CSSProperties, 'textTransform'> & {
|
|
31973
|
-
family?: CSSProperties['fontFamily'];
|
|
31974
|
-
size?: CSSProperties['fontSize'];
|
|
31975
|
-
weight?: CSSProperties['fontWeight'];
|
|
31976
|
-
fontSizeMin?: string;
|
|
31977
|
-
fontSizeMax?: string;
|
|
31978
|
-
textTransform?: string;
|
|
31979
|
-
};
|
|
31980
|
-
|
|
31981
|
-
export type LlmThemeColor = {
|
|
31982
|
-
[key: string]: CSSProperties['color'] | LlmThemeColor;
|
|
31983
|
-
};
|
|
31984
|
-
|
|
31985
|
-
export type LlmThemeProps = {
|
|
31986
|
-
mode?: string;
|
|
31987
|
-
scale?: number;
|
|
31988
|
-
font?: {
|
|
31989
|
-
primary: CSSProperties['fontFamily'];
|
|
31990
|
-
secondary: CSSProperties['fontFamily'];
|
|
31991
|
-
source: string;
|
|
31992
|
-
};
|
|
31993
|
-
typography?: Record<string, LlmThemeTypography>,
|
|
31994
|
-
color?: LlmThemeColor;
|
|
31995
|
-
canvas?: {
|
|
31996
|
-
opacity?: number;
|
|
31997
|
-
enabled?: boolean;
|
|
31998
|
-
};
|
|
31999
|
-
border?: CSSProperties['border'];
|
|
32000
|
-
toaster?: ToasterProps['theme'];
|
|
32001
|
-
};
|
|
32010
|
+
/*
|
|
32011
|
+
export type LlmThemeItem = Record<string, CSSProperties> & {
|
|
32012
|
+
[key: string]: string | boolean | number;
|
|
32013
|
+
};
|
|
32014
|
+
|
|
32015
|
+
export type LlmThemeTypography = Omit<CSSProperties, 'textTransform'> & {
|
|
32016
|
+
family?: CSSProperties['fontFamily'];
|
|
32017
|
+
size?: CSSProperties['fontSize'];
|
|
32018
|
+
weight?: CSSProperties['fontWeight'];
|
|
32019
|
+
fontSizeMin?: string;
|
|
32020
|
+
fontSizeMax?: string;
|
|
32021
|
+
textTransform?: string;
|
|
32022
|
+
};
|
|
32023
|
+
|
|
32024
|
+
export type LlmThemeColor = {
|
|
32025
|
+
[key: string]: CSSProperties['color'] | LlmThemeColor;
|
|
32026
|
+
};
|
|
32027
|
+
|
|
32028
|
+
export type LlmThemeProps = {
|
|
32029
|
+
mode?: string;
|
|
32030
|
+
scale?: number;
|
|
32031
|
+
font?: {
|
|
32032
|
+
primary: CSSProperties['fontFamily'];
|
|
32033
|
+
secondary: CSSProperties['fontFamily'];
|
|
32034
|
+
source: string;
|
|
32035
|
+
};
|
|
32036
|
+
typography?: Record<string, LlmThemeTypography>,
|
|
32037
|
+
color?: LlmThemeColor;
|
|
32038
|
+
canvas?: {
|
|
32039
|
+
opacity?: number;
|
|
32040
|
+
enabled?: boolean;
|
|
32041
|
+
};
|
|
32042
|
+
border?: CSSProperties['border'];
|
|
32043
|
+
toaster?: ToasterProps['theme'];
|
|
32044
|
+
};
|
|
32002
32045
|
*/
|
|
32003
32046
|
|
|
32004
|
-
/*
|
|
32005
|
-
export type LlmTheme = Omit<{
|
|
32006
|
-
[key: string]: LlmThemeItem | CSSProperties;
|
|
32007
|
-
}, keyof LlmThemeProps> & LlmThemeProps;
|
|
32047
|
+
/*
|
|
32048
|
+
export type LlmTheme = Omit<{
|
|
32049
|
+
[key: string]: LlmThemeItem | CSSProperties;
|
|
32050
|
+
}, keyof LlmThemeProps> & LlmThemeProps;
|
|
32008
32051
|
*/
|
|
32009
32052
|
|
|
32010
|
-
/*
|
|
32011
|
-
export type LlmThemeBase = {
|
|
32012
|
-
[key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
|
|
32013
|
-
};
|
|
32014
|
-
|
|
32015
|
-
export type LlmTheme = LlmThemeBase & LlmThemeProps;
|
|
32053
|
+
/*
|
|
32054
|
+
export type LlmThemeBase = {
|
|
32055
|
+
[key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
|
|
32056
|
+
};
|
|
32057
|
+
|
|
32058
|
+
export type LlmTheme = LlmThemeBase & LlmThemeProps;
|
|
32016
32059
|
*/
|
|
32017
32060
|
|
|
32018
32061
|
const LLM_DEFAULT_MIME_TYPES = '.jpg, .jpeg, .png, .svg, .webp, .txt, .md, .pdf, .csv, .doc, .xls, .ppt';
|
|
@@ -32247,14 +32290,14 @@ const Feedback = _ref => {
|
|
|
32247
32290
|
const feedbackType = type || theme.feedback?.type || 'stars';
|
|
32248
32291
|
const classNames = getClassNames('llm__feedback', `llm__feedback--${feedbackType}`);
|
|
32249
32292
|
|
|
32250
|
-
/*
|
|
32251
|
-
const [feedbackRating, setFeedbackRating] = useState<number>();
|
|
32252
|
-
const onRating = async (event: ChangeEvent<HTMLInputElement>) => {
|
|
32253
|
-
console.log(event.currentTarget);
|
|
32254
|
-
const value = String(event.currentTarget.value);
|
|
32255
|
-
const rating = parseInt(value);
|
|
32256
|
-
setFeedbackRating(rating);
|
|
32257
|
-
};
|
|
32293
|
+
/*
|
|
32294
|
+
const [feedbackRating, setFeedbackRating] = useState<number>();
|
|
32295
|
+
const onRating = async (event: ChangeEvent<HTMLInputElement>) => {
|
|
32296
|
+
console.log(event.currentTarget);
|
|
32297
|
+
const value = String(event.currentTarget.value);
|
|
32298
|
+
const rating = parseInt(value);
|
|
32299
|
+
setFeedbackRating(rating);
|
|
32300
|
+
};
|
|
32258
32301
|
*/
|
|
32259
32302
|
|
|
32260
32303
|
const onSubmit = async event => {
|
|
@@ -32391,8 +32434,8 @@ const Feedback = _ref => {
|
|
|
32391
32434
|
});
|
|
32392
32435
|
};
|
|
32393
32436
|
|
|
32394
|
-
/*
|
|
32395
|
-
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
32437
|
+
/*
|
|
32438
|
+
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
32396
32439
|
*/
|
|
32397
32440
|
const Font = () => {
|
|
32398
32441
|
const theme = useLlm(state => state.theme);
|
|
@@ -32862,6 +32905,10 @@ const PageActions = _ref => {
|
|
|
32862
32905
|
wrapper
|
|
32863
32906
|
} = _ref;
|
|
32864
32907
|
const label = useLabel();
|
|
32908
|
+
const streaming = useLlm(state => state.streaming);
|
|
32909
|
+
const {
|
|
32910
|
+
clear
|
|
32911
|
+
} = useLlm(state => state.actions);
|
|
32865
32912
|
const {
|
|
32866
32913
|
send
|
|
32867
32914
|
} = useLlmView(state => state.actions);
|
|
@@ -32869,7 +32916,8 @@ const PageActions = _ref => {
|
|
|
32869
32916
|
setWrapper
|
|
32870
32917
|
} = useActions();
|
|
32871
32918
|
const onAction = async action => {
|
|
32872
|
-
const prompt = action.message ||
|
|
32919
|
+
const prompt = action.message || action.label;
|
|
32920
|
+
clear();
|
|
32873
32921
|
await send(prompt, response => {
|
|
32874
32922
|
// console.log('PageActions.onChunk', response.chunks);
|
|
32875
32923
|
}, response => {
|
|
@@ -32887,7 +32935,11 @@ const PageActions = _ref => {
|
|
|
32887
32935
|
}), wrapper.actions.map(x => /*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
32888
32936
|
type: "button",
|
|
32889
32937
|
className: getClassNames(style$h.action),
|
|
32890
|
-
|
|
32938
|
+
disabled: streaming,
|
|
32939
|
+
onClick: e => {
|
|
32940
|
+
e.stopPropagation();
|
|
32941
|
+
onAction(x);
|
|
32942
|
+
},
|
|
32891
32943
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(ActionIcon, {
|
|
32892
32944
|
action: x
|
|
32893
32945
|
}), /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
@@ -40802,6 +40854,9 @@ const PageHistory = _ref => {
|
|
|
40802
40854
|
removeHistory
|
|
40803
40855
|
} = useLlm(state => state.actions);
|
|
40804
40856
|
// console.log('item', item);
|
|
40857
|
+
if (!item.user) {
|
|
40858
|
+
return;
|
|
40859
|
+
}
|
|
40805
40860
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
40806
40861
|
className: getClassNames(style$e.history),
|
|
40807
40862
|
onClick: () => setHistory(item),
|
|
@@ -41319,7 +41374,11 @@ styleInject(css_248z$5);
|
|
|
41319
41374
|
const PageSubmit = () => {
|
|
41320
41375
|
const label = useLabel();
|
|
41321
41376
|
useLlm(state => state.components);
|
|
41377
|
+
const streaming = useLlm(state => state.streaming);
|
|
41322
41378
|
const prompt = useLlm(state => state.prompt);
|
|
41379
|
+
const {
|
|
41380
|
+
clear
|
|
41381
|
+
} = useLlm(state => state.actions);
|
|
41323
41382
|
const {
|
|
41324
41383
|
send
|
|
41325
41384
|
} = useLlmView(state => state.actions);
|
|
@@ -41328,6 +41387,7 @@ const PageSubmit = () => {
|
|
|
41328
41387
|
if (!prompt) {
|
|
41329
41388
|
return;
|
|
41330
41389
|
}
|
|
41390
|
+
clear();
|
|
41331
41391
|
await send(prompt, response => {
|
|
41332
41392
|
// console.log('PagePrompt.onChunk', response.chunks);
|
|
41333
41393
|
}, response => {
|
|
@@ -41337,7 +41397,7 @@ const PageSubmit = () => {
|
|
|
41337
41397
|
return /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
41338
41398
|
type: "submit",
|
|
41339
41399
|
className: getClassNames(style$5.submit),
|
|
41340
|
-
|
|
41400
|
+
disabled: !prompt || streaming,
|
|
41341
41401
|
"aria-label": label('llm.sendPrompt'),
|
|
41342
41402
|
onClick: onSubmit,
|
|
41343
41403
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconLlmArrowUp, {})
|
|
@@ -41382,7 +41442,8 @@ const PageTextarea = () => {
|
|
|
41382
41442
|
const prompt = useLlm(state => state.prompt);
|
|
41383
41443
|
const streaming = useLlm(state => state.streaming);
|
|
41384
41444
|
const {
|
|
41385
|
-
setPrompt
|
|
41445
|
+
setPrompt,
|
|
41446
|
+
clear
|
|
41386
41447
|
} = useLlm(state => state.actions);
|
|
41387
41448
|
const {
|
|
41388
41449
|
send
|
|
@@ -41393,6 +41454,7 @@ const PageTextarea = () => {
|
|
|
41393
41454
|
if (!prompt) {
|
|
41394
41455
|
return;
|
|
41395
41456
|
}
|
|
41457
|
+
clear();
|
|
41396
41458
|
await send(prompt, response => {
|
|
41397
41459
|
// console.log('PagePrompt.onChunk', response.chunks);
|
|
41398
41460
|
}, response => {
|
|
@@ -41404,7 +41466,7 @@ const PageTextarea = () => {
|
|
|
41404
41466
|
setPrompt(prompt);
|
|
41405
41467
|
};
|
|
41406
41468
|
const onKeyDown = event => {
|
|
41407
|
-
if (event.code == 'Enter' && !event.shiftKey) {
|
|
41469
|
+
if (event.code == 'Enter' && !event.shiftKey && !streaming) {
|
|
41408
41470
|
onSubmit(event);
|
|
41409
41471
|
}
|
|
41410
41472
|
};
|
|
@@ -41456,10 +41518,10 @@ const PageThread = () => {
|
|
|
41456
41518
|
window.scrollTo({
|
|
41457
41519
|
top: 0
|
|
41458
41520
|
});
|
|
41459
|
-
/*
|
|
41460
|
-
if (ref.current) {
|
|
41461
|
-
ref.current.scrollIntoView();
|
|
41462
|
-
}
|
|
41521
|
+
/*
|
|
41522
|
+
if (ref.current) {
|
|
41523
|
+
ref.current.scrollIntoView();
|
|
41524
|
+
}
|
|
41463
41525
|
*/
|
|
41464
41526
|
}, [message, hasValidChunks]);
|
|
41465
41527
|
const classNames = getClassNames(style$2.thread);
|
|
@@ -41937,15 +41999,15 @@ const Scroller = _ref => {
|
|
|
41937
41999
|
}
|
|
41938
42000
|
},
|
|
41939
42001
|
start: () => {
|
|
41940
|
-
/*
|
|
41941
|
-
if (innerRef.current) {
|
|
41942
|
-
}
|
|
42002
|
+
/*
|
|
42003
|
+
if (innerRef.current) {
|
|
42004
|
+
}
|
|
41943
42005
|
*/
|
|
41944
42006
|
},
|
|
41945
42007
|
stop: () => {
|
|
41946
|
-
/*
|
|
41947
|
-
if (innerRef.current) {
|
|
41948
|
-
}
|
|
42008
|
+
/*
|
|
42009
|
+
if (innerRef.current) {
|
|
42010
|
+
}
|
|
41949
42011
|
*/
|
|
41950
42012
|
}
|
|
41951
42013
|
});
|
|
@@ -42134,30 +42196,30 @@ const Suggestions = () => {
|
|
|
42134
42196
|
});
|
|
42135
42197
|
};
|
|
42136
42198
|
|
|
42137
|
-
/*
|
|
42138
|
-
|
|
42139
|
-
const swiperProps = {
|
|
42140
|
-
modules: [FreeMode],
|
|
42141
|
-
spaceBetween: 8,
|
|
42142
|
-
freeMode: true,
|
|
42143
|
-
slidesPerView: 'auto' as const,
|
|
42144
|
-
slidesOffsetAfter: clamp(20, 110),
|
|
42145
|
-
slidesOffsetBefore: clamp(20, 110),
|
|
42146
|
-
};
|
|
42147
|
-
|
|
42148
|
-
<section className="llm__prompt-suggestions">
|
|
42149
|
-
<div className="llm__suggestions">
|
|
42150
|
-
<Swiper {...swiperProps} onInit={swiper => swiper.update()}>
|
|
42151
|
-
{app?.contents.sampleInputTexts?.map((s, j) => (
|
|
42152
|
-
<SwiperSlide key={j}>
|
|
42153
|
-
<button type="button" className="llm__pill" onClick={() => onClick(s)}>
|
|
42154
|
-
{s.sampleInputText}
|
|
42155
|
-
</button>
|
|
42156
|
-
</SwiperSlide>
|
|
42157
|
-
))}
|
|
42158
|
-
</Swiper>
|
|
42159
|
-
</div>
|
|
42160
|
-
</section>
|
|
42199
|
+
/*
|
|
42200
|
+
|
|
42201
|
+
const swiperProps = {
|
|
42202
|
+
modules: [FreeMode],
|
|
42203
|
+
spaceBetween: 8,
|
|
42204
|
+
freeMode: true,
|
|
42205
|
+
slidesPerView: 'auto' as const,
|
|
42206
|
+
slidesOffsetAfter: clamp(20, 110),
|
|
42207
|
+
slidesOffsetBefore: clamp(20, 110),
|
|
42208
|
+
};
|
|
42209
|
+
|
|
42210
|
+
<section className="llm__prompt-suggestions">
|
|
42211
|
+
<div className="llm__suggestions">
|
|
42212
|
+
<Swiper {...swiperProps} onInit={swiper => swiper.update()}>
|
|
42213
|
+
{app?.contents.sampleInputTexts?.map((s, j) => (
|
|
42214
|
+
<SwiperSlide key={j}>
|
|
42215
|
+
<button type="button" className="llm__pill" onClick={() => onClick(s)}>
|
|
42216
|
+
{s.sampleInputText}
|
|
42217
|
+
</button>
|
|
42218
|
+
</SwiperSlide>
|
|
42219
|
+
))}
|
|
42220
|
+
</Swiper>
|
|
42221
|
+
</div>
|
|
42222
|
+
</section>
|
|
42161
42223
|
*/
|
|
42162
42224
|
|
|
42163
42225
|
const Thread = () => {
|
|
@@ -42193,6 +42255,32 @@ const Thread = () => {
|
|
|
42193
42255
|
});
|
|
42194
42256
|
};
|
|
42195
42257
|
|
|
42258
|
+
const MinimizeButton = _ref => {
|
|
42259
|
+
let {
|
|
42260
|
+
onClick,
|
|
42261
|
+
label
|
|
42262
|
+
} = _ref;
|
|
42263
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
42264
|
+
type: "button",
|
|
42265
|
+
className: "llm__trigger-minimize",
|
|
42266
|
+
onClick: onClick,
|
|
42267
|
+
"aria-label": label,
|
|
42268
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx("svg", {
|
|
42269
|
+
width: "16",
|
|
42270
|
+
height: "16",
|
|
42271
|
+
viewBox: "0 0 16 16",
|
|
42272
|
+
fill: "none",
|
|
42273
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42274
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
42275
|
+
d: "M4 6L8 10L12 6",
|
|
42276
|
+
stroke: "currentColor",
|
|
42277
|
+
strokeWidth: "1.5",
|
|
42278
|
+
strokeLinecap: "round",
|
|
42279
|
+
strokeLinejoin: "round"
|
|
42280
|
+
})
|
|
42281
|
+
})
|
|
42282
|
+
});
|
|
42283
|
+
};
|
|
42196
42284
|
const Trigger = () => {
|
|
42197
42285
|
const theme = useLlm(state => state.theme);
|
|
42198
42286
|
const {
|
|
@@ -42200,16 +42288,21 @@ const Trigger = () => {
|
|
|
42200
42288
|
} = useLlm(state => state.components);
|
|
42201
42289
|
const app = useLlm(state => state.app);
|
|
42202
42290
|
const opened = useLlmView(state => state.opened);
|
|
42291
|
+
const minimized = useLlmView(state => state.minimized);
|
|
42203
42292
|
const {
|
|
42204
|
-
open
|
|
42293
|
+
open,
|
|
42294
|
+
setMinimized
|
|
42205
42295
|
} = useLlmView(state => state.actions);
|
|
42206
42296
|
const label = useLabel();
|
|
42297
|
+
const enableMinimize = app?.contents.enableMinimize;
|
|
42207
42298
|
const collapsedWelcomeText = messageMapper(app?.contents.collapsedWelcomeText);
|
|
42208
42299
|
const collapsedWelcomeTextCta = messageMapper(app?.contents.collapsedWelcomeTextCta);
|
|
42209
42300
|
const collapsedWelcomeTextHover = messageMapper(app?.contents.collapsedWelcomeTextHover);
|
|
42210
42301
|
const position = theme.trigger?.position || 'bottom';
|
|
42211
42302
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(motion.nav, {
|
|
42212
|
-
className: getClassNames('llm__trigger', '-' + position
|
|
42303
|
+
className: getClassNames('llm__trigger', '-' + position, {
|
|
42304
|
+
'-minimized': minimized
|
|
42305
|
+
}),
|
|
42213
42306
|
initial: {
|
|
42214
42307
|
y: '200%',
|
|
42215
42308
|
opacity: 0
|
|
@@ -42223,12 +42316,12 @@ const Trigger = () => {
|
|
|
42223
42316
|
opacity: 0
|
|
42224
42317
|
},
|
|
42225
42318
|
transition: {
|
|
42226
|
-
duration: .4
|
|
42319
|
+
duration: 0.4
|
|
42227
42320
|
},
|
|
42228
42321
|
"aria-label": "Trigger"
|
|
42229
|
-
/*
|
|
42230
|
-
aria-expanded={opened}
|
|
42231
|
-
aria-controls={mainId}
|
|
42322
|
+
/*
|
|
42323
|
+
aria-expanded={opened}
|
|
42324
|
+
aria-controls={mainId}
|
|
42232
42325
|
*/,
|
|
42233
42326
|
onClick: () => open(),
|
|
42234
42327
|
children: [/*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
@@ -42239,14 +42332,20 @@ const Trigger = () => {
|
|
|
42239
42332
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Blob, {}), /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
42240
42333
|
children: label('llm.button')
|
|
42241
42334
|
})]
|
|
42242
|
-
}), !opened && (collapsedWelcomeText || collapsedWelcomeTextCta || collapsedWelcomeTextHover) && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
42335
|
+
}), !opened && !minimized && (collapsedWelcomeText || collapsedWelcomeTextCta || collapsedWelcomeTextHover) && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
42243
42336
|
className: "llm__trigger-popup -llm-t-body2",
|
|
42244
42337
|
children: [(collapsedWelcomeText || collapsedWelcomeTextCta) && /*#__PURE__*/jsxRuntimeExports.jsxs(motion.div, {
|
|
42245
42338
|
className: "llm__trigger-message",
|
|
42246
42339
|
exit: {
|
|
42247
42340
|
opacity: 0
|
|
42248
42341
|
},
|
|
42249
|
-
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Canvas, {}), collapsedWelcomeText,
|
|
42342
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Canvas, {}), collapsedWelcomeText, enableMinimize && /*#__PURE__*/jsxRuntimeExports.jsx(MinimizeButton, {
|
|
42343
|
+
onClick: e => {
|
|
42344
|
+
e.stopPropagation();
|
|
42345
|
+
setMinimized(true);
|
|
42346
|
+
},
|
|
42347
|
+
label: label('llm.minimize') || 'Minimize'
|
|
42348
|
+
}), collapsedWelcomeTextCta && /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
42250
42349
|
type: "button",
|
|
42251
42350
|
className: "llm__trigger-cta",
|
|
42252
42351
|
children: collapsedWelcomeTextCta
|
|
@@ -43409,13 +43508,13 @@ class MessageDecoder {
|
|
|
43409
43508
|
decodeMessages(messages) {
|
|
43410
43509
|
return messages.map(x => {
|
|
43411
43510
|
if (Array.isArray(x.content)) {
|
|
43412
|
-
/*
|
|
43413
|
-
if (x.role === 'user') {
|
|
43414
|
-
return ({
|
|
43415
|
-
...x,
|
|
43416
|
-
chunks: x.content.map(x => this.decodeChunk(x)),
|
|
43417
|
-
});
|
|
43418
|
-
}
|
|
43511
|
+
/*
|
|
43512
|
+
if (x.role === 'user') {
|
|
43513
|
+
return ({
|
|
43514
|
+
...x,
|
|
43515
|
+
chunks: x.content.map(x => this.decodeChunk(x)),
|
|
43516
|
+
});
|
|
43517
|
+
}
|
|
43419
43518
|
*/
|
|
43420
43519
|
return {
|
|
43421
43520
|
...x,
|
|
@@ -43656,163 +43755,163 @@ class MessageDecoder {
|
|
|
43656
43755
|
return chunkItems;
|
|
43657
43756
|
}
|
|
43658
43757
|
|
|
43659
|
-
/*
|
|
43660
|
-
chunksToChunkItems___(chunks: LlmChunk[], response?: StreamResponse): LlmChunkItem[] {
|
|
43661
|
-
const chunkItems: LlmChunkItem[] = [];
|
|
43662
|
-
chunks.forEach(x => {
|
|
43663
|
-
const chunk: LlmChunkItem = typeof x === 'string' ? { type: 'text', text: x } : x;
|
|
43664
|
-
const lastMessage = chunkItems[chunkItems.length - 1];
|
|
43665
|
-
switch (chunk.type) {
|
|
43666
|
-
case 'text':
|
|
43667
|
-
if (lastMessage && isChunkText(lastMessage)) {
|
|
43668
|
-
const text = chunk.text;
|
|
43669
|
-
const lastChunkText = lastMessage;
|
|
43670
|
-
if (chunkItems.indexOf(lastChunkText) > 0) {
|
|
43671
|
-
// secondary chunk
|
|
43672
|
-
lastChunkText.text += text;
|
|
43673
|
-
} else if (!lastChunkText.text.includes('\n')) {
|
|
43674
|
-
// uncompleted first chunk
|
|
43675
|
-
if (text.includes('\n')) {
|
|
43676
|
-
const lines = text.split('\n');
|
|
43677
|
-
lines.forEach((line, i) => {
|
|
43678
|
-
const lastChar = (lines.length > i + 1) ? '\n' : '';
|
|
43679
|
-
if (i === 0) {
|
|
43680
|
-
lastChunkText.text += line + lastChar;
|
|
43681
|
-
} else if (line.length > 0) {
|
|
43682
|
-
chunkItems.push({
|
|
43683
|
-
type: 'text',
|
|
43684
|
-
text: line + lastChar,
|
|
43685
|
-
});
|
|
43686
|
-
}
|
|
43687
|
-
});
|
|
43688
|
-
} else {
|
|
43689
|
-
// uncompleted first chunk
|
|
43690
|
-
lastChunkText.text += text;
|
|
43691
|
-
}
|
|
43692
|
-
} else {
|
|
43693
|
-
// completed first chunk
|
|
43694
|
-
chunkItems.push(chunk);
|
|
43695
|
-
}
|
|
43696
|
-
} else {
|
|
43697
|
-
// new text chunk
|
|
43698
|
-
chunkItems.push(chunk);
|
|
43699
|
-
}
|
|
43700
|
-
break;
|
|
43701
|
-
case 'log':
|
|
43702
|
-
break;
|
|
43703
|
-
case 'error':
|
|
43704
|
-
chunkItems.push(chunk);
|
|
43705
|
-
break;
|
|
43706
|
-
case 'header': {
|
|
43707
|
-
const { type, ...rest } = chunk;
|
|
43708
|
-
if (response) {
|
|
43709
|
-
Object.assign(response, rest);
|
|
43710
|
-
}
|
|
43711
|
-
// console.log('header', response);
|
|
43712
|
-
}
|
|
43713
|
-
break;
|
|
43714
|
-
case 'info': {
|
|
43715
|
-
if (response) {
|
|
43716
|
-
// !!! deprecated
|
|
43717
|
-
response.threadId = chunk.threadId || response.threadId;
|
|
43718
|
-
}
|
|
43719
|
-
}
|
|
43720
|
-
break;
|
|
43721
|
-
case 'end':
|
|
43722
|
-
break;
|
|
43723
|
-
case 'action':
|
|
43724
|
-
case 'actionItem':
|
|
43725
|
-
if (lastMessage && lastMessage.type === 'actionGroup') {
|
|
43726
|
-
lastMessage.items.push(chunk);
|
|
43727
|
-
} else {
|
|
43728
|
-
chunkItems.push({
|
|
43729
|
-
type: 'actionGroup',
|
|
43730
|
-
items: [chunk],
|
|
43731
|
-
});
|
|
43732
|
-
}
|
|
43733
|
-
break;
|
|
43734
|
-
case 'cardItem':
|
|
43735
|
-
if (lastMessage && lastMessage.type === 'cardGroup') {
|
|
43736
|
-
lastMessage.items.push(chunk);
|
|
43737
|
-
} else {
|
|
43738
|
-
chunkItems.push({
|
|
43739
|
-
type: 'cardGroup',
|
|
43740
|
-
items: [chunk],
|
|
43741
|
-
});
|
|
43742
|
-
}
|
|
43743
|
-
break;
|
|
43744
|
-
case 'productItem':
|
|
43745
|
-
if (lastMessage && lastMessage.type === 'productGroup') {
|
|
43746
|
-
lastMessage.items.push(chunk);
|
|
43747
|
-
} else {
|
|
43748
|
-
chunkItems.push({
|
|
43749
|
-
type: 'productGroup',
|
|
43750
|
-
items: [chunk],
|
|
43751
|
-
});
|
|
43752
|
-
}
|
|
43753
|
-
break;
|
|
43754
|
-
case 'eventItem':
|
|
43755
|
-
if (lastMessage && lastMessage.type === 'eventGroup') {
|
|
43756
|
-
lastMessage.items.push(chunk);
|
|
43757
|
-
} else {
|
|
43758
|
-
chunkItems.push({
|
|
43759
|
-
type: 'eventGroup',
|
|
43760
|
-
items: [chunk],
|
|
43761
|
-
});
|
|
43762
|
-
}
|
|
43763
|
-
break;
|
|
43764
|
-
case 'poiItem':
|
|
43765
|
-
if (lastMessage && lastMessage.type === 'poiGroup') {
|
|
43766
|
-
lastMessage.items.push(chunk);
|
|
43767
|
-
} else {
|
|
43768
|
-
chunkItems.push({
|
|
43769
|
-
type: 'poiGroup',
|
|
43770
|
-
items: [chunk],
|
|
43771
|
-
});
|
|
43772
|
-
}
|
|
43773
|
-
break;
|
|
43774
|
-
case 'tripadvisor':
|
|
43775
|
-
case 'tripadvisorItem':
|
|
43776
|
-
if (lastMessage && lastMessage.type === 'tripadvisorGroup') {
|
|
43777
|
-
lastMessage.items.push({
|
|
43778
|
-
...chunk,
|
|
43779
|
-
type: 'tripadvisorItem',
|
|
43780
|
-
});
|
|
43781
|
-
} else {
|
|
43782
|
-
chunkItems.push({
|
|
43783
|
-
type: 'tripadvisorGroup',
|
|
43784
|
-
items: [{
|
|
43785
|
-
...chunk,
|
|
43786
|
-
type: 'tripadvisorItem',
|
|
43787
|
-
}],
|
|
43788
|
-
});
|
|
43789
|
-
}
|
|
43790
|
-
break;
|
|
43791
|
-
default:
|
|
43792
|
-
if (
|
|
43793
|
-
typeof chunk.type === 'string' &&
|
|
43794
|
-
chunk.type.match(/Item$/)
|
|
43795
|
-
) {
|
|
43796
|
-
const baseName = chunk.type.replace('Item', '');
|
|
43797
|
-
const groupName = `${baseName}Group`;
|
|
43798
|
-
if (lastMessage && lastMessage.type === groupName) {
|
|
43799
|
-
(lastMessage as { items: (typeof x)[] }).items.push(x);
|
|
43800
|
-
} else {
|
|
43801
|
-
chunkItems.push({
|
|
43802
|
-
type: groupName,
|
|
43803
|
-
items: [{
|
|
43804
|
-
...chunk,
|
|
43805
|
-
type: baseName,
|
|
43806
|
-
}],
|
|
43807
|
-
} as unknown as LlmChunkUnknownItem);
|
|
43808
|
-
}
|
|
43809
|
-
} else {
|
|
43810
|
-
chunkItems.push(chunk);
|
|
43811
|
-
}
|
|
43812
|
-
}
|
|
43813
|
-
});
|
|
43814
|
-
return chunkItems;
|
|
43815
|
-
}
|
|
43758
|
+
/*
|
|
43759
|
+
chunksToChunkItems___(chunks: LlmChunk[], response?: StreamResponse): LlmChunkItem[] {
|
|
43760
|
+
const chunkItems: LlmChunkItem[] = [];
|
|
43761
|
+
chunks.forEach(x => {
|
|
43762
|
+
const chunk: LlmChunkItem = typeof x === 'string' ? { type: 'text', text: x } : x;
|
|
43763
|
+
const lastMessage = chunkItems[chunkItems.length - 1];
|
|
43764
|
+
switch (chunk.type) {
|
|
43765
|
+
case 'text':
|
|
43766
|
+
if (lastMessage && isChunkText(lastMessage)) {
|
|
43767
|
+
const text = chunk.text;
|
|
43768
|
+
const lastChunkText = lastMessage;
|
|
43769
|
+
if (chunkItems.indexOf(lastChunkText) > 0) {
|
|
43770
|
+
// secondary chunk
|
|
43771
|
+
lastChunkText.text += text;
|
|
43772
|
+
} else if (!lastChunkText.text.includes('\n')) {
|
|
43773
|
+
// uncompleted first chunk
|
|
43774
|
+
if (text.includes('\n')) {
|
|
43775
|
+
const lines = text.split('\n');
|
|
43776
|
+
lines.forEach((line, i) => {
|
|
43777
|
+
const lastChar = (lines.length > i + 1) ? '\n' : '';
|
|
43778
|
+
if (i === 0) {
|
|
43779
|
+
lastChunkText.text += line + lastChar;
|
|
43780
|
+
} else if (line.length > 0) {
|
|
43781
|
+
chunkItems.push({
|
|
43782
|
+
type: 'text',
|
|
43783
|
+
text: line + lastChar,
|
|
43784
|
+
});
|
|
43785
|
+
}
|
|
43786
|
+
});
|
|
43787
|
+
} else {
|
|
43788
|
+
// uncompleted first chunk
|
|
43789
|
+
lastChunkText.text += text;
|
|
43790
|
+
}
|
|
43791
|
+
} else {
|
|
43792
|
+
// completed first chunk
|
|
43793
|
+
chunkItems.push(chunk);
|
|
43794
|
+
}
|
|
43795
|
+
} else {
|
|
43796
|
+
// new text chunk
|
|
43797
|
+
chunkItems.push(chunk);
|
|
43798
|
+
}
|
|
43799
|
+
break;
|
|
43800
|
+
case 'log':
|
|
43801
|
+
break;
|
|
43802
|
+
case 'error':
|
|
43803
|
+
chunkItems.push(chunk);
|
|
43804
|
+
break;
|
|
43805
|
+
case 'header': {
|
|
43806
|
+
const { type, ...rest } = chunk;
|
|
43807
|
+
if (response) {
|
|
43808
|
+
Object.assign(response, rest);
|
|
43809
|
+
}
|
|
43810
|
+
// console.log('header', response);
|
|
43811
|
+
}
|
|
43812
|
+
break;
|
|
43813
|
+
case 'info': {
|
|
43814
|
+
if (response) {
|
|
43815
|
+
// !!! deprecated
|
|
43816
|
+
response.threadId = chunk.threadId || response.threadId;
|
|
43817
|
+
}
|
|
43818
|
+
}
|
|
43819
|
+
break;
|
|
43820
|
+
case 'end':
|
|
43821
|
+
break;
|
|
43822
|
+
case 'action':
|
|
43823
|
+
case 'actionItem':
|
|
43824
|
+
if (lastMessage && lastMessage.type === 'actionGroup') {
|
|
43825
|
+
lastMessage.items.push(chunk);
|
|
43826
|
+
} else {
|
|
43827
|
+
chunkItems.push({
|
|
43828
|
+
type: 'actionGroup',
|
|
43829
|
+
items: [chunk],
|
|
43830
|
+
});
|
|
43831
|
+
}
|
|
43832
|
+
break;
|
|
43833
|
+
case 'cardItem':
|
|
43834
|
+
if (lastMessage && lastMessage.type === 'cardGroup') {
|
|
43835
|
+
lastMessage.items.push(chunk);
|
|
43836
|
+
} else {
|
|
43837
|
+
chunkItems.push({
|
|
43838
|
+
type: 'cardGroup',
|
|
43839
|
+
items: [chunk],
|
|
43840
|
+
});
|
|
43841
|
+
}
|
|
43842
|
+
break;
|
|
43843
|
+
case 'productItem':
|
|
43844
|
+
if (lastMessage && lastMessage.type === 'productGroup') {
|
|
43845
|
+
lastMessage.items.push(chunk);
|
|
43846
|
+
} else {
|
|
43847
|
+
chunkItems.push({
|
|
43848
|
+
type: 'productGroup',
|
|
43849
|
+
items: [chunk],
|
|
43850
|
+
});
|
|
43851
|
+
}
|
|
43852
|
+
break;
|
|
43853
|
+
case 'eventItem':
|
|
43854
|
+
if (lastMessage && lastMessage.type === 'eventGroup') {
|
|
43855
|
+
lastMessage.items.push(chunk);
|
|
43856
|
+
} else {
|
|
43857
|
+
chunkItems.push({
|
|
43858
|
+
type: 'eventGroup',
|
|
43859
|
+
items: [chunk],
|
|
43860
|
+
});
|
|
43861
|
+
}
|
|
43862
|
+
break;
|
|
43863
|
+
case 'poiItem':
|
|
43864
|
+
if (lastMessage && lastMessage.type === 'poiGroup') {
|
|
43865
|
+
lastMessage.items.push(chunk);
|
|
43866
|
+
} else {
|
|
43867
|
+
chunkItems.push({
|
|
43868
|
+
type: 'poiGroup',
|
|
43869
|
+
items: [chunk],
|
|
43870
|
+
});
|
|
43871
|
+
}
|
|
43872
|
+
break;
|
|
43873
|
+
case 'tripadvisor':
|
|
43874
|
+
case 'tripadvisorItem':
|
|
43875
|
+
if (lastMessage && lastMessage.type === 'tripadvisorGroup') {
|
|
43876
|
+
lastMessage.items.push({
|
|
43877
|
+
...chunk,
|
|
43878
|
+
type: 'tripadvisorItem',
|
|
43879
|
+
});
|
|
43880
|
+
} else {
|
|
43881
|
+
chunkItems.push({
|
|
43882
|
+
type: 'tripadvisorGroup',
|
|
43883
|
+
items: [{
|
|
43884
|
+
...chunk,
|
|
43885
|
+
type: 'tripadvisorItem',
|
|
43886
|
+
}],
|
|
43887
|
+
});
|
|
43888
|
+
}
|
|
43889
|
+
break;
|
|
43890
|
+
default:
|
|
43891
|
+
if (
|
|
43892
|
+
typeof chunk.type === 'string' &&
|
|
43893
|
+
chunk.type.match(/Item$/)
|
|
43894
|
+
) {
|
|
43895
|
+
const baseName = chunk.type.replace('Item', '');
|
|
43896
|
+
const groupName = `${baseName}Group`;
|
|
43897
|
+
if (lastMessage && lastMessage.type === groupName) {
|
|
43898
|
+
(lastMessage as { items: (typeof x)[] }).items.push(x);
|
|
43899
|
+
} else {
|
|
43900
|
+
chunkItems.push({
|
|
43901
|
+
type: groupName,
|
|
43902
|
+
items: [{
|
|
43903
|
+
...chunk,
|
|
43904
|
+
type: baseName,
|
|
43905
|
+
}],
|
|
43906
|
+
} as unknown as LlmChunkUnknownItem);
|
|
43907
|
+
}
|
|
43908
|
+
} else {
|
|
43909
|
+
chunkItems.push(chunk);
|
|
43910
|
+
}
|
|
43911
|
+
}
|
|
43912
|
+
});
|
|
43913
|
+
return chunkItems;
|
|
43914
|
+
}
|
|
43816
43915
|
*/
|
|
43817
43916
|
|
|
43818
43917
|
static decodeThread(thread) {
|
|
@@ -43967,10 +44066,10 @@ class MessageService extends MessageDecoder {
|
|
|
43967
44066
|
return;
|
|
43968
44067
|
}
|
|
43969
44068
|
const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
|
|
43970
|
-
/*
|
|
43971
|
-
if (error instanceof TypeError) {
|
|
43972
|
-
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
43973
|
-
}
|
|
44069
|
+
/*
|
|
44070
|
+
if (error instanceof TypeError) {
|
|
44071
|
+
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44072
|
+
}
|
|
43974
44073
|
*/
|
|
43975
44074
|
if (typeof onEnd === 'function') {
|
|
43976
44075
|
const errorChunk = {
|
|
@@ -44089,10 +44188,10 @@ class MessageService extends MessageDecoder {
|
|
|
44089
44188
|
} catch (error) {
|
|
44090
44189
|
console.error('MessageService.mockMessage.error', error);
|
|
44091
44190
|
const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
|
|
44092
|
-
/*
|
|
44093
|
-
if (error instanceof TypeError) {
|
|
44094
|
-
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44095
|
-
}
|
|
44191
|
+
/*
|
|
44192
|
+
if (error instanceof TypeError) {
|
|
44193
|
+
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44194
|
+
}
|
|
44096
44195
|
*/
|
|
44097
44196
|
if (typeof onEnd === 'function') {
|
|
44098
44197
|
const errorChunk = {
|
|
@@ -44147,36 +44246,36 @@ function readChunks(reader) {
|
|
|
44147
44246
|
};
|
|
44148
44247
|
}
|
|
44149
44248
|
|
|
44150
|
-
/*
|
|
44151
|
-
async function* streamAsyncIterable<T>(stream: ReadableStream<T>) {
|
|
44152
|
-
const reader = stream.getReader();
|
|
44153
|
-
try {
|
|
44154
|
-
while (true) {
|
|
44155
|
-
const { done, value } = await reader.read();
|
|
44156
|
-
if (done) return;
|
|
44157
|
-
yield value;
|
|
44158
|
-
}
|
|
44159
|
-
} finally {
|
|
44160
|
-
reader.releaseLock();
|
|
44161
|
-
}
|
|
44162
|
-
}
|
|
44163
|
-
|
|
44164
|
-
class Iterator {
|
|
44165
|
-
}
|
|
44166
|
-
|
|
44167
|
-
(Iterator as any).prototype[Symbol.asyncIterator] = async function* () {
|
|
44168
|
-
const reader = this.getReader();
|
|
44169
|
-
try {
|
|
44170
|
-
while (true) {
|
|
44171
|
-
const { done, value } = await reader.read();
|
|
44172
|
-
if (done) return;
|
|
44173
|
-
yield value;
|
|
44174
|
-
}
|
|
44175
|
-
}
|
|
44176
|
-
finally {
|
|
44177
|
-
reader.releaseLock();
|
|
44178
|
-
}
|
|
44179
|
-
};
|
|
44249
|
+
/*
|
|
44250
|
+
async function* streamAsyncIterable<T>(stream: ReadableStream<T>) {
|
|
44251
|
+
const reader = stream.getReader();
|
|
44252
|
+
try {
|
|
44253
|
+
while (true) {
|
|
44254
|
+
const { done, value } = await reader.read();
|
|
44255
|
+
if (done) return;
|
|
44256
|
+
yield value;
|
|
44257
|
+
}
|
|
44258
|
+
} finally {
|
|
44259
|
+
reader.releaseLock();
|
|
44260
|
+
}
|
|
44261
|
+
}
|
|
44262
|
+
|
|
44263
|
+
class Iterator {
|
|
44264
|
+
}
|
|
44265
|
+
|
|
44266
|
+
(Iterator as any).prototype[Symbol.asyncIterator] = async function* () {
|
|
44267
|
+
const reader = this.getReader();
|
|
44268
|
+
try {
|
|
44269
|
+
while (true) {
|
|
44270
|
+
const { done, value } = await reader.read();
|
|
44271
|
+
if (done) return;
|
|
44272
|
+
yield value;
|
|
44273
|
+
}
|
|
44274
|
+
}
|
|
44275
|
+
finally {
|
|
44276
|
+
reader.releaseLock();
|
|
44277
|
+
}
|
|
44278
|
+
};
|
|
44180
44279
|
*/
|
|
44181
44280
|
|
|
44182
44281
|
class ApiService {
|
|
@@ -44779,19 +44878,19 @@ class DefaultTextToSpeech {
|
|
|
44779
44878
|
utterance.onerror = error => {
|
|
44780
44879
|
console.warn('DefaultTextToSpeech.speak.onerror', error);
|
|
44781
44880
|
};
|
|
44782
|
-
/*
|
|
44783
|
-
utterance.onboundary = (event) => {
|
|
44784
|
-
console.log('DefaultTextToSpeech.speak.onboundary', event);
|
|
44785
|
-
};
|
|
44786
|
-
utterance.onmark = (event) => {
|
|
44787
|
-
console.log('DefaultTextToSpeech.speak.onmark', event);
|
|
44788
|
-
};
|
|
44789
|
-
utterance.onpause = (event) => {
|
|
44790
|
-
console.log('DefaultTextToSpeech.speak.onpause', event);
|
|
44791
|
-
};
|
|
44792
|
-
utterance.onresume = (event) => {
|
|
44793
|
-
console.log('DefaultTextToSpeech.speak.onresume', event);
|
|
44794
|
-
};
|
|
44881
|
+
/*
|
|
44882
|
+
utterance.onboundary = (event) => {
|
|
44883
|
+
console.log('DefaultTextToSpeech.speak.onboundary', event);
|
|
44884
|
+
};
|
|
44885
|
+
utterance.onmark = (event) => {
|
|
44886
|
+
console.log('DefaultTextToSpeech.speak.onmark', event);
|
|
44887
|
+
};
|
|
44888
|
+
utterance.onpause = (event) => {
|
|
44889
|
+
console.log('DefaultTextToSpeech.speak.onpause', event);
|
|
44890
|
+
};
|
|
44891
|
+
utterance.onresume = (event) => {
|
|
44892
|
+
console.log('DefaultTextToSpeech.speak.onresume', event);
|
|
44893
|
+
};
|
|
44795
44894
|
*/
|
|
44796
44895
|
utterance.voice = voice;
|
|
44797
44896
|
utterance.pitch = pitch;
|
|
@@ -44975,12 +45074,12 @@ class DefaultSpeechToText {
|
|
|
44975
45074
|
return this.recognizer_;
|
|
44976
45075
|
} else {
|
|
44977
45076
|
const recognizer = new this.recognition();
|
|
44978
|
-
/*
|
|
44979
|
-
const grammar =
|
|
44980
|
-
"#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
|
|
44981
|
-
const grammarList = new this.grammarList();
|
|
44982
|
-
grammarList.addFromString(grammar, 1);
|
|
44983
|
-
recognizer.grammars = grammarList;
|
|
45077
|
+
/*
|
|
45078
|
+
const grammar =
|
|
45079
|
+
"#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;";
|
|
45080
|
+
const grammarList = new this.grammarList();
|
|
45081
|
+
grammarList.addFromString(grammar, 1);
|
|
45082
|
+
recognizer.grammars = grammarList;
|
|
44984
45083
|
*/
|
|
44985
45084
|
recognizer.lang = this.lang; // "en-US";
|
|
44986
45085
|
recognizer.continuous = true;
|
|
@@ -44998,37 +45097,37 @@ class DefaultSpeechToText {
|
|
|
44998
45097
|
// console.log('recognizer.result');
|
|
44999
45098
|
this.onResult(event);
|
|
45000
45099
|
});
|
|
45001
|
-
/*
|
|
45002
|
-
recognizer.addEventListener("audioend", (event) => {
|
|
45003
|
-
this.log('recognizer', "audioend", event);
|
|
45004
|
-
});
|
|
45005
|
-
recognizer.addEventListener("speechend", (event) => {
|
|
45006
|
-
this.log('recognizer', "speechend", event);
|
|
45007
|
-
});
|
|
45100
|
+
/*
|
|
45101
|
+
recognizer.addEventListener("audioend", (event) => {
|
|
45102
|
+
this.log('recognizer', "audioend", event);
|
|
45103
|
+
});
|
|
45104
|
+
recognizer.addEventListener("speechend", (event) => {
|
|
45105
|
+
this.log('recognizer', "speechend", event);
|
|
45106
|
+
});
|
|
45008
45107
|
*/
|
|
45009
|
-
/*
|
|
45010
|
-
audiostart
|
|
45011
|
-
Fired when the user agent has started to capture audio. Also available via the onaudiostart property.
|
|
45012
|
-
audioend
|
|
45013
|
-
Fired when the user agent has finished capturing audio. Also available via the onaudioend property.
|
|
45014
|
-
end
|
|
45015
|
-
Fired when the speech recognition service has disconnected. Also available via the onend property.
|
|
45016
|
-
error
|
|
45017
|
-
Fired when a speech recognition error occurs. Also available via the onerror property.
|
|
45018
|
-
nomatch
|
|
45019
|
-
Fired when the speech recognition service returns a final result with no significant recognition. This may involve some degree of recognition, which doesn't meet or exceed the confidence threshold. Also available via the onnomatch property.
|
|
45020
|
-
result
|
|
45021
|
-
Fired when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app. Also available via the onresult property.
|
|
45022
|
-
soundstart
|
|
45023
|
-
Fired when any sound — recognizable speech or not — has been detected. Also available via the onsoundstart property.
|
|
45024
|
-
soundend
|
|
45025
|
-
Fired when any sound — recognizable speech or not — has stopped being detected. Also available via the onsoundend property.
|
|
45026
|
-
speechstart
|
|
45027
|
-
Fired when sound that is recognized by the speech recognition service as speech has been detected. Also available via the onspeechstart property.
|
|
45028
|
-
speechend
|
|
45029
|
-
Fired when speech recognized by the speech recognition service has stopped being detected. Also available via the onspeechend property.
|
|
45030
|
-
start
|
|
45031
|
-
Fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current SpeechRecognition. Also available via the onstart property.
|
|
45108
|
+
/*
|
|
45109
|
+
audiostart
|
|
45110
|
+
Fired when the user agent has started to capture audio. Also available via the onaudiostart property.
|
|
45111
|
+
audioend
|
|
45112
|
+
Fired when the user agent has finished capturing audio. Also available via the onaudioend property.
|
|
45113
|
+
end
|
|
45114
|
+
Fired when the speech recognition service has disconnected. Also available via the onend property.
|
|
45115
|
+
error
|
|
45116
|
+
Fired when a speech recognition error occurs. Also available via the onerror property.
|
|
45117
|
+
nomatch
|
|
45118
|
+
Fired when the speech recognition service returns a final result with no significant recognition. This may involve some degree of recognition, which doesn't meet or exceed the confidence threshold. Also available via the onnomatch property.
|
|
45119
|
+
result
|
|
45120
|
+
Fired when the speech recognition service returns a result — a word or phrase has been positively recognized and this has been communicated back to the app. Also available via the onresult property.
|
|
45121
|
+
soundstart
|
|
45122
|
+
Fired when any sound — recognizable speech or not — has been detected. Also available via the onsoundstart property.
|
|
45123
|
+
soundend
|
|
45124
|
+
Fired when any sound — recognizable speech or not — has stopped being detected. Also available via the onsoundend property.
|
|
45125
|
+
speechstart
|
|
45126
|
+
Fired when sound that is recognized by the speech recognition service as speech has been detected. Also available via the onspeechstart property.
|
|
45127
|
+
speechend
|
|
45128
|
+
Fired when speech recognized by the speech recognition service has stopped being detected. Also available via the onspeechend property.
|
|
45129
|
+
start
|
|
45130
|
+
Fired when the speech recognition service has begun listening to incoming audio with intent to recognize grammars associated with the current SpeechRecognition. Also available via the onstart property.
|
|
45032
45131
|
*/
|
|
45033
45132
|
this.recognizer_ = recognizer;
|
|
45034
45133
|
return recognizer;
|
|
@@ -45197,17 +45296,17 @@ const createLlmStore = config => {
|
|
|
45197
45296
|
return c(p);
|
|
45198
45297
|
}, {
|
|
45199
45298
|
...config
|
|
45200
|
-
/**
|
|
45201
|
-
* test remote api
|
|
45202
|
-
...({
|
|
45203
|
-
appKey: 'xxxxxxxxxxxxxx',
|
|
45204
|
-
apiKey: 'xxxxxxxxxxxxxx',
|
|
45205
|
-
threadId: 'xxxxxxxxxxxxxx',
|
|
45206
|
-
endpoint: 'https://platform.websolute.ai',
|
|
45207
|
-
endpoint: 'https://platform-ai-dev.ws-deploy-01.wslabs.it',
|
|
45208
|
-
endpoint: 'http://localhost:4000/bowl',
|
|
45209
|
-
test: false,
|
|
45210
|
-
}),
|
|
45299
|
+
/**
|
|
45300
|
+
* test remote api
|
|
45301
|
+
...({
|
|
45302
|
+
appKey: 'xxxxxxxxxxxxxx',
|
|
45303
|
+
apiKey: 'xxxxxxxxxxxxxx',
|
|
45304
|
+
threadId: 'xxxxxxxxxxxxxx',
|
|
45305
|
+
endpoint: 'https://platform.websolute.ai',
|
|
45306
|
+
endpoint: 'https://platform-ai-dev.ws-deploy-01.wslabs.it',
|
|
45307
|
+
endpoint: 'http://localhost:4000/bowl',
|
|
45308
|
+
test: false,
|
|
45309
|
+
}),
|
|
45211
45310
|
*/
|
|
45212
45311
|
});
|
|
45213
45312
|
const {
|
|
@@ -45348,12 +45447,12 @@ const createLlmStore = config => {
|
|
|
45348
45447
|
}
|
|
45349
45448
|
const thread = MessageDecoder.decodeThread(app.thread);
|
|
45350
45449
|
const testTheme = test ? getMock(locale, test).app?.contents?.customTheme : {};
|
|
45351
|
-
/*
|
|
45352
|
-
console.log(
|
|
45353
|
-
'appTheme', app.contents.customTheme,
|
|
45354
|
-
'testTheme', testTheme,
|
|
45355
|
-
'customTheme', customTheme
|
|
45356
|
-
);
|
|
45450
|
+
/*
|
|
45451
|
+
console.log(
|
|
45452
|
+
'appTheme', app.contents.customTheme,
|
|
45453
|
+
'testTheme', testTheme,
|
|
45454
|
+
'customTheme', customTheme
|
|
45455
|
+
);
|
|
45357
45456
|
*/
|
|
45358
45457
|
const theme = getThemes([app.contents.customTheme, testTheme, customTheme], config.defaultTheme);
|
|
45359
45458
|
const mode = theme.mode;
|
|
@@ -45362,22 +45461,22 @@ const createLlmStore = config => {
|
|
|
45362
45461
|
// console.log('useLlm.storedHistory', storedHistory);
|
|
45363
45462
|
const history = await apiService.decorateHistory(storedHistory, mode);
|
|
45364
45463
|
// console.log('useLlm.history', history);
|
|
45365
|
-
/*
|
|
45366
|
-
// !!! session restored via threadId storage merge
|
|
45367
|
-
if (storageMode === 'session') {
|
|
45368
|
-
// console.log('storageMode', storageMode, history);
|
|
45369
|
-
if (history.length > 0) {
|
|
45370
|
-
thread = {
|
|
45371
|
-
threadId: history[0].threadId,
|
|
45372
|
-
messages: history[0].messages,
|
|
45373
|
-
};
|
|
45374
|
-
}
|
|
45375
|
-
}
|
|
45464
|
+
/*
|
|
45465
|
+
// !!! session restored via threadId storage merge
|
|
45466
|
+
if (storageMode === 'session') {
|
|
45467
|
+
// console.log('storageMode', storageMode, history);
|
|
45468
|
+
if (history.length > 0) {
|
|
45469
|
+
thread = {
|
|
45470
|
+
threadId: history[0].threadId,
|
|
45471
|
+
messages: history[0].messages,
|
|
45472
|
+
};
|
|
45473
|
+
}
|
|
45474
|
+
}
|
|
45376
45475
|
*/
|
|
45377
|
-
/*
|
|
45378
|
-
console.log(
|
|
45379
|
-
'theme', theme
|
|
45380
|
-
);
|
|
45476
|
+
/*
|
|
45477
|
+
console.log(
|
|
45478
|
+
'theme', theme
|
|
45479
|
+
);
|
|
45381
45480
|
*/
|
|
45382
45481
|
const vars = getVars(theme);
|
|
45383
45482
|
createVars(vars);
|
|
@@ -45435,6 +45534,9 @@ const createLlmStore = config => {
|
|
|
45435
45534
|
return;
|
|
45436
45535
|
}
|
|
45437
45536
|
}
|
|
45537
|
+
pushDataLayer({
|
|
45538
|
+
event: state.messages.length > 0 ? 'llm_message' : 'llm_start'
|
|
45539
|
+
});
|
|
45438
45540
|
const messages = await messageService.addUserMessage(state.messages, prompt, uploaded);
|
|
45439
45541
|
set(state => ({
|
|
45440
45542
|
chunks: [],
|
|
@@ -45473,12 +45575,12 @@ const createLlmStore = config => {
|
|
|
45473
45575
|
};
|
|
45474
45576
|
const responseMessages = [...messages, assistantMessage];
|
|
45475
45577
|
// 15/12/2025 disabling form request feature, todo add payload flag
|
|
45476
|
-
/*
|
|
45477
|
-
if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
|
|
45478
|
-
chunks.push({
|
|
45479
|
-
type: 'formRequest',
|
|
45480
|
-
});
|
|
45481
|
-
}
|
|
45578
|
+
/*
|
|
45579
|
+
if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
|
|
45580
|
+
chunks.push({
|
|
45581
|
+
type: 'formRequest',
|
|
45582
|
+
});
|
|
45583
|
+
}
|
|
45482
45584
|
*/
|
|
45483
45585
|
// filtering history
|
|
45484
45586
|
const validChunks = chunks.filter(x => typeof x.type === 'string' && !['header', 'info', 'end', 'formRequest', 'formRecap', 'formRecapSuccess', 'formRecapError'].includes(x.type));
|
|
@@ -45746,10 +45848,10 @@ const createLlmStore = config => {
|
|
|
45746
45848
|
threadId: history.threadId,
|
|
45747
45849
|
message: history.assistant,
|
|
45748
45850
|
messages: history.messages
|
|
45749
|
-
/*
|
|
45750
|
-
messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
|
|
45751
|
-
[...state.messages, history.user, history.assistant] :
|
|
45752
|
-
state.messages,
|
|
45851
|
+
/*
|
|
45852
|
+
messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
|
|
45853
|
+
[...state.messages, history.user, history.assistant] :
|
|
45854
|
+
state.messages,
|
|
45753
45855
|
*/
|
|
45754
45856
|
}));
|
|
45755
45857
|
},
|
|
@@ -45793,10 +45895,10 @@ const createLlmStore = config => {
|
|
|
45793
45895
|
currentState.storedHistory = persistedState.storedHistory && [...persistedState.storedHistory];
|
|
45794
45896
|
currentState.speakEnabled = persistedState.speakEnabled || false;
|
|
45795
45897
|
speech.enabled = currentState.speakEnabled;
|
|
45796
|
-
/*
|
|
45797
|
-
if (persistedState.messages) {
|
|
45798
|
-
currentState.messages = [...persistedState.messages];
|
|
45799
|
-
}
|
|
45898
|
+
/*
|
|
45899
|
+
if (persistedState.messages) {
|
|
45900
|
+
currentState.messages = [...persistedState.messages];
|
|
45901
|
+
}
|
|
45800
45902
|
*/
|
|
45801
45903
|
currentState.hydrated = true;
|
|
45802
45904
|
// console.log('currentState', currentState);
|
|
@@ -45841,7 +45943,7 @@ function messagesToHistory(messages) {
|
|
|
45841
45943
|
}
|
|
45842
45944
|
return p;
|
|
45843
45945
|
}, []);
|
|
45844
|
-
console.log('useLlm.messagesToHistory', history);
|
|
45946
|
+
// console.log('useLlm.messagesToHistory', history);
|
|
45845
45947
|
return history.filter(x => x.threadId && x.messageId);
|
|
45846
45948
|
}
|
|
45847
45949
|
function historyToStoredHistory(history) {
|
|
@@ -46455,21 +46557,21 @@ function renderInstance(node, props, instance) {
|
|
|
46455
46557
|
if (!node.hasAttribute('data-llm')) {
|
|
46456
46558
|
node.setAttribute('data-llm', '');
|
|
46457
46559
|
|
|
46458
|
-
/*
|
|
46459
|
-
const host = node;
|
|
46460
|
-
const shadow = host.attachShadow({ mode: 'open' });
|
|
46461
|
-
const shadowRoot = document.createElement('div');
|
|
46462
|
-
if (typeof window !== 'undefined' && 'llms__' in window) {
|
|
46463
|
-
const llmStyle = (window['llms__'] || []) as string[];
|
|
46464
|
-
const adoptedStyleSheets = llmStyle.map(style => {
|
|
46465
|
-
const sheet = new CSSStyleSheet();
|
|
46466
|
-
sheet.replaceSync(style);
|
|
46467
|
-
return sheet;
|
|
46468
|
-
});
|
|
46469
|
-
shadow.adoptedStyleSheets = adoptedStyleSheets;
|
|
46470
|
-
}
|
|
46471
|
-
shadowRoot.setAttribute('data-llm', '');
|
|
46472
|
-
shadow.appendChild(shadowRoot);
|
|
46560
|
+
/*
|
|
46561
|
+
const host = node;
|
|
46562
|
+
const shadow = host.attachShadow({ mode: 'open' });
|
|
46563
|
+
const shadowRoot = document.createElement('div');
|
|
46564
|
+
if (typeof window !== 'undefined' && 'llms__' in window) {
|
|
46565
|
+
const llmStyle = (window['llms__'] || []) as string[];
|
|
46566
|
+
const adoptedStyleSheets = llmStyle.map(style => {
|
|
46567
|
+
const sheet = new CSSStyleSheet();
|
|
46568
|
+
sheet.replaceSync(style);
|
|
46569
|
+
return sheet;
|
|
46570
|
+
});
|
|
46571
|
+
shadow.adoptedStyleSheets = adoptedStyleSheets;
|
|
46572
|
+
}
|
|
46573
|
+
shadowRoot.setAttribute('data-llm', '');
|
|
46574
|
+
shadow.appendChild(shadowRoot);
|
|
46473
46575
|
*/
|
|
46474
46576
|
|
|
46475
46577
|
const root = client.createRoot(node);
|
|
@@ -46542,10 +46644,10 @@ function observeMutations(targetElement, callback) {
|
|
|
46542
46644
|
if (mutation.type === 'childList') {
|
|
46543
46645
|
callback(mutation);
|
|
46544
46646
|
}
|
|
46545
|
-
/*
|
|
46546
|
-
else if (mutation.type === 'attributes') {
|
|
46547
|
-
console.log(`The ${mutation.attributeName} attribute was modified.`);
|
|
46548
|
-
}
|
|
46647
|
+
/*
|
|
46648
|
+
else if (mutation.type === 'attributes') {
|
|
46649
|
+
console.log(`The ${mutation.attributeName} attribute was modified.`);
|
|
46650
|
+
}
|
|
46549
46651
|
*/
|
|
46550
46652
|
}
|
|
46551
46653
|
});
|