@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/umd/index.js
CHANGED
|
@@ -19,36 +19,36 @@
|
|
|
19
19
|
return Object.freeze(n);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* Checks if the given item is a number.
|
|
24
|
-
* @param item The item to check.
|
|
25
|
-
* @returns True if the item is a number, false otherwise.
|
|
22
|
+
/**
|
|
23
|
+
* Checks if the given item is a number.
|
|
24
|
+
* @param item The item to check.
|
|
25
|
+
* @returns True if the item is a number, false otherwise.
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Checks if the given item is an array.
|
|
30
|
-
* @param item The item to check.
|
|
31
|
-
* @returns True if the item is an array, false otherwise.
|
|
28
|
+
/**
|
|
29
|
+
* Checks if the given item is an array.
|
|
30
|
+
* @param item The item to check.
|
|
31
|
+
* @returns True if the item is an array, false otherwise.
|
|
32
32
|
*/
|
|
33
33
|
function isArray(item) {
|
|
34
34
|
return Array.isArray(item);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* Checks if the given item is an object.
|
|
39
|
-
* @param item The item to check.
|
|
40
|
-
* @returns True if the item is an object, false otherwise.
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the given item is an object.
|
|
39
|
+
* @param item The item to check.
|
|
40
|
+
* @returns True if the item is an object, false otherwise.
|
|
41
41
|
*/
|
|
42
42
|
function isObject$3(item) {
|
|
43
43
|
return item != null && typeof item === 'object' && !isArray(item);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
* PascalCase
|
|
48
|
-
* camelCase
|
|
49
|
-
* kebab-case
|
|
50
|
-
* snake_case
|
|
51
|
-
* char*case
|
|
46
|
+
/**
|
|
47
|
+
* PascalCase
|
|
48
|
+
* camelCase
|
|
49
|
+
* kebab-case
|
|
50
|
+
* snake_case
|
|
51
|
+
* char*case
|
|
52
52
|
**/
|
|
53
53
|
|
|
54
54
|
function unknownCaseToPascalCase(unknownCase) {
|
|
@@ -85,20 +85,20 @@
|
|
|
85
85
|
return kebabCase;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
/**
|
|
89
|
-
* Represents a primitive value that can be used in the deep merge operation.
|
|
88
|
+
/**
|
|
89
|
+
* Represents a primitive value that can be used in the deep merge operation.
|
|
90
90
|
*/
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
* Represents a dynamic value that can be used in the deep merge operation.
|
|
92
|
+
/**
|
|
93
|
+
* Represents a dynamic value that can be used in the deep merge operation.
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
|
-
/**
|
|
97
|
-
* Deeply merges two objects or arrays.
|
|
98
|
-
*
|
|
99
|
-
* @param target - The target object or array to merge into.
|
|
100
|
-
* @param source - The source object or array to merge from.
|
|
101
|
-
* @returns The merged object or array.
|
|
96
|
+
/**
|
|
97
|
+
* Deeply merges two objects or arrays.
|
|
98
|
+
*
|
|
99
|
+
* @param target - The target object or array to merge into.
|
|
100
|
+
* @param source - The source object or array to merge from.
|
|
101
|
+
* @returns The merged object or array.
|
|
102
102
|
*/
|
|
103
103
|
function deepMerge(target, source) {
|
|
104
104
|
const output = {
|
|
@@ -122,19 +122,19 @@
|
|
|
122
122
|
|
|
123
123
|
const isBrowser$1 = typeof window !== 'undefined';
|
|
124
124
|
|
|
125
|
-
/**
|
|
126
|
-
* Checks if the given value is an instance of IClassNameCollection.
|
|
127
|
-
* @param value - The value to check.
|
|
128
|
-
* @returns True if the value is an instance of IClassNameCollection, false otherwise.
|
|
125
|
+
/**
|
|
126
|
+
* Checks if the given value is an instance of IClassNameCollection.
|
|
127
|
+
* @param value - The value to check.
|
|
128
|
+
* @returns True if the value is an instance of IClassNameCollection, false otherwise.
|
|
129
129
|
*/
|
|
130
130
|
function isClassNameCollection(value) {
|
|
131
131
|
return typeof value === 'object' && !Array.isArray(value);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
/**
|
|
135
|
-
* Converts an IClassNameCollection object to a string of class names.
|
|
136
|
-
* @param className - The IClassNameCollection object.
|
|
137
|
-
* @returns A string of class names.
|
|
134
|
+
/**
|
|
135
|
+
* Converts an IClassNameCollection object to a string of class names.
|
|
136
|
+
* @param className - The IClassNameCollection object.
|
|
137
|
+
* @returns A string of class names.
|
|
138
138
|
*/
|
|
139
139
|
function classNameCollectionToString(className) {
|
|
140
140
|
const keys = Object.keys(className);
|
|
@@ -151,10 +151,10 @@
|
|
|
151
151
|
return classNames;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
/**
|
|
155
|
-
* Combines multiple IClassName objects into a single string of class names.
|
|
156
|
-
* @param props - The IClassName objects to combine.
|
|
157
|
-
* @returns A string of class names.
|
|
154
|
+
/**
|
|
155
|
+
* Combines multiple IClassName objects into a single string of class names.
|
|
156
|
+
* @param props - The IClassName objects to combine.
|
|
157
|
+
* @returns A string of class names.
|
|
158
158
|
*/
|
|
159
159
|
function getClassNames() {
|
|
160
160
|
const total = arguments.length;
|
|
@@ -182,11 +182,11 @@
|
|
|
182
182
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
/**
|
|
186
|
-
* Retrieves the default locale.
|
|
187
|
-
* If the process environment variable DEFAULT_LOCALE is defined, it will be used as the default locale.
|
|
188
|
-
* Otherwise, the default locale will be set to 'en'.
|
|
189
|
-
* @returns The default locale.
|
|
185
|
+
/**
|
|
186
|
+
* Retrieves the default locale.
|
|
187
|
+
* If the process environment variable DEFAULT_LOCALE is defined, it will be used as the default locale.
|
|
188
|
+
* Otherwise, the default locale will be set to 'en'.
|
|
189
|
+
* @returns The default locale.
|
|
190
190
|
*/
|
|
191
191
|
function getDefaultLocale() {
|
|
192
192
|
let defaultLocale = 'en';
|
|
@@ -199,10 +199,10 @@
|
|
|
199
199
|
|
|
200
200
|
const DEFAULT_LOCALE = defaultLocale;
|
|
201
201
|
|
|
202
|
-
/**
|
|
203
|
-
* Checks if a value is a localized string.
|
|
204
|
-
* @param value - The value to check.
|
|
205
|
-
* @returns A boolean indicating whether the value is a localized string.
|
|
202
|
+
/**
|
|
203
|
+
* Checks if a value is a localized string.
|
|
204
|
+
* @param value - The value to check.
|
|
205
|
+
* @returns A boolean indicating whether the value is a localized string.
|
|
206
206
|
*/
|
|
207
207
|
function isLocalizedString(value) {
|
|
208
208
|
let isLocalizedString = false;
|
|
@@ -215,12 +215,12 @@
|
|
|
215
215
|
return isLocalizedString;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
/**
|
|
219
|
-
* Converts a localized string object to a string based on the specified locale.
|
|
220
|
-
* @param json - The localized string object.
|
|
221
|
-
* @param locale - The locale to use.
|
|
222
|
-
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
223
|
-
* @returns The localized string.
|
|
218
|
+
/**
|
|
219
|
+
* Converts a localized string object to a string based on the specified locale.
|
|
220
|
+
* @param json - The localized string object.
|
|
221
|
+
* @param locale - The locale to use.
|
|
222
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
223
|
+
* @returns The localized string.
|
|
224
224
|
*/
|
|
225
225
|
function localizedToString(json, locale, defaultLocale) {
|
|
226
226
|
if (defaultLocale === void 0) {
|
|
@@ -230,12 +230,12 @@
|
|
|
230
230
|
return localizedString;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
/**
|
|
234
|
-
* Localizes a value or an array/object of values based on the specified locale.
|
|
235
|
-
* @param value - The value or array/object of values to localize.
|
|
236
|
-
* @param locale - The locale to use.
|
|
237
|
-
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
238
|
-
* @returns The localized value or array/object of localized values.
|
|
233
|
+
/**
|
|
234
|
+
* Localizes a value or an array/object of values based on the specified locale.
|
|
235
|
+
* @param value - The value or array/object of values to localize.
|
|
236
|
+
* @param locale - The locale to use.
|
|
237
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
238
|
+
* @returns The localized value or array/object of localized values.
|
|
239
239
|
*/
|
|
240
240
|
function localizeValue(value, locale, defaultLocale) {
|
|
241
241
|
if (defaultLocale === void 0) {
|
|
@@ -250,12 +250,12 @@
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
/**
|
|
254
|
-
* Localizes an array/object of values based on the specified locale.
|
|
255
|
-
* @param item - The array/object of values to localize.
|
|
256
|
-
* @param locale - The locale to use.
|
|
257
|
-
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
258
|
-
* @returns The localized array/object of values.
|
|
253
|
+
/**
|
|
254
|
+
* Localizes an array/object of values based on the specified locale.
|
|
255
|
+
* @param item - The array/object of values to localize.
|
|
256
|
+
* @param locale - The locale to use.
|
|
257
|
+
* @param defaultLocale - The default locale to use if the specified locale is not found.
|
|
258
|
+
* @returns The localized array/object of values.
|
|
259
259
|
*/
|
|
260
260
|
function localizeItem(item, locale, defaultLocale) {
|
|
261
261
|
if (defaultLocale === void 0) {
|
|
@@ -8792,41 +8792,41 @@
|
|
|
8792
8792
|
}, locale);
|
|
8793
8793
|
}
|
|
8794
8794
|
|
|
8795
|
-
/*
|
|
8796
|
-
import { useMemo } from 'react';
|
|
8797
|
-
import { useNumber } from '../useNumber/useNumber';
|
|
8798
|
-
import { useLayout } from '../useLayout/useLayout';
|
|
8799
|
-
|
|
8800
|
-
export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
|
|
8801
|
-
const layout = useLayout();
|
|
8802
|
-
const currentLocale = locale || layout.locale;
|
|
8803
|
-
|
|
8804
|
-
const formatter = useMemo(() => {
|
|
8805
|
-
const options = { style: 'currency', currency };
|
|
8806
|
-
const formatter = new Intl.NumberFormat(currentLocale, options).format;
|
|
8807
|
-
return formatter;
|
|
8808
|
-
}, [currency, currentLocale]);
|
|
8809
|
-
|
|
8810
|
-
return formatter;
|
|
8811
|
-
}
|
|
8812
|
-
|
|
8795
|
+
/*
|
|
8796
|
+
import { useMemo } from 'react';
|
|
8797
|
+
import { useNumber } from '../useNumber/useNumber';
|
|
8798
|
+
import { useLayout } from '../useLayout/useLayout';
|
|
8799
|
+
|
|
8800
|
+
export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
|
|
8801
|
+
const layout = useLayout();
|
|
8802
|
+
const currentLocale = locale || layout.locale;
|
|
8803
|
+
|
|
8804
|
+
const formatter = useMemo(() => {
|
|
8805
|
+
const options = { style: 'currency', currency };
|
|
8806
|
+
const formatter = new Intl.NumberFormat(currentLocale, options).format;
|
|
8807
|
+
return formatter;
|
|
8808
|
+
}, [currency, currentLocale]);
|
|
8809
|
+
|
|
8810
|
+
return formatter;
|
|
8811
|
+
}
|
|
8812
|
+
|
|
8813
8813
|
*/
|
|
8814
8814
|
|
|
8815
|
-
/*
|
|
8816
|
-
|
|
8817
|
-
export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
|
|
8818
|
-
|
|
8819
|
-
const layout = useLayout();
|
|
8820
|
-
|
|
8821
|
-
const currentLocale = locale || layout.locale;
|
|
8822
|
-
|
|
8823
|
-
return useMemo(() => {
|
|
8824
|
-
const options = { style: 'currency', currency };
|
|
8825
|
-
const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
|
|
8826
|
-
return formattedValue;
|
|
8827
|
-
}, [value, currency, currentLocale]);
|
|
8828
|
-
}
|
|
8829
|
-
|
|
8815
|
+
/*
|
|
8816
|
+
|
|
8817
|
+
export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
|
|
8818
|
+
|
|
8819
|
+
const layout = useLayout();
|
|
8820
|
+
|
|
8821
|
+
const currentLocale = locale || layout.locale;
|
|
8822
|
+
|
|
8823
|
+
return useMemo(() => {
|
|
8824
|
+
const options = { style: 'currency', currency };
|
|
8825
|
+
const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
|
|
8826
|
+
return formattedValue;
|
|
8827
|
+
}, [value, currency, currentLocale]);
|
|
8828
|
+
}
|
|
8829
|
+
|
|
8830
8830
|
*/
|
|
8831
8831
|
|
|
8832
8832
|
function useDateTimeFormat(options, locale) {
|
|
@@ -8901,13 +8901,13 @@
|
|
|
8901
8901
|
return [state, setState];
|
|
8902
8902
|
}
|
|
8903
8903
|
|
|
8904
|
-
/**
|
|
8905
|
-
* KeyBinding Codes
|
|
8906
|
-
* The content of this file is based on the design of the open source project "microsoft/vscode",
|
|
8907
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8908
|
-
*
|
|
8909
|
-
* We inherit the KeyMod values from "microsoft/vscode",
|
|
8910
|
-
* but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
|
|
8904
|
+
/**
|
|
8905
|
+
* KeyBinding Codes
|
|
8906
|
+
* The content of this file is based on the design of the open source project "microsoft/vscode",
|
|
8907
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8908
|
+
*
|
|
8909
|
+
* We inherit the KeyMod values from "microsoft/vscode",
|
|
8910
|
+
* but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
|
|
8911
8911
|
*/
|
|
8912
8912
|
|
|
8913
8913
|
let KeyCode = /*#__PURE__*/function (KeyCode) {
|
|
@@ -9141,20 +9141,20 @@
|
|
|
9141
9141
|
});
|
|
9142
9142
|
}
|
|
9143
9143
|
|
|
9144
|
-
/*
|
|
9145
|
-
import { useCallback, useEffect, useRef } from 'react';
|
|
9146
|
-
|
|
9147
|
-
export function useMounted(): () => boolean {
|
|
9148
|
-
const ref = useRef<boolean>(false);
|
|
9149
|
-
const get = useCallback(() => ref.current, []);
|
|
9150
|
-
useEffect(() => {
|
|
9151
|
-
ref.current = true;
|
|
9152
|
-
return () => {
|
|
9153
|
-
ref.current = false;
|
|
9154
|
-
};
|
|
9155
|
-
}, []);
|
|
9156
|
-
return get;
|
|
9157
|
-
}
|
|
9144
|
+
/*
|
|
9145
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
9146
|
+
|
|
9147
|
+
export function useMounted(): () => boolean {
|
|
9148
|
+
const ref = useRef<boolean>(false);
|
|
9149
|
+
const get = useCallback(() => ref.current, []);
|
|
9150
|
+
useEffect(() => {
|
|
9151
|
+
ref.current = true;
|
|
9152
|
+
return () => {
|
|
9153
|
+
ref.current = false;
|
|
9154
|
+
};
|
|
9155
|
+
}, []);
|
|
9156
|
+
return get;
|
|
9157
|
+
}
|
|
9158
9158
|
*/
|
|
9159
9159
|
|
|
9160
9160
|
function useMounted() {
|
|
@@ -19869,6 +19869,27 @@
|
|
|
19869
19869
|
});
|
|
19870
19870
|
IconX.displayName = 'IconX';
|
|
19871
19871
|
|
|
19872
|
+
function pushDataLayer(record) {
|
|
19873
|
+
if (isBrowser$1) {
|
|
19874
|
+
window.dataLayer?.push(record);
|
|
19875
|
+
}
|
|
19876
|
+
}
|
|
19877
|
+
|
|
19878
|
+
const LLM_MINIMIZED_KEY = 'llm-minimized';
|
|
19879
|
+
function getPersistedMinimized() {
|
|
19880
|
+
try {
|
|
19881
|
+
return sessionStorage.getItem(LLM_MINIMIZED_KEY) === 'true';
|
|
19882
|
+
} catch {
|
|
19883
|
+
return false;
|
|
19884
|
+
}
|
|
19885
|
+
}
|
|
19886
|
+
function persistMinimized(minimized) {
|
|
19887
|
+
try {
|
|
19888
|
+
sessionStorage.setItem(LLM_MINIMIZED_KEY, String(minimized));
|
|
19889
|
+
} catch {
|
|
19890
|
+
// error
|
|
19891
|
+
}
|
|
19892
|
+
}
|
|
19872
19893
|
const createLlmViewStore = _ref => {
|
|
19873
19894
|
let {
|
|
19874
19895
|
threadId,
|
|
@@ -19899,6 +19920,7 @@
|
|
|
19899
19920
|
fixed: false,
|
|
19900
19921
|
idle: true,
|
|
19901
19922
|
visible: false,
|
|
19923
|
+
minimized: getPersistedMinimized(),
|
|
19902
19924
|
scrollable: false,
|
|
19903
19925
|
direction: 0
|
|
19904
19926
|
};
|
|
@@ -19974,13 +19996,13 @@
|
|
|
19974
19996
|
lastScrollTop = 0;
|
|
19975
19997
|
}
|
|
19976
19998
|
};
|
|
19977
|
-
/*
|
|
19978
|
-
if ('ResizeObserver' in window) {
|
|
19979
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
19980
|
-
onScroll();
|
|
19981
|
-
});
|
|
19982
|
-
resizeObserver.observe(document.scrollingElement as HTMLElement);
|
|
19983
|
-
}
|
|
19999
|
+
/*
|
|
20000
|
+
if ('ResizeObserver' in window) {
|
|
20001
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
20002
|
+
onScroll();
|
|
20003
|
+
});
|
|
20004
|
+
resizeObserver.observe(document.scrollingElement as HTMLElement);
|
|
20005
|
+
}
|
|
19984
20006
|
*/
|
|
19985
20007
|
window.addEventListener('scroll', onScroll);
|
|
19986
20008
|
window.addEventListener('resize', onResize);
|
|
@@ -20024,9 +20046,11 @@
|
|
|
20024
20046
|
},
|
|
20025
20047
|
send: async (prompt, onMessage, onEnd) => {
|
|
20026
20048
|
await send(prompt, () => {
|
|
20049
|
+
persistMinimized(false);
|
|
20027
20050
|
set({
|
|
20028
20051
|
skipCustomIntro: true,
|
|
20029
|
-
opened: true
|
|
20052
|
+
opened: true,
|
|
20053
|
+
minimized: false
|
|
20030
20054
|
});
|
|
20031
20055
|
setTimeout(() => {
|
|
20032
20056
|
}, 50);
|
|
@@ -20042,9 +20066,17 @@
|
|
|
20042
20066
|
},
|
|
20043
20067
|
open: () => {
|
|
20044
20068
|
setIdleTimeout();
|
|
20045
|
-
set(state =>
|
|
20046
|
-
opened
|
|
20047
|
-
|
|
20069
|
+
set(state => {
|
|
20070
|
+
const opened = !state.opened;
|
|
20071
|
+
pushDataLayer({
|
|
20072
|
+
event: opened ? 'llm_open' : 'llm_close'
|
|
20073
|
+
});
|
|
20074
|
+
persistMinimized(false);
|
|
20075
|
+
return {
|
|
20076
|
+
opened,
|
|
20077
|
+
minimized: false
|
|
20078
|
+
};
|
|
20079
|
+
});
|
|
20048
20080
|
},
|
|
20049
20081
|
isOpened: () => {
|
|
20050
20082
|
const {
|
|
@@ -20054,9 +20086,14 @@
|
|
|
20054
20086
|
},
|
|
20055
20087
|
setOpened: opened => {
|
|
20056
20088
|
setIdleTimeout();
|
|
20057
|
-
set(state =>
|
|
20058
|
-
|
|
20059
|
-
|
|
20089
|
+
set(state => {
|
|
20090
|
+
pushDataLayer({
|
|
20091
|
+
event: opened ? 'llm_open' : 'llm_close'
|
|
20092
|
+
});
|
|
20093
|
+
return {
|
|
20094
|
+
opened
|
|
20095
|
+
};
|
|
20096
|
+
});
|
|
20060
20097
|
},
|
|
20061
20098
|
setIntroed: introed => {
|
|
20062
20099
|
const state = get();
|
|
@@ -20065,6 +20102,12 @@
|
|
|
20065
20102
|
introed
|
|
20066
20103
|
}));
|
|
20067
20104
|
},
|
|
20105
|
+
setMinimized: minimized => {
|
|
20106
|
+
persistMinimized(minimized);
|
|
20107
|
+
set(state => ({
|
|
20108
|
+
minimized
|
|
20109
|
+
}));
|
|
20110
|
+
},
|
|
20068
20111
|
setVisible: visible => set(state => ({
|
|
20069
20112
|
visible
|
|
20070
20113
|
})),
|
|
@@ -23309,11 +23352,11 @@ void main(void) {
|
|
|
23309
23352
|
<img src="${href}"${title ? ` title="${title}"` : ''} alt="" />
|
|
23310
23353
|
</a>`;
|
|
23311
23354
|
}
|
|
23312
|
-
/*
|
|
23313
|
-
html(html: string, block?: boolean) {
|
|
23314
|
-
console.log('html', html);
|
|
23315
|
-
return html;
|
|
23316
|
-
},
|
|
23355
|
+
/*
|
|
23356
|
+
html(html: string, block?: boolean) {
|
|
23357
|
+
console.log('html', html);
|
|
23358
|
+
return html;
|
|
23359
|
+
},
|
|
23317
23360
|
*/
|
|
23318
23361
|
}
|
|
23319
23362
|
});
|
|
@@ -31929,12 +31972,12 @@ void main(void) {
|
|
|
31929
31972
|
return type.replace(/Item$/, '');
|
|
31930
31973
|
}
|
|
31931
31974
|
|
|
31932
|
-
/*
|
|
31933
|
-
export type LlmChunkImage = {
|
|
31934
|
-
type: 'image';
|
|
31935
|
-
id: string;
|
|
31936
|
-
src: string;
|
|
31937
|
-
};
|
|
31975
|
+
/*
|
|
31976
|
+
export type LlmChunkImage = {
|
|
31977
|
+
type: 'image';
|
|
31978
|
+
id: string;
|
|
31979
|
+
src: string;
|
|
31980
|
+
};
|
|
31938
31981
|
*/
|
|
31939
31982
|
|
|
31940
31983
|
// media
|
|
@@ -31957,11 +32000,11 @@ void main(void) {
|
|
|
31957
32000
|
|
|
31958
32001
|
// !!! todo move to bom-core
|
|
31959
32002
|
|
|
31960
|
-
/*
|
|
31961
|
-
export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
|
|
31962
|
-
type: LlmChunkUnknownItemType;
|
|
31963
|
-
id: IEquatable;
|
|
31964
|
-
};
|
|
32003
|
+
/*
|
|
32004
|
+
export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
|
|
32005
|
+
type: LlmChunkUnknownItemType;
|
|
32006
|
+
id: IEquatable;
|
|
32007
|
+
};
|
|
31965
32008
|
*/
|
|
31966
32009
|
|
|
31967
32010
|
// !!! todo
|
|
@@ -31970,55 +32013,55 @@ void main(void) {
|
|
|
31970
32013
|
// type StuctureMappedType<T extends LlmChunkType> = { [K in T]: Array<LlmChunkItem<K>> };
|
|
31971
32014
|
// export type LlmChunkItems<T extends LlmChunkType = LlmChunkType> = Record<T, (item: Extract<LlmChunkItem, { type: T }>) => string>;
|
|
31972
32015
|
|
|
31973
|
-
/*
|
|
31974
|
-
export type LlmThemeItem = Record<string, CSSProperties> & {
|
|
31975
|
-
[key: string]: string | boolean | number;
|
|
31976
|
-
};
|
|
31977
|
-
|
|
31978
|
-
export type LlmThemeTypography = Omit<CSSProperties, 'textTransform'> & {
|
|
31979
|
-
family?: CSSProperties['fontFamily'];
|
|
31980
|
-
size?: CSSProperties['fontSize'];
|
|
31981
|
-
weight?: CSSProperties['fontWeight'];
|
|
31982
|
-
fontSizeMin?: string;
|
|
31983
|
-
fontSizeMax?: string;
|
|
31984
|
-
textTransform?: string;
|
|
31985
|
-
};
|
|
31986
|
-
|
|
31987
|
-
export type LlmThemeColor = {
|
|
31988
|
-
[key: string]: CSSProperties['color'] | LlmThemeColor;
|
|
31989
|
-
};
|
|
31990
|
-
|
|
31991
|
-
export type LlmThemeProps = {
|
|
31992
|
-
mode?: string;
|
|
31993
|
-
scale?: number;
|
|
31994
|
-
font?: {
|
|
31995
|
-
primary: CSSProperties['fontFamily'];
|
|
31996
|
-
secondary: CSSProperties['fontFamily'];
|
|
31997
|
-
source: string;
|
|
31998
|
-
};
|
|
31999
|
-
typography?: Record<string, LlmThemeTypography>,
|
|
32000
|
-
color?: LlmThemeColor;
|
|
32001
|
-
canvas?: {
|
|
32002
|
-
opacity?: number;
|
|
32003
|
-
enabled?: boolean;
|
|
32004
|
-
};
|
|
32005
|
-
border?: CSSProperties['border'];
|
|
32006
|
-
toaster?: ToasterProps['theme'];
|
|
32007
|
-
};
|
|
32016
|
+
/*
|
|
32017
|
+
export type LlmThemeItem = Record<string, CSSProperties> & {
|
|
32018
|
+
[key: string]: string | boolean | number;
|
|
32019
|
+
};
|
|
32020
|
+
|
|
32021
|
+
export type LlmThemeTypography = Omit<CSSProperties, 'textTransform'> & {
|
|
32022
|
+
family?: CSSProperties['fontFamily'];
|
|
32023
|
+
size?: CSSProperties['fontSize'];
|
|
32024
|
+
weight?: CSSProperties['fontWeight'];
|
|
32025
|
+
fontSizeMin?: string;
|
|
32026
|
+
fontSizeMax?: string;
|
|
32027
|
+
textTransform?: string;
|
|
32028
|
+
};
|
|
32029
|
+
|
|
32030
|
+
export type LlmThemeColor = {
|
|
32031
|
+
[key: string]: CSSProperties['color'] | LlmThemeColor;
|
|
32032
|
+
};
|
|
32033
|
+
|
|
32034
|
+
export type LlmThemeProps = {
|
|
32035
|
+
mode?: string;
|
|
32036
|
+
scale?: number;
|
|
32037
|
+
font?: {
|
|
32038
|
+
primary: CSSProperties['fontFamily'];
|
|
32039
|
+
secondary: CSSProperties['fontFamily'];
|
|
32040
|
+
source: string;
|
|
32041
|
+
};
|
|
32042
|
+
typography?: Record<string, LlmThemeTypography>,
|
|
32043
|
+
color?: LlmThemeColor;
|
|
32044
|
+
canvas?: {
|
|
32045
|
+
opacity?: number;
|
|
32046
|
+
enabled?: boolean;
|
|
32047
|
+
};
|
|
32048
|
+
border?: CSSProperties['border'];
|
|
32049
|
+
toaster?: ToasterProps['theme'];
|
|
32050
|
+
};
|
|
32008
32051
|
*/
|
|
32009
32052
|
|
|
32010
|
-
/*
|
|
32011
|
-
export type LlmTheme = Omit<{
|
|
32012
|
-
[key: string]: LlmThemeItem | CSSProperties;
|
|
32013
|
-
}, keyof LlmThemeProps> & LlmThemeProps;
|
|
32053
|
+
/*
|
|
32054
|
+
export type LlmTheme = Omit<{
|
|
32055
|
+
[key: string]: LlmThemeItem | CSSProperties;
|
|
32056
|
+
}, keyof LlmThemeProps> & LlmThemeProps;
|
|
32014
32057
|
*/
|
|
32015
32058
|
|
|
32016
|
-
/*
|
|
32017
|
-
export type LlmThemeBase = {
|
|
32018
|
-
[key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
|
|
32019
|
-
};
|
|
32020
|
-
|
|
32021
|
-
export type LlmTheme = LlmThemeBase & LlmThemeProps;
|
|
32059
|
+
/*
|
|
32060
|
+
export type LlmThemeBase = {
|
|
32061
|
+
[key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
|
|
32062
|
+
};
|
|
32063
|
+
|
|
32064
|
+
export type LlmTheme = LlmThemeBase & LlmThemeProps;
|
|
32022
32065
|
*/
|
|
32023
32066
|
|
|
32024
32067
|
const LLM_DEFAULT_MIME_TYPES = '.jpg, .jpeg, .png, .svg, .webp, .txt, .md, .pdf, .csv, .doc, .xls, .ppt';
|
|
@@ -32253,14 +32296,14 @@ void main(void) {
|
|
|
32253
32296
|
const feedbackType = type || theme.feedback?.type || 'stars';
|
|
32254
32297
|
const classNames = getClassNames('llm__feedback', `llm__feedback--${feedbackType}`);
|
|
32255
32298
|
|
|
32256
|
-
/*
|
|
32257
|
-
const [feedbackRating, setFeedbackRating] = useState<number>();
|
|
32258
|
-
const onRating = async (event: ChangeEvent<HTMLInputElement>) => {
|
|
32259
|
-
console.log(event.currentTarget);
|
|
32260
|
-
const value = String(event.currentTarget.value);
|
|
32261
|
-
const rating = parseInt(value);
|
|
32262
|
-
setFeedbackRating(rating);
|
|
32263
|
-
};
|
|
32299
|
+
/*
|
|
32300
|
+
const [feedbackRating, setFeedbackRating] = useState<number>();
|
|
32301
|
+
const onRating = async (event: ChangeEvent<HTMLInputElement>) => {
|
|
32302
|
+
console.log(event.currentTarget);
|
|
32303
|
+
const value = String(event.currentTarget.value);
|
|
32304
|
+
const rating = parseInt(value);
|
|
32305
|
+
setFeedbackRating(rating);
|
|
32306
|
+
};
|
|
32264
32307
|
*/
|
|
32265
32308
|
|
|
32266
32309
|
const onSubmit = async event => {
|
|
@@ -32397,8 +32440,8 @@ void main(void) {
|
|
|
32397
32440
|
});
|
|
32398
32441
|
};
|
|
32399
32442
|
|
|
32400
|
-
/*
|
|
32401
|
-
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
32443
|
+
/*
|
|
32444
|
+
<link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
32402
32445
|
*/
|
|
32403
32446
|
const Font = () => {
|
|
32404
32447
|
const theme = useLlm(state => state.theme);
|
|
@@ -32868,6 +32911,10 @@ void main(void) {
|
|
|
32868
32911
|
wrapper
|
|
32869
32912
|
} = _ref;
|
|
32870
32913
|
const label = useLabel();
|
|
32914
|
+
const streaming = useLlm(state => state.streaming);
|
|
32915
|
+
const {
|
|
32916
|
+
clear
|
|
32917
|
+
} = useLlm(state => state.actions);
|
|
32871
32918
|
const {
|
|
32872
32919
|
send
|
|
32873
32920
|
} = useLlmView(state => state.actions);
|
|
@@ -32875,7 +32922,8 @@ void main(void) {
|
|
|
32875
32922
|
setWrapper
|
|
32876
32923
|
} = useActions();
|
|
32877
32924
|
const onAction = async action => {
|
|
32878
|
-
const prompt = action.message ||
|
|
32925
|
+
const prompt = action.message || action.label;
|
|
32926
|
+
clear();
|
|
32879
32927
|
await send(prompt, response => {
|
|
32880
32928
|
// console.log('PageActions.onChunk', response.chunks);
|
|
32881
32929
|
}, response => {
|
|
@@ -32893,7 +32941,11 @@ void main(void) {
|
|
|
32893
32941
|
}), wrapper.actions.map(x => /*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
32894
32942
|
type: "button",
|
|
32895
32943
|
className: getClassNames(style$h.action),
|
|
32896
|
-
|
|
32944
|
+
disabled: streaming,
|
|
32945
|
+
onClick: e => {
|
|
32946
|
+
e.stopPropagation();
|
|
32947
|
+
onAction(x);
|
|
32948
|
+
},
|
|
32897
32949
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(ActionIcon, {
|
|
32898
32950
|
action: x
|
|
32899
32951
|
}), /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
@@ -40808,6 +40860,9 @@ void main(void) {
|
|
|
40808
40860
|
removeHistory
|
|
40809
40861
|
} = useLlm(state => state.actions);
|
|
40810
40862
|
// console.log('item', item);
|
|
40863
|
+
if (!item.user) {
|
|
40864
|
+
return;
|
|
40865
|
+
}
|
|
40811
40866
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
40812
40867
|
className: getClassNames(style$e.history),
|
|
40813
40868
|
onClick: () => setHistory(item),
|
|
@@ -41325,7 +41380,11 @@ void main(void) {
|
|
|
41325
41380
|
const PageSubmit = () => {
|
|
41326
41381
|
const label = useLabel();
|
|
41327
41382
|
useLlm(state => state.components);
|
|
41383
|
+
const streaming = useLlm(state => state.streaming);
|
|
41328
41384
|
const prompt = useLlm(state => state.prompt);
|
|
41385
|
+
const {
|
|
41386
|
+
clear
|
|
41387
|
+
} = useLlm(state => state.actions);
|
|
41329
41388
|
const {
|
|
41330
41389
|
send
|
|
41331
41390
|
} = useLlmView(state => state.actions);
|
|
@@ -41334,6 +41393,7 @@ void main(void) {
|
|
|
41334
41393
|
if (!prompt) {
|
|
41335
41394
|
return;
|
|
41336
41395
|
}
|
|
41396
|
+
clear();
|
|
41337
41397
|
await send(prompt, response => {
|
|
41338
41398
|
// console.log('PagePrompt.onChunk', response.chunks);
|
|
41339
41399
|
}, response => {
|
|
@@ -41343,7 +41403,7 @@ void main(void) {
|
|
|
41343
41403
|
return /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
41344
41404
|
type: "submit",
|
|
41345
41405
|
className: getClassNames(style$5.submit),
|
|
41346
|
-
|
|
41406
|
+
disabled: !prompt || streaming,
|
|
41347
41407
|
"aria-label": label('llm.sendPrompt'),
|
|
41348
41408
|
onClick: onSubmit,
|
|
41349
41409
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconLlmArrowUp, {})
|
|
@@ -41388,7 +41448,8 @@ void main(void) {
|
|
|
41388
41448
|
const prompt = useLlm(state => state.prompt);
|
|
41389
41449
|
const streaming = useLlm(state => state.streaming);
|
|
41390
41450
|
const {
|
|
41391
|
-
setPrompt
|
|
41451
|
+
setPrompt,
|
|
41452
|
+
clear
|
|
41392
41453
|
} = useLlm(state => state.actions);
|
|
41393
41454
|
const {
|
|
41394
41455
|
send
|
|
@@ -41399,6 +41460,7 @@ void main(void) {
|
|
|
41399
41460
|
if (!prompt) {
|
|
41400
41461
|
return;
|
|
41401
41462
|
}
|
|
41463
|
+
clear();
|
|
41402
41464
|
await send(prompt, response => {
|
|
41403
41465
|
// console.log('PagePrompt.onChunk', response.chunks);
|
|
41404
41466
|
}, response => {
|
|
@@ -41410,7 +41472,7 @@ void main(void) {
|
|
|
41410
41472
|
setPrompt(prompt);
|
|
41411
41473
|
};
|
|
41412
41474
|
const onKeyDown = event => {
|
|
41413
|
-
if (event.code == 'Enter' && !event.shiftKey) {
|
|
41475
|
+
if (event.code == 'Enter' && !event.shiftKey && !streaming) {
|
|
41414
41476
|
onSubmit(event);
|
|
41415
41477
|
}
|
|
41416
41478
|
};
|
|
@@ -41462,10 +41524,10 @@ void main(void) {
|
|
|
41462
41524
|
window.scrollTo({
|
|
41463
41525
|
top: 0
|
|
41464
41526
|
});
|
|
41465
|
-
/*
|
|
41466
|
-
if (ref.current) {
|
|
41467
|
-
ref.current.scrollIntoView();
|
|
41468
|
-
}
|
|
41527
|
+
/*
|
|
41528
|
+
if (ref.current) {
|
|
41529
|
+
ref.current.scrollIntoView();
|
|
41530
|
+
}
|
|
41469
41531
|
*/
|
|
41470
41532
|
}, [message, hasValidChunks]);
|
|
41471
41533
|
const classNames = getClassNames(style$2.thread);
|
|
@@ -41943,15 +42005,15 @@ void main(void) {
|
|
|
41943
42005
|
}
|
|
41944
42006
|
},
|
|
41945
42007
|
start: () => {
|
|
41946
|
-
/*
|
|
41947
|
-
if (innerRef.current) {
|
|
41948
|
-
}
|
|
42008
|
+
/*
|
|
42009
|
+
if (innerRef.current) {
|
|
42010
|
+
}
|
|
41949
42011
|
*/
|
|
41950
42012
|
},
|
|
41951
42013
|
stop: () => {
|
|
41952
|
-
/*
|
|
41953
|
-
if (innerRef.current) {
|
|
41954
|
-
}
|
|
42014
|
+
/*
|
|
42015
|
+
if (innerRef.current) {
|
|
42016
|
+
}
|
|
41955
42017
|
*/
|
|
41956
42018
|
}
|
|
41957
42019
|
});
|
|
@@ -42140,30 +42202,30 @@ void main(void) {
|
|
|
42140
42202
|
});
|
|
42141
42203
|
};
|
|
42142
42204
|
|
|
42143
|
-
/*
|
|
42144
|
-
|
|
42145
|
-
const swiperProps = {
|
|
42146
|
-
modules: [FreeMode],
|
|
42147
|
-
spaceBetween: 8,
|
|
42148
|
-
freeMode: true,
|
|
42149
|
-
slidesPerView: 'auto' as const,
|
|
42150
|
-
slidesOffsetAfter: clamp(20, 110),
|
|
42151
|
-
slidesOffsetBefore: clamp(20, 110),
|
|
42152
|
-
};
|
|
42153
|
-
|
|
42154
|
-
<section className="llm__prompt-suggestions">
|
|
42155
|
-
<div className="llm__suggestions">
|
|
42156
|
-
<Swiper {...swiperProps} onInit={swiper => swiper.update()}>
|
|
42157
|
-
{app?.contents.sampleInputTexts?.map((s, j) => (
|
|
42158
|
-
<SwiperSlide key={j}>
|
|
42159
|
-
<button type="button" className="llm__pill" onClick={() => onClick(s)}>
|
|
42160
|
-
{s.sampleInputText}
|
|
42161
|
-
</button>
|
|
42162
|
-
</SwiperSlide>
|
|
42163
|
-
))}
|
|
42164
|
-
</Swiper>
|
|
42165
|
-
</div>
|
|
42166
|
-
</section>
|
|
42205
|
+
/*
|
|
42206
|
+
|
|
42207
|
+
const swiperProps = {
|
|
42208
|
+
modules: [FreeMode],
|
|
42209
|
+
spaceBetween: 8,
|
|
42210
|
+
freeMode: true,
|
|
42211
|
+
slidesPerView: 'auto' as const,
|
|
42212
|
+
slidesOffsetAfter: clamp(20, 110),
|
|
42213
|
+
slidesOffsetBefore: clamp(20, 110),
|
|
42214
|
+
};
|
|
42215
|
+
|
|
42216
|
+
<section className="llm__prompt-suggestions">
|
|
42217
|
+
<div className="llm__suggestions">
|
|
42218
|
+
<Swiper {...swiperProps} onInit={swiper => swiper.update()}>
|
|
42219
|
+
{app?.contents.sampleInputTexts?.map((s, j) => (
|
|
42220
|
+
<SwiperSlide key={j}>
|
|
42221
|
+
<button type="button" className="llm__pill" onClick={() => onClick(s)}>
|
|
42222
|
+
{s.sampleInputText}
|
|
42223
|
+
</button>
|
|
42224
|
+
</SwiperSlide>
|
|
42225
|
+
))}
|
|
42226
|
+
</Swiper>
|
|
42227
|
+
</div>
|
|
42228
|
+
</section>
|
|
42167
42229
|
*/
|
|
42168
42230
|
|
|
42169
42231
|
const Thread = () => {
|
|
@@ -42199,6 +42261,32 @@ void main(void) {
|
|
|
42199
42261
|
});
|
|
42200
42262
|
};
|
|
42201
42263
|
|
|
42264
|
+
const MinimizeButton = _ref => {
|
|
42265
|
+
let {
|
|
42266
|
+
onClick,
|
|
42267
|
+
label
|
|
42268
|
+
} = _ref;
|
|
42269
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
42270
|
+
type: "button",
|
|
42271
|
+
className: "llm__trigger-minimize",
|
|
42272
|
+
onClick: onClick,
|
|
42273
|
+
"aria-label": label,
|
|
42274
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx("svg", {
|
|
42275
|
+
width: "16",
|
|
42276
|
+
height: "16",
|
|
42277
|
+
viewBox: "0 0 16 16",
|
|
42278
|
+
fill: "none",
|
|
42279
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42280
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx("path", {
|
|
42281
|
+
d: "M4 6L8 10L12 6",
|
|
42282
|
+
stroke: "currentColor",
|
|
42283
|
+
strokeWidth: "1.5",
|
|
42284
|
+
strokeLinecap: "round",
|
|
42285
|
+
strokeLinejoin: "round"
|
|
42286
|
+
})
|
|
42287
|
+
})
|
|
42288
|
+
});
|
|
42289
|
+
};
|
|
42202
42290
|
const Trigger = () => {
|
|
42203
42291
|
const theme = useLlm(state => state.theme);
|
|
42204
42292
|
const {
|
|
@@ -42206,16 +42294,21 @@ void main(void) {
|
|
|
42206
42294
|
} = useLlm(state => state.components);
|
|
42207
42295
|
const app = useLlm(state => state.app);
|
|
42208
42296
|
const opened = useLlmView(state => state.opened);
|
|
42297
|
+
const minimized = useLlmView(state => state.minimized);
|
|
42209
42298
|
const {
|
|
42210
|
-
open
|
|
42299
|
+
open,
|
|
42300
|
+
setMinimized
|
|
42211
42301
|
} = useLlmView(state => state.actions);
|
|
42212
42302
|
const label = useLabel();
|
|
42303
|
+
const enableMinimize = app?.contents.enableMinimize;
|
|
42213
42304
|
const collapsedWelcomeText = messageMapper(app?.contents.collapsedWelcomeText);
|
|
42214
42305
|
const collapsedWelcomeTextCta = messageMapper(app?.contents.collapsedWelcomeTextCta);
|
|
42215
42306
|
const collapsedWelcomeTextHover = messageMapper(app?.contents.collapsedWelcomeTextHover);
|
|
42216
42307
|
const position = theme.trigger?.position || 'bottom';
|
|
42217
42308
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(motion.nav, {
|
|
42218
|
-
className: getClassNames('llm__trigger', '-' + position
|
|
42309
|
+
className: getClassNames('llm__trigger', '-' + position, {
|
|
42310
|
+
'-minimized': minimized
|
|
42311
|
+
}),
|
|
42219
42312
|
initial: {
|
|
42220
42313
|
y: '200%',
|
|
42221
42314
|
opacity: 0
|
|
@@ -42229,12 +42322,12 @@ void main(void) {
|
|
|
42229
42322
|
opacity: 0
|
|
42230
42323
|
},
|
|
42231
42324
|
transition: {
|
|
42232
|
-
duration: .4
|
|
42325
|
+
duration: 0.4
|
|
42233
42326
|
},
|
|
42234
42327
|
"aria-label": "Trigger"
|
|
42235
|
-
/*
|
|
42236
|
-
aria-expanded={opened}
|
|
42237
|
-
aria-controls={mainId}
|
|
42328
|
+
/*
|
|
42329
|
+
aria-expanded={opened}
|
|
42330
|
+
aria-controls={mainId}
|
|
42238
42331
|
*/,
|
|
42239
42332
|
onClick: () => open(),
|
|
42240
42333
|
children: [/*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
@@ -42245,14 +42338,20 @@ void main(void) {
|
|
|
42245
42338
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Blob, {}), /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
42246
42339
|
children: label('llm.button')
|
|
42247
42340
|
})]
|
|
42248
|
-
}), !opened && (collapsedWelcomeText || collapsedWelcomeTextCta || collapsedWelcomeTextHover) && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
42341
|
+
}), !opened && !minimized && (collapsedWelcomeText || collapsedWelcomeTextCta || collapsedWelcomeTextHover) && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
42249
42342
|
className: "llm__trigger-popup -llm-t-body2",
|
|
42250
42343
|
children: [(collapsedWelcomeText || collapsedWelcomeTextCta) && /*#__PURE__*/jsxRuntimeExports.jsxs(motion.div, {
|
|
42251
42344
|
className: "llm__trigger-message",
|
|
42252
42345
|
exit: {
|
|
42253
42346
|
opacity: 0
|
|
42254
42347
|
},
|
|
42255
|
-
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Canvas, {}), collapsedWelcomeText,
|
|
42348
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Canvas, {}), collapsedWelcomeText, enableMinimize && /*#__PURE__*/jsxRuntimeExports.jsx(MinimizeButton, {
|
|
42349
|
+
onClick: e => {
|
|
42350
|
+
e.stopPropagation();
|
|
42351
|
+
setMinimized(true);
|
|
42352
|
+
},
|
|
42353
|
+
label: label('llm.minimize') || 'Minimize'
|
|
42354
|
+
}), collapsedWelcomeTextCta && /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
42256
42355
|
type: "button",
|
|
42257
42356
|
className: "llm__trigger-cta",
|
|
42258
42357
|
children: collapsedWelcomeTextCta
|
|
@@ -43415,13 +43514,13 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
43415
43514
|
decodeMessages(messages) {
|
|
43416
43515
|
return messages.map(x => {
|
|
43417
43516
|
if (Array.isArray(x.content)) {
|
|
43418
|
-
/*
|
|
43419
|
-
if (x.role === 'user') {
|
|
43420
|
-
return ({
|
|
43421
|
-
...x,
|
|
43422
|
-
chunks: x.content.map(x => this.decodeChunk(x)),
|
|
43423
|
-
});
|
|
43424
|
-
}
|
|
43517
|
+
/*
|
|
43518
|
+
if (x.role === 'user') {
|
|
43519
|
+
return ({
|
|
43520
|
+
...x,
|
|
43521
|
+
chunks: x.content.map(x => this.decodeChunk(x)),
|
|
43522
|
+
});
|
|
43523
|
+
}
|
|
43425
43524
|
*/
|
|
43426
43525
|
return {
|
|
43427
43526
|
...x,
|
|
@@ -43662,163 +43761,163 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
43662
43761
|
return chunkItems;
|
|
43663
43762
|
}
|
|
43664
43763
|
|
|
43665
|
-
/*
|
|
43666
|
-
chunksToChunkItems___(chunks: LlmChunk[], response?: StreamResponse): LlmChunkItem[] {
|
|
43667
|
-
const chunkItems: LlmChunkItem[] = [];
|
|
43668
|
-
chunks.forEach(x => {
|
|
43669
|
-
const chunk: LlmChunkItem = typeof x === 'string' ? { type: 'text', text: x } : x;
|
|
43670
|
-
const lastMessage = chunkItems[chunkItems.length - 1];
|
|
43671
|
-
switch (chunk.type) {
|
|
43672
|
-
case 'text':
|
|
43673
|
-
if (lastMessage && isChunkText(lastMessage)) {
|
|
43674
|
-
const text = chunk.text;
|
|
43675
|
-
const lastChunkText = lastMessage;
|
|
43676
|
-
if (chunkItems.indexOf(lastChunkText) > 0) {
|
|
43677
|
-
// secondary chunk
|
|
43678
|
-
lastChunkText.text += text;
|
|
43679
|
-
} else if (!lastChunkText.text.includes('\n')) {
|
|
43680
|
-
// uncompleted first chunk
|
|
43681
|
-
if (text.includes('\n')) {
|
|
43682
|
-
const lines = text.split('\n');
|
|
43683
|
-
lines.forEach((line, i) => {
|
|
43684
|
-
const lastChar = (lines.length > i + 1) ? '\n' : '';
|
|
43685
|
-
if (i === 0) {
|
|
43686
|
-
lastChunkText.text += line + lastChar;
|
|
43687
|
-
} else if (line.length > 0) {
|
|
43688
|
-
chunkItems.push({
|
|
43689
|
-
type: 'text',
|
|
43690
|
-
text: line + lastChar,
|
|
43691
|
-
});
|
|
43692
|
-
}
|
|
43693
|
-
});
|
|
43694
|
-
} else {
|
|
43695
|
-
// uncompleted first chunk
|
|
43696
|
-
lastChunkText.text += text;
|
|
43697
|
-
}
|
|
43698
|
-
} else {
|
|
43699
|
-
// completed first chunk
|
|
43700
|
-
chunkItems.push(chunk);
|
|
43701
|
-
}
|
|
43702
|
-
} else {
|
|
43703
|
-
// new text chunk
|
|
43704
|
-
chunkItems.push(chunk);
|
|
43705
|
-
}
|
|
43706
|
-
break;
|
|
43707
|
-
case 'log':
|
|
43708
|
-
break;
|
|
43709
|
-
case 'error':
|
|
43710
|
-
chunkItems.push(chunk);
|
|
43711
|
-
break;
|
|
43712
|
-
case 'header': {
|
|
43713
|
-
const { type, ...rest } = chunk;
|
|
43714
|
-
if (response) {
|
|
43715
|
-
Object.assign(response, rest);
|
|
43716
|
-
}
|
|
43717
|
-
// console.log('header', response);
|
|
43718
|
-
}
|
|
43719
|
-
break;
|
|
43720
|
-
case 'info': {
|
|
43721
|
-
if (response) {
|
|
43722
|
-
// !!! deprecated
|
|
43723
|
-
response.threadId = chunk.threadId || response.threadId;
|
|
43724
|
-
}
|
|
43725
|
-
}
|
|
43726
|
-
break;
|
|
43727
|
-
case 'end':
|
|
43728
|
-
break;
|
|
43729
|
-
case 'action':
|
|
43730
|
-
case 'actionItem':
|
|
43731
|
-
if (lastMessage && lastMessage.type === 'actionGroup') {
|
|
43732
|
-
lastMessage.items.push(chunk);
|
|
43733
|
-
} else {
|
|
43734
|
-
chunkItems.push({
|
|
43735
|
-
type: 'actionGroup',
|
|
43736
|
-
items: [chunk],
|
|
43737
|
-
});
|
|
43738
|
-
}
|
|
43739
|
-
break;
|
|
43740
|
-
case 'cardItem':
|
|
43741
|
-
if (lastMessage && lastMessage.type === 'cardGroup') {
|
|
43742
|
-
lastMessage.items.push(chunk);
|
|
43743
|
-
} else {
|
|
43744
|
-
chunkItems.push({
|
|
43745
|
-
type: 'cardGroup',
|
|
43746
|
-
items: [chunk],
|
|
43747
|
-
});
|
|
43748
|
-
}
|
|
43749
|
-
break;
|
|
43750
|
-
case 'productItem':
|
|
43751
|
-
if (lastMessage && lastMessage.type === 'productGroup') {
|
|
43752
|
-
lastMessage.items.push(chunk);
|
|
43753
|
-
} else {
|
|
43754
|
-
chunkItems.push({
|
|
43755
|
-
type: 'productGroup',
|
|
43756
|
-
items: [chunk],
|
|
43757
|
-
});
|
|
43758
|
-
}
|
|
43759
|
-
break;
|
|
43760
|
-
case 'eventItem':
|
|
43761
|
-
if (lastMessage && lastMessage.type === 'eventGroup') {
|
|
43762
|
-
lastMessage.items.push(chunk);
|
|
43763
|
-
} else {
|
|
43764
|
-
chunkItems.push({
|
|
43765
|
-
type: 'eventGroup',
|
|
43766
|
-
items: [chunk],
|
|
43767
|
-
});
|
|
43768
|
-
}
|
|
43769
|
-
break;
|
|
43770
|
-
case 'poiItem':
|
|
43771
|
-
if (lastMessage && lastMessage.type === 'poiGroup') {
|
|
43772
|
-
lastMessage.items.push(chunk);
|
|
43773
|
-
} else {
|
|
43774
|
-
chunkItems.push({
|
|
43775
|
-
type: 'poiGroup',
|
|
43776
|
-
items: [chunk],
|
|
43777
|
-
});
|
|
43778
|
-
}
|
|
43779
|
-
break;
|
|
43780
|
-
case 'tripadvisor':
|
|
43781
|
-
case 'tripadvisorItem':
|
|
43782
|
-
if (lastMessage && lastMessage.type === 'tripadvisorGroup') {
|
|
43783
|
-
lastMessage.items.push({
|
|
43784
|
-
...chunk,
|
|
43785
|
-
type: 'tripadvisorItem',
|
|
43786
|
-
});
|
|
43787
|
-
} else {
|
|
43788
|
-
chunkItems.push({
|
|
43789
|
-
type: 'tripadvisorGroup',
|
|
43790
|
-
items: [{
|
|
43791
|
-
...chunk,
|
|
43792
|
-
type: 'tripadvisorItem',
|
|
43793
|
-
}],
|
|
43794
|
-
});
|
|
43795
|
-
}
|
|
43796
|
-
break;
|
|
43797
|
-
default:
|
|
43798
|
-
if (
|
|
43799
|
-
typeof chunk.type === 'string' &&
|
|
43800
|
-
chunk.type.match(/Item$/)
|
|
43801
|
-
) {
|
|
43802
|
-
const baseName = chunk.type.replace('Item', '');
|
|
43803
|
-
const groupName = `${baseName}Group`;
|
|
43804
|
-
if (lastMessage && lastMessage.type === groupName) {
|
|
43805
|
-
(lastMessage as { items: (typeof x)[] }).items.push(x);
|
|
43806
|
-
} else {
|
|
43807
|
-
chunkItems.push({
|
|
43808
|
-
type: groupName,
|
|
43809
|
-
items: [{
|
|
43810
|
-
...chunk,
|
|
43811
|
-
type: baseName,
|
|
43812
|
-
}],
|
|
43813
|
-
} as unknown as LlmChunkUnknownItem);
|
|
43814
|
-
}
|
|
43815
|
-
} else {
|
|
43816
|
-
chunkItems.push(chunk);
|
|
43817
|
-
}
|
|
43818
|
-
}
|
|
43819
|
-
});
|
|
43820
|
-
return chunkItems;
|
|
43821
|
-
}
|
|
43764
|
+
/*
|
|
43765
|
+
chunksToChunkItems___(chunks: LlmChunk[], response?: StreamResponse): LlmChunkItem[] {
|
|
43766
|
+
const chunkItems: LlmChunkItem[] = [];
|
|
43767
|
+
chunks.forEach(x => {
|
|
43768
|
+
const chunk: LlmChunkItem = typeof x === 'string' ? { type: 'text', text: x } : x;
|
|
43769
|
+
const lastMessage = chunkItems[chunkItems.length - 1];
|
|
43770
|
+
switch (chunk.type) {
|
|
43771
|
+
case 'text':
|
|
43772
|
+
if (lastMessage && isChunkText(lastMessage)) {
|
|
43773
|
+
const text = chunk.text;
|
|
43774
|
+
const lastChunkText = lastMessage;
|
|
43775
|
+
if (chunkItems.indexOf(lastChunkText) > 0) {
|
|
43776
|
+
// secondary chunk
|
|
43777
|
+
lastChunkText.text += text;
|
|
43778
|
+
} else if (!lastChunkText.text.includes('\n')) {
|
|
43779
|
+
// uncompleted first chunk
|
|
43780
|
+
if (text.includes('\n')) {
|
|
43781
|
+
const lines = text.split('\n');
|
|
43782
|
+
lines.forEach((line, i) => {
|
|
43783
|
+
const lastChar = (lines.length > i + 1) ? '\n' : '';
|
|
43784
|
+
if (i === 0) {
|
|
43785
|
+
lastChunkText.text += line + lastChar;
|
|
43786
|
+
} else if (line.length > 0) {
|
|
43787
|
+
chunkItems.push({
|
|
43788
|
+
type: 'text',
|
|
43789
|
+
text: line + lastChar,
|
|
43790
|
+
});
|
|
43791
|
+
}
|
|
43792
|
+
});
|
|
43793
|
+
} else {
|
|
43794
|
+
// uncompleted first chunk
|
|
43795
|
+
lastChunkText.text += text;
|
|
43796
|
+
}
|
|
43797
|
+
} else {
|
|
43798
|
+
// completed first chunk
|
|
43799
|
+
chunkItems.push(chunk);
|
|
43800
|
+
}
|
|
43801
|
+
} else {
|
|
43802
|
+
// new text chunk
|
|
43803
|
+
chunkItems.push(chunk);
|
|
43804
|
+
}
|
|
43805
|
+
break;
|
|
43806
|
+
case 'log':
|
|
43807
|
+
break;
|
|
43808
|
+
case 'error':
|
|
43809
|
+
chunkItems.push(chunk);
|
|
43810
|
+
break;
|
|
43811
|
+
case 'header': {
|
|
43812
|
+
const { type, ...rest } = chunk;
|
|
43813
|
+
if (response) {
|
|
43814
|
+
Object.assign(response, rest);
|
|
43815
|
+
}
|
|
43816
|
+
// console.log('header', response);
|
|
43817
|
+
}
|
|
43818
|
+
break;
|
|
43819
|
+
case 'info': {
|
|
43820
|
+
if (response) {
|
|
43821
|
+
// !!! deprecated
|
|
43822
|
+
response.threadId = chunk.threadId || response.threadId;
|
|
43823
|
+
}
|
|
43824
|
+
}
|
|
43825
|
+
break;
|
|
43826
|
+
case 'end':
|
|
43827
|
+
break;
|
|
43828
|
+
case 'action':
|
|
43829
|
+
case 'actionItem':
|
|
43830
|
+
if (lastMessage && lastMessage.type === 'actionGroup') {
|
|
43831
|
+
lastMessage.items.push(chunk);
|
|
43832
|
+
} else {
|
|
43833
|
+
chunkItems.push({
|
|
43834
|
+
type: 'actionGroup',
|
|
43835
|
+
items: [chunk],
|
|
43836
|
+
});
|
|
43837
|
+
}
|
|
43838
|
+
break;
|
|
43839
|
+
case 'cardItem':
|
|
43840
|
+
if (lastMessage && lastMessage.type === 'cardGroup') {
|
|
43841
|
+
lastMessage.items.push(chunk);
|
|
43842
|
+
} else {
|
|
43843
|
+
chunkItems.push({
|
|
43844
|
+
type: 'cardGroup',
|
|
43845
|
+
items: [chunk],
|
|
43846
|
+
});
|
|
43847
|
+
}
|
|
43848
|
+
break;
|
|
43849
|
+
case 'productItem':
|
|
43850
|
+
if (lastMessage && lastMessage.type === 'productGroup') {
|
|
43851
|
+
lastMessage.items.push(chunk);
|
|
43852
|
+
} else {
|
|
43853
|
+
chunkItems.push({
|
|
43854
|
+
type: 'productGroup',
|
|
43855
|
+
items: [chunk],
|
|
43856
|
+
});
|
|
43857
|
+
}
|
|
43858
|
+
break;
|
|
43859
|
+
case 'eventItem':
|
|
43860
|
+
if (lastMessage && lastMessage.type === 'eventGroup') {
|
|
43861
|
+
lastMessage.items.push(chunk);
|
|
43862
|
+
} else {
|
|
43863
|
+
chunkItems.push({
|
|
43864
|
+
type: 'eventGroup',
|
|
43865
|
+
items: [chunk],
|
|
43866
|
+
});
|
|
43867
|
+
}
|
|
43868
|
+
break;
|
|
43869
|
+
case 'poiItem':
|
|
43870
|
+
if (lastMessage && lastMessage.type === 'poiGroup') {
|
|
43871
|
+
lastMessage.items.push(chunk);
|
|
43872
|
+
} else {
|
|
43873
|
+
chunkItems.push({
|
|
43874
|
+
type: 'poiGroup',
|
|
43875
|
+
items: [chunk],
|
|
43876
|
+
});
|
|
43877
|
+
}
|
|
43878
|
+
break;
|
|
43879
|
+
case 'tripadvisor':
|
|
43880
|
+
case 'tripadvisorItem':
|
|
43881
|
+
if (lastMessage && lastMessage.type === 'tripadvisorGroup') {
|
|
43882
|
+
lastMessage.items.push({
|
|
43883
|
+
...chunk,
|
|
43884
|
+
type: 'tripadvisorItem',
|
|
43885
|
+
});
|
|
43886
|
+
} else {
|
|
43887
|
+
chunkItems.push({
|
|
43888
|
+
type: 'tripadvisorGroup',
|
|
43889
|
+
items: [{
|
|
43890
|
+
...chunk,
|
|
43891
|
+
type: 'tripadvisorItem',
|
|
43892
|
+
}],
|
|
43893
|
+
});
|
|
43894
|
+
}
|
|
43895
|
+
break;
|
|
43896
|
+
default:
|
|
43897
|
+
if (
|
|
43898
|
+
typeof chunk.type === 'string' &&
|
|
43899
|
+
chunk.type.match(/Item$/)
|
|
43900
|
+
) {
|
|
43901
|
+
const baseName = chunk.type.replace('Item', '');
|
|
43902
|
+
const groupName = `${baseName}Group`;
|
|
43903
|
+
if (lastMessage && lastMessage.type === groupName) {
|
|
43904
|
+
(lastMessage as { items: (typeof x)[] }).items.push(x);
|
|
43905
|
+
} else {
|
|
43906
|
+
chunkItems.push({
|
|
43907
|
+
type: groupName,
|
|
43908
|
+
items: [{
|
|
43909
|
+
...chunk,
|
|
43910
|
+
type: baseName,
|
|
43911
|
+
}],
|
|
43912
|
+
} as unknown as LlmChunkUnknownItem);
|
|
43913
|
+
}
|
|
43914
|
+
} else {
|
|
43915
|
+
chunkItems.push(chunk);
|
|
43916
|
+
}
|
|
43917
|
+
}
|
|
43918
|
+
});
|
|
43919
|
+
return chunkItems;
|
|
43920
|
+
}
|
|
43822
43921
|
*/
|
|
43823
43922
|
|
|
43824
43923
|
static decodeThread(thread) {
|
|
@@ -43973,10 +44072,10 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
43973
44072
|
return;
|
|
43974
44073
|
}
|
|
43975
44074
|
const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
|
|
43976
|
-
/*
|
|
43977
|
-
if (error instanceof TypeError) {
|
|
43978
|
-
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
43979
|
-
}
|
|
44075
|
+
/*
|
|
44076
|
+
if (error instanceof TypeError) {
|
|
44077
|
+
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44078
|
+
}
|
|
43980
44079
|
*/
|
|
43981
44080
|
if (typeof onEnd === 'function') {
|
|
43982
44081
|
const errorChunk = {
|
|
@@ -44095,10 +44194,10 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
44095
44194
|
} catch (error) {
|
|
44096
44195
|
console.error('MessageService.mockMessage.error', error);
|
|
44097
44196
|
const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
|
|
44098
|
-
/*
|
|
44099
|
-
if (error instanceof TypeError) {
|
|
44100
|
-
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44101
|
-
}
|
|
44197
|
+
/*
|
|
44198
|
+
if (error instanceof TypeError) {
|
|
44199
|
+
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44200
|
+
}
|
|
44102
44201
|
*/
|
|
44103
44202
|
if (typeof onEnd === 'function') {
|
|
44104
44203
|
const errorChunk = {
|
|
@@ -44153,36 +44252,36 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
44153
44252
|
};
|
|
44154
44253
|
}
|
|
44155
44254
|
|
|
44156
|
-
/*
|
|
44157
|
-
async function* streamAsyncIterable<T>(stream: ReadableStream<T>) {
|
|
44158
|
-
const reader = stream.getReader();
|
|
44159
|
-
try {
|
|
44160
|
-
while (true) {
|
|
44161
|
-
const { done, value } = await reader.read();
|
|
44162
|
-
if (done) return;
|
|
44163
|
-
yield value;
|
|
44164
|
-
}
|
|
44165
|
-
} finally {
|
|
44166
|
-
reader.releaseLock();
|
|
44167
|
-
}
|
|
44168
|
-
}
|
|
44169
|
-
|
|
44170
|
-
class Iterator {
|
|
44171
|
-
}
|
|
44172
|
-
|
|
44173
|
-
(Iterator as any).prototype[Symbol.asyncIterator] = async function* () {
|
|
44174
|
-
const reader = this.getReader();
|
|
44175
|
-
try {
|
|
44176
|
-
while (true) {
|
|
44177
|
-
const { done, value } = await reader.read();
|
|
44178
|
-
if (done) return;
|
|
44179
|
-
yield value;
|
|
44180
|
-
}
|
|
44181
|
-
}
|
|
44182
|
-
finally {
|
|
44183
|
-
reader.releaseLock();
|
|
44184
|
-
}
|
|
44185
|
-
};
|
|
44255
|
+
/*
|
|
44256
|
+
async function* streamAsyncIterable<T>(stream: ReadableStream<T>) {
|
|
44257
|
+
const reader = stream.getReader();
|
|
44258
|
+
try {
|
|
44259
|
+
while (true) {
|
|
44260
|
+
const { done, value } = await reader.read();
|
|
44261
|
+
if (done) return;
|
|
44262
|
+
yield value;
|
|
44263
|
+
}
|
|
44264
|
+
} finally {
|
|
44265
|
+
reader.releaseLock();
|
|
44266
|
+
}
|
|
44267
|
+
}
|
|
44268
|
+
|
|
44269
|
+
class Iterator {
|
|
44270
|
+
}
|
|
44271
|
+
|
|
44272
|
+
(Iterator as any).prototype[Symbol.asyncIterator] = async function* () {
|
|
44273
|
+
const reader = this.getReader();
|
|
44274
|
+
try {
|
|
44275
|
+
while (true) {
|
|
44276
|
+
const { done, value } = await reader.read();
|
|
44277
|
+
if (done) return;
|
|
44278
|
+
yield value;
|
|
44279
|
+
}
|
|
44280
|
+
}
|
|
44281
|
+
finally {
|
|
44282
|
+
reader.releaseLock();
|
|
44283
|
+
}
|
|
44284
|
+
};
|
|
44186
44285
|
*/
|
|
44187
44286
|
|
|
44188
44287
|
class ApiService {
|
|
@@ -44785,19 +44884,19 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
44785
44884
|
utterance.onerror = error => {
|
|
44786
44885
|
console.warn('DefaultTextToSpeech.speak.onerror', error);
|
|
44787
44886
|
};
|
|
44788
|
-
/*
|
|
44789
|
-
utterance.onboundary = (event) => {
|
|
44790
|
-
console.log('DefaultTextToSpeech.speak.onboundary', event);
|
|
44791
|
-
};
|
|
44792
|
-
utterance.onmark = (event) => {
|
|
44793
|
-
console.log('DefaultTextToSpeech.speak.onmark', event);
|
|
44794
|
-
};
|
|
44795
|
-
utterance.onpause = (event) => {
|
|
44796
|
-
console.log('DefaultTextToSpeech.speak.onpause', event);
|
|
44797
|
-
};
|
|
44798
|
-
utterance.onresume = (event) => {
|
|
44799
|
-
console.log('DefaultTextToSpeech.speak.onresume', event);
|
|
44800
|
-
};
|
|
44887
|
+
/*
|
|
44888
|
+
utterance.onboundary = (event) => {
|
|
44889
|
+
console.log('DefaultTextToSpeech.speak.onboundary', event);
|
|
44890
|
+
};
|
|
44891
|
+
utterance.onmark = (event) => {
|
|
44892
|
+
console.log('DefaultTextToSpeech.speak.onmark', event);
|
|
44893
|
+
};
|
|
44894
|
+
utterance.onpause = (event) => {
|
|
44895
|
+
console.log('DefaultTextToSpeech.speak.onpause', event);
|
|
44896
|
+
};
|
|
44897
|
+
utterance.onresume = (event) => {
|
|
44898
|
+
console.log('DefaultTextToSpeech.speak.onresume', event);
|
|
44899
|
+
};
|
|
44801
44900
|
*/
|
|
44802
44901
|
utterance.voice = voice;
|
|
44803
44902
|
utterance.pitch = pitch;
|
|
@@ -44981,12 +45080,12 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
44981
45080
|
return this.recognizer_;
|
|
44982
45081
|
} else {
|
|
44983
45082
|
const recognizer = new this.recognition();
|
|
44984
|
-
/*
|
|
44985
|
-
const grammar =
|
|
44986
|
-
"#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 ;";
|
|
44987
|
-
const grammarList = new this.grammarList();
|
|
44988
|
-
grammarList.addFromString(grammar, 1);
|
|
44989
|
-
recognizer.grammars = grammarList;
|
|
45083
|
+
/*
|
|
45084
|
+
const grammar =
|
|
45085
|
+
"#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 ;";
|
|
45086
|
+
const grammarList = new this.grammarList();
|
|
45087
|
+
grammarList.addFromString(grammar, 1);
|
|
45088
|
+
recognizer.grammars = grammarList;
|
|
44990
45089
|
*/
|
|
44991
45090
|
recognizer.lang = this.lang; // "en-US";
|
|
44992
45091
|
recognizer.continuous = true;
|
|
@@ -45004,37 +45103,37 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45004
45103
|
// console.log('recognizer.result');
|
|
45005
45104
|
this.onResult(event);
|
|
45006
45105
|
});
|
|
45007
|
-
/*
|
|
45008
|
-
recognizer.addEventListener("audioend", (event) => {
|
|
45009
|
-
this.log('recognizer', "audioend", event);
|
|
45010
|
-
});
|
|
45011
|
-
recognizer.addEventListener("speechend", (event) => {
|
|
45012
|
-
this.log('recognizer', "speechend", event);
|
|
45013
|
-
});
|
|
45106
|
+
/*
|
|
45107
|
+
recognizer.addEventListener("audioend", (event) => {
|
|
45108
|
+
this.log('recognizer', "audioend", event);
|
|
45109
|
+
});
|
|
45110
|
+
recognizer.addEventListener("speechend", (event) => {
|
|
45111
|
+
this.log('recognizer', "speechend", event);
|
|
45112
|
+
});
|
|
45014
45113
|
*/
|
|
45015
|
-
/*
|
|
45016
|
-
audiostart
|
|
45017
|
-
Fired when the user agent has started to capture audio. Also available via the onaudiostart property.
|
|
45018
|
-
audioend
|
|
45019
|
-
Fired when the user agent has finished capturing audio. Also available via the onaudioend property.
|
|
45020
|
-
end
|
|
45021
|
-
Fired when the speech recognition service has disconnected. Also available via the onend property.
|
|
45022
|
-
error
|
|
45023
|
-
Fired when a speech recognition error occurs. Also available via the onerror property.
|
|
45024
|
-
nomatch
|
|
45025
|
-
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.
|
|
45026
|
-
result
|
|
45027
|
-
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.
|
|
45028
|
-
soundstart
|
|
45029
|
-
Fired when any sound — recognizable speech or not — has been detected. Also available via the onsoundstart property.
|
|
45030
|
-
soundend
|
|
45031
|
-
Fired when any sound — recognizable speech or not — has stopped being detected. Also available via the onsoundend property.
|
|
45032
|
-
speechstart
|
|
45033
|
-
Fired when sound that is recognized by the speech recognition service as speech has been detected. Also available via the onspeechstart property.
|
|
45034
|
-
speechend
|
|
45035
|
-
Fired when speech recognized by the speech recognition service has stopped being detected. Also available via the onspeechend property.
|
|
45036
|
-
start
|
|
45037
|
-
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.
|
|
45114
|
+
/*
|
|
45115
|
+
audiostart
|
|
45116
|
+
Fired when the user agent has started to capture audio. Also available via the onaudiostart property.
|
|
45117
|
+
audioend
|
|
45118
|
+
Fired when the user agent has finished capturing audio. Also available via the onaudioend property.
|
|
45119
|
+
end
|
|
45120
|
+
Fired when the speech recognition service has disconnected. Also available via the onend property.
|
|
45121
|
+
error
|
|
45122
|
+
Fired when a speech recognition error occurs. Also available via the onerror property.
|
|
45123
|
+
nomatch
|
|
45124
|
+
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.
|
|
45125
|
+
result
|
|
45126
|
+
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.
|
|
45127
|
+
soundstart
|
|
45128
|
+
Fired when any sound — recognizable speech or not — has been detected. Also available via the onsoundstart property.
|
|
45129
|
+
soundend
|
|
45130
|
+
Fired when any sound — recognizable speech or not — has stopped being detected. Also available via the onsoundend property.
|
|
45131
|
+
speechstart
|
|
45132
|
+
Fired when sound that is recognized by the speech recognition service as speech has been detected. Also available via the onspeechstart property.
|
|
45133
|
+
speechend
|
|
45134
|
+
Fired when speech recognized by the speech recognition service has stopped being detected. Also available via the onspeechend property.
|
|
45135
|
+
start
|
|
45136
|
+
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.
|
|
45038
45137
|
*/
|
|
45039
45138
|
this.recognizer_ = recognizer;
|
|
45040
45139
|
return recognizer;
|
|
@@ -45203,17 +45302,17 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45203
45302
|
return c(p);
|
|
45204
45303
|
}, {
|
|
45205
45304
|
...config
|
|
45206
|
-
/**
|
|
45207
|
-
* test remote api
|
|
45208
|
-
...({
|
|
45209
|
-
appKey: 'xxxxxxxxxxxxxx',
|
|
45210
|
-
apiKey: 'xxxxxxxxxxxxxx',
|
|
45211
|
-
threadId: 'xxxxxxxxxxxxxx',
|
|
45212
|
-
endpoint: 'https://platform.websolute.ai',
|
|
45213
|
-
endpoint: 'https://platform-ai-dev.ws-deploy-01.wslabs.it',
|
|
45214
|
-
endpoint: 'http://localhost:4000/bowl',
|
|
45215
|
-
test: false,
|
|
45216
|
-
}),
|
|
45305
|
+
/**
|
|
45306
|
+
* test remote api
|
|
45307
|
+
...({
|
|
45308
|
+
appKey: 'xxxxxxxxxxxxxx',
|
|
45309
|
+
apiKey: 'xxxxxxxxxxxxxx',
|
|
45310
|
+
threadId: 'xxxxxxxxxxxxxx',
|
|
45311
|
+
endpoint: 'https://platform.websolute.ai',
|
|
45312
|
+
endpoint: 'https://platform-ai-dev.ws-deploy-01.wslabs.it',
|
|
45313
|
+
endpoint: 'http://localhost:4000/bowl',
|
|
45314
|
+
test: false,
|
|
45315
|
+
}),
|
|
45217
45316
|
*/
|
|
45218
45317
|
});
|
|
45219
45318
|
const {
|
|
@@ -45354,12 +45453,12 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45354
45453
|
}
|
|
45355
45454
|
const thread = MessageDecoder.decodeThread(app.thread);
|
|
45356
45455
|
const testTheme = test ? getMock(locale, test).app?.contents?.customTheme : {};
|
|
45357
|
-
/*
|
|
45358
|
-
console.log(
|
|
45359
|
-
'appTheme', app.contents.customTheme,
|
|
45360
|
-
'testTheme', testTheme,
|
|
45361
|
-
'customTheme', customTheme
|
|
45362
|
-
);
|
|
45456
|
+
/*
|
|
45457
|
+
console.log(
|
|
45458
|
+
'appTheme', app.contents.customTheme,
|
|
45459
|
+
'testTheme', testTheme,
|
|
45460
|
+
'customTheme', customTheme
|
|
45461
|
+
);
|
|
45363
45462
|
*/
|
|
45364
45463
|
const theme = getThemes([app.contents.customTheme, testTheme, customTheme], config.defaultTheme);
|
|
45365
45464
|
const mode = theme.mode;
|
|
@@ -45368,22 +45467,22 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45368
45467
|
// console.log('useLlm.storedHistory', storedHistory);
|
|
45369
45468
|
const history = await apiService.decorateHistory(storedHistory, mode);
|
|
45370
45469
|
// console.log('useLlm.history', history);
|
|
45371
|
-
/*
|
|
45372
|
-
// !!! session restored via threadId storage merge
|
|
45373
|
-
if (storageMode === 'session') {
|
|
45374
|
-
// console.log('storageMode', storageMode, history);
|
|
45375
|
-
if (history.length > 0) {
|
|
45376
|
-
thread = {
|
|
45377
|
-
threadId: history[0].threadId,
|
|
45378
|
-
messages: history[0].messages,
|
|
45379
|
-
};
|
|
45380
|
-
}
|
|
45381
|
-
}
|
|
45470
|
+
/*
|
|
45471
|
+
// !!! session restored via threadId storage merge
|
|
45472
|
+
if (storageMode === 'session') {
|
|
45473
|
+
// console.log('storageMode', storageMode, history);
|
|
45474
|
+
if (history.length > 0) {
|
|
45475
|
+
thread = {
|
|
45476
|
+
threadId: history[0].threadId,
|
|
45477
|
+
messages: history[0].messages,
|
|
45478
|
+
};
|
|
45479
|
+
}
|
|
45480
|
+
}
|
|
45382
45481
|
*/
|
|
45383
|
-
/*
|
|
45384
|
-
console.log(
|
|
45385
|
-
'theme', theme
|
|
45386
|
-
);
|
|
45482
|
+
/*
|
|
45483
|
+
console.log(
|
|
45484
|
+
'theme', theme
|
|
45485
|
+
);
|
|
45387
45486
|
*/
|
|
45388
45487
|
const vars = getVars(theme);
|
|
45389
45488
|
createVars(vars);
|
|
@@ -45441,6 +45540,9 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45441
45540
|
return;
|
|
45442
45541
|
}
|
|
45443
45542
|
}
|
|
45543
|
+
pushDataLayer({
|
|
45544
|
+
event: state.messages.length > 0 ? 'llm_message' : 'llm_start'
|
|
45545
|
+
});
|
|
45444
45546
|
const messages = await messageService.addUserMessage(state.messages, prompt, uploaded);
|
|
45445
45547
|
set(state => ({
|
|
45446
45548
|
chunks: [],
|
|
@@ -45479,12 +45581,12 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45479
45581
|
};
|
|
45480
45582
|
const responseMessages = [...messages, assistantMessage];
|
|
45481
45583
|
// 15/12/2025 disabling form request feature, todo add payload flag
|
|
45482
|
-
/*
|
|
45483
|
-
if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
|
|
45484
|
-
chunks.push({
|
|
45485
|
-
type: 'formRequest',
|
|
45486
|
-
});
|
|
45487
|
-
}
|
|
45584
|
+
/*
|
|
45585
|
+
if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
|
|
45586
|
+
chunks.push({
|
|
45587
|
+
type: 'formRequest',
|
|
45588
|
+
});
|
|
45589
|
+
}
|
|
45488
45590
|
*/
|
|
45489
45591
|
// filtering history
|
|
45490
45592
|
const validChunks = chunks.filter(x => typeof x.type === 'string' && !['header', 'info', 'end', 'formRequest', 'formRecap', 'formRecapSuccess', 'formRecapError'].includes(x.type));
|
|
@@ -45752,10 +45854,10 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45752
45854
|
threadId: history.threadId,
|
|
45753
45855
|
message: history.assistant,
|
|
45754
45856
|
messages: history.messages
|
|
45755
|
-
/*
|
|
45756
|
-
messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
|
|
45757
|
-
[...state.messages, history.user, history.assistant] :
|
|
45758
|
-
state.messages,
|
|
45857
|
+
/*
|
|
45858
|
+
messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
|
|
45859
|
+
[...state.messages, history.user, history.assistant] :
|
|
45860
|
+
state.messages,
|
|
45759
45861
|
*/
|
|
45760
45862
|
}));
|
|
45761
45863
|
},
|
|
@@ -45799,10 +45901,10 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45799
45901
|
currentState.storedHistory = persistedState.storedHistory && [...persistedState.storedHistory];
|
|
45800
45902
|
currentState.speakEnabled = persistedState.speakEnabled || false;
|
|
45801
45903
|
speech.enabled = currentState.speakEnabled;
|
|
45802
|
-
/*
|
|
45803
|
-
if (persistedState.messages) {
|
|
45804
|
-
currentState.messages = [...persistedState.messages];
|
|
45805
|
-
}
|
|
45904
|
+
/*
|
|
45905
|
+
if (persistedState.messages) {
|
|
45906
|
+
currentState.messages = [...persistedState.messages];
|
|
45907
|
+
}
|
|
45806
45908
|
*/
|
|
45807
45909
|
currentState.hydrated = true;
|
|
45808
45910
|
// console.log('currentState', currentState);
|
|
@@ -45847,7 +45949,7 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
45847
45949
|
}
|
|
45848
45950
|
return p;
|
|
45849
45951
|
}, []);
|
|
45850
|
-
console.log('useLlm.messagesToHistory', history);
|
|
45952
|
+
// console.log('useLlm.messagesToHistory', history);
|
|
45851
45953
|
return history.filter(x => x.threadId && x.messageId);
|
|
45852
45954
|
}
|
|
45853
45955
|
function historyToStoredHistory(history) {
|
|
@@ -46461,21 +46563,21 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
46461
46563
|
if (!node.hasAttribute('data-llm')) {
|
|
46462
46564
|
node.setAttribute('data-llm', '');
|
|
46463
46565
|
|
|
46464
|
-
/*
|
|
46465
|
-
const host = node;
|
|
46466
|
-
const shadow = host.attachShadow({ mode: 'open' });
|
|
46467
|
-
const shadowRoot = document.createElement('div');
|
|
46468
|
-
if (typeof window !== 'undefined' && 'llms__' in window) {
|
|
46469
|
-
const llmStyle = (window['llms__'] || []) as string[];
|
|
46470
|
-
const adoptedStyleSheets = llmStyle.map(style => {
|
|
46471
|
-
const sheet = new CSSStyleSheet();
|
|
46472
|
-
sheet.replaceSync(style);
|
|
46473
|
-
return sheet;
|
|
46474
|
-
});
|
|
46475
|
-
shadow.adoptedStyleSheets = adoptedStyleSheets;
|
|
46476
|
-
}
|
|
46477
|
-
shadowRoot.setAttribute('data-llm', '');
|
|
46478
|
-
shadow.appendChild(shadowRoot);
|
|
46566
|
+
/*
|
|
46567
|
+
const host = node;
|
|
46568
|
+
const shadow = host.attachShadow({ mode: 'open' });
|
|
46569
|
+
const shadowRoot = document.createElement('div');
|
|
46570
|
+
if (typeof window !== 'undefined' && 'llms__' in window) {
|
|
46571
|
+
const llmStyle = (window['llms__'] || []) as string[];
|
|
46572
|
+
const adoptedStyleSheets = llmStyle.map(style => {
|
|
46573
|
+
const sheet = new CSSStyleSheet();
|
|
46574
|
+
sheet.replaceSync(style);
|
|
46575
|
+
return sheet;
|
|
46576
|
+
});
|
|
46577
|
+
shadow.adoptedStyleSheets = adoptedStyleSheets;
|
|
46578
|
+
}
|
|
46579
|
+
shadowRoot.setAttribute('data-llm', '');
|
|
46580
|
+
shadow.appendChild(shadowRoot);
|
|
46479
46581
|
*/
|
|
46480
46582
|
|
|
46481
46583
|
const root = client.createRoot(node);
|
|
@@ -46548,10 +46650,10 @@ ${Object.entries(vars).map(_ref2 => {
|
|
|
46548
46650
|
if (mutation.type === 'childList') {
|
|
46549
46651
|
callback(mutation);
|
|
46550
46652
|
}
|
|
46551
|
-
/*
|
|
46552
|
-
else if (mutation.type === 'attributes') {
|
|
46553
|
-
console.log(`The ${mutation.attributeName} attribute was modified.`);
|
|
46554
|
-
}
|
|
46653
|
+
/*
|
|
46654
|
+
else if (mutation.type === 'attributes') {
|
|
46655
|
+
console.log(`The ${mutation.attributeName} attribute was modified.`);
|
|
46656
|
+
}
|
|
46555
46657
|
*/
|
|
46556
46658
|
}
|
|
46557
46659
|
});
|