@websolutespa/bom-llm 0.2.5 → 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 +6 -0
- package/README.md +153 -153
- package/dist/esm/index.js +646 -564
- 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 +646 -564
- 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() {
|
|
@@ -19869,6 +19869,21 @@ function pushDataLayer(record) {
|
|
|
19869
19869
|
}
|
|
19870
19870
|
}
|
|
19871
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
|
+
}
|
|
19872
19887
|
const createLlmViewStore = _ref => {
|
|
19873
19888
|
let {
|
|
19874
19889
|
threadId,
|
|
@@ -19899,6 +19914,7 @@ const createLlmViewStore = _ref => {
|
|
|
19899
19914
|
fixed: false,
|
|
19900
19915
|
idle: true,
|
|
19901
19916
|
visible: false,
|
|
19917
|
+
minimized: getPersistedMinimized(),
|
|
19902
19918
|
scrollable: false,
|
|
19903
19919
|
direction: 0
|
|
19904
19920
|
};
|
|
@@ -19974,13 +19990,13 @@ const createLlmViewStore = _ref => {
|
|
|
19974
19990
|
lastScrollTop = 0;
|
|
19975
19991
|
}
|
|
19976
19992
|
};
|
|
19977
|
-
/*
|
|
19978
|
-
if ('ResizeObserver' in window) {
|
|
19979
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
19980
|
-
onScroll();
|
|
19981
|
-
});
|
|
19982
|
-
resizeObserver.observe(document.scrollingElement as HTMLElement);
|
|
19983
|
-
}
|
|
19993
|
+
/*
|
|
19994
|
+
if ('ResizeObserver' in window) {
|
|
19995
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
19996
|
+
onScroll();
|
|
19997
|
+
});
|
|
19998
|
+
resizeObserver.observe(document.scrollingElement as HTMLElement);
|
|
19999
|
+
}
|
|
19984
20000
|
*/
|
|
19985
20001
|
window.addEventListener('scroll', onScroll);
|
|
19986
20002
|
window.addEventListener('resize', onResize);
|
|
@@ -20024,9 +20040,11 @@ const createLlmViewStore = _ref => {
|
|
|
20024
20040
|
},
|
|
20025
20041
|
send: async (prompt, onMessage, onEnd) => {
|
|
20026
20042
|
await send(prompt, () => {
|
|
20043
|
+
persistMinimized(false);
|
|
20027
20044
|
set({
|
|
20028
20045
|
skipCustomIntro: true,
|
|
20029
|
-
opened: true
|
|
20046
|
+
opened: true,
|
|
20047
|
+
minimized: false
|
|
20030
20048
|
});
|
|
20031
20049
|
setTimeout(() => {
|
|
20032
20050
|
}, 50);
|
|
@@ -20047,8 +20065,10 @@ const createLlmViewStore = _ref => {
|
|
|
20047
20065
|
pushDataLayer({
|
|
20048
20066
|
event: opened ? 'llm_open' : 'llm_close'
|
|
20049
20067
|
});
|
|
20068
|
+
persistMinimized(false);
|
|
20050
20069
|
return {
|
|
20051
|
-
opened
|
|
20070
|
+
opened,
|
|
20071
|
+
minimized: false
|
|
20052
20072
|
};
|
|
20053
20073
|
});
|
|
20054
20074
|
},
|
|
@@ -20076,6 +20096,12 @@ const createLlmViewStore = _ref => {
|
|
|
20076
20096
|
introed
|
|
20077
20097
|
}));
|
|
20078
20098
|
},
|
|
20099
|
+
setMinimized: minimized => {
|
|
20100
|
+
persistMinimized(minimized);
|
|
20101
|
+
set(state => ({
|
|
20102
|
+
minimized
|
|
20103
|
+
}));
|
|
20104
|
+
},
|
|
20079
20105
|
setVisible: visible => set(state => ({
|
|
20080
20106
|
visible
|
|
20081
20107
|
})),
|
|
@@ -23320,11 +23346,11 @@ const Text = props => {
|
|
|
23320
23346
|
<img src="${href}"${title ? ` title="${title}"` : ''} alt="" />
|
|
23321
23347
|
</a>`;
|
|
23322
23348
|
}
|
|
23323
|
-
/*
|
|
23324
|
-
html(html: string, block?: boolean) {
|
|
23325
|
-
console.log('html', html);
|
|
23326
|
-
return html;
|
|
23327
|
-
},
|
|
23349
|
+
/*
|
|
23350
|
+
html(html: string, block?: boolean) {
|
|
23351
|
+
console.log('html', html);
|
|
23352
|
+
return html;
|
|
23353
|
+
},
|
|
23328
23354
|
*/
|
|
23329
23355
|
}
|
|
23330
23356
|
});
|
|
@@ -31940,12 +31966,12 @@ function sanitizeBlockType(type) {
|
|
|
31940
31966
|
return type.replace(/Item$/, '');
|
|
31941
31967
|
}
|
|
31942
31968
|
|
|
31943
|
-
/*
|
|
31944
|
-
export type LlmChunkImage = {
|
|
31945
|
-
type: 'image';
|
|
31946
|
-
id: string;
|
|
31947
|
-
src: string;
|
|
31948
|
-
};
|
|
31969
|
+
/*
|
|
31970
|
+
export type LlmChunkImage = {
|
|
31971
|
+
type: 'image';
|
|
31972
|
+
id: string;
|
|
31973
|
+
src: string;
|
|
31974
|
+
};
|
|
31949
31975
|
*/
|
|
31950
31976
|
|
|
31951
31977
|
// media
|
|
@@ -31968,11 +31994,11 @@ export type LlmChunkImage = {
|
|
|
31968
31994
|
|
|
31969
31995
|
// !!! todo move to bom-core
|
|
31970
31996
|
|
|
31971
|
-
/*
|
|
31972
|
-
export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
|
|
31973
|
-
type: LlmChunkUnknownItemType;
|
|
31974
|
-
id: IEquatable;
|
|
31975
|
-
};
|
|
31997
|
+
/*
|
|
31998
|
+
export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
|
|
31999
|
+
type: LlmChunkUnknownItemType;
|
|
32000
|
+
id: IEquatable;
|
|
32001
|
+
};
|
|
31976
32002
|
*/
|
|
31977
32003
|
|
|
31978
32004
|
// !!! todo
|
|
@@ -31981,55 +32007,55 @@ export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> &
|
|
|
31981
32007
|
// type StuctureMappedType<T extends LlmChunkType> = { [K in T]: Array<LlmChunkItem<K>> };
|
|
31982
32008
|
// export type LlmChunkItems<T extends LlmChunkType = LlmChunkType> = Record<T, (item: Extract<LlmChunkItem, { type: T }>) => string>;
|
|
31983
32009
|
|
|
31984
|
-
/*
|
|
31985
|
-
export type LlmThemeItem = Record<string, CSSProperties> & {
|
|
31986
|
-
[key: string]: string | boolean | number;
|
|
31987
|
-
};
|
|
31988
|
-
|
|
31989
|
-
export type LlmThemeTypography = Omit<CSSProperties, 'textTransform'> & {
|
|
31990
|
-
family?: CSSProperties['fontFamily'];
|
|
31991
|
-
size?: CSSProperties['fontSize'];
|
|
31992
|
-
weight?: CSSProperties['fontWeight'];
|
|
31993
|
-
fontSizeMin?: string;
|
|
31994
|
-
fontSizeMax?: string;
|
|
31995
|
-
textTransform?: string;
|
|
31996
|
-
};
|
|
31997
|
-
|
|
31998
|
-
export type LlmThemeColor = {
|
|
31999
|
-
[key: string]: CSSProperties['color'] | LlmThemeColor;
|
|
32000
|
-
};
|
|
32001
|
-
|
|
32002
|
-
export type LlmThemeProps = {
|
|
32003
|
-
mode?: string;
|
|
32004
|
-
scale?: number;
|
|
32005
|
-
font?: {
|
|
32006
|
-
primary: CSSProperties['fontFamily'];
|
|
32007
|
-
secondary: CSSProperties['fontFamily'];
|
|
32008
|
-
source: string;
|
|
32009
|
-
};
|
|
32010
|
-
typography?: Record<string, LlmThemeTypography>,
|
|
32011
|
-
color?: LlmThemeColor;
|
|
32012
|
-
canvas?: {
|
|
32013
|
-
opacity?: number;
|
|
32014
|
-
enabled?: boolean;
|
|
32015
|
-
};
|
|
32016
|
-
border?: CSSProperties['border'];
|
|
32017
|
-
toaster?: ToasterProps['theme'];
|
|
32018
|
-
};
|
|
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
|
+
};
|
|
32019
32045
|
*/
|
|
32020
32046
|
|
|
32021
|
-
/*
|
|
32022
|
-
export type LlmTheme = Omit<{
|
|
32023
|
-
[key: string]: LlmThemeItem | CSSProperties;
|
|
32024
|
-
}, keyof LlmThemeProps> & LlmThemeProps;
|
|
32047
|
+
/*
|
|
32048
|
+
export type LlmTheme = Omit<{
|
|
32049
|
+
[key: string]: LlmThemeItem | CSSProperties;
|
|
32050
|
+
}, keyof LlmThemeProps> & LlmThemeProps;
|
|
32025
32051
|
*/
|
|
32026
32052
|
|
|
32027
|
-
/*
|
|
32028
|
-
export type LlmThemeBase = {
|
|
32029
|
-
[key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
|
|
32030
|
-
};
|
|
32031
|
-
|
|
32032
|
-
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;
|
|
32033
32059
|
*/
|
|
32034
32060
|
|
|
32035
32061
|
const LLM_DEFAULT_MIME_TYPES = '.jpg, .jpeg, .png, .svg, .webp, .txt, .md, .pdf, .csv, .doc, .xls, .ppt';
|
|
@@ -32264,14 +32290,14 @@ const Feedback = _ref => {
|
|
|
32264
32290
|
const feedbackType = type || theme.feedback?.type || 'stars';
|
|
32265
32291
|
const classNames = getClassNames('llm__feedback', `llm__feedback--${feedbackType}`);
|
|
32266
32292
|
|
|
32267
|
-
/*
|
|
32268
|
-
const [feedbackRating, setFeedbackRating] = useState<number>();
|
|
32269
|
-
const onRating = async (event: ChangeEvent<HTMLInputElement>) => {
|
|
32270
|
-
console.log(event.currentTarget);
|
|
32271
|
-
const value = String(event.currentTarget.value);
|
|
32272
|
-
const rating = parseInt(value);
|
|
32273
|
-
setFeedbackRating(rating);
|
|
32274
|
-
};
|
|
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
|
+
};
|
|
32275
32301
|
*/
|
|
32276
32302
|
|
|
32277
32303
|
const onSubmit = async event => {
|
|
@@ -32408,8 +32434,8 @@ const Feedback = _ref => {
|
|
|
32408
32434
|
});
|
|
32409
32435
|
};
|
|
32410
32436
|
|
|
32411
|
-
/*
|
|
32412
|
-
<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">
|
|
32413
32439
|
*/
|
|
32414
32440
|
const Font = () => {
|
|
32415
32441
|
const theme = useLlm(state => state.theme);
|
|
@@ -32879,6 +32905,10 @@ const PageActions = _ref => {
|
|
|
32879
32905
|
wrapper
|
|
32880
32906
|
} = _ref;
|
|
32881
32907
|
const label = useLabel();
|
|
32908
|
+
const streaming = useLlm(state => state.streaming);
|
|
32909
|
+
const {
|
|
32910
|
+
clear
|
|
32911
|
+
} = useLlm(state => state.actions);
|
|
32882
32912
|
const {
|
|
32883
32913
|
send
|
|
32884
32914
|
} = useLlmView(state => state.actions);
|
|
@@ -32886,7 +32916,8 @@ const PageActions = _ref => {
|
|
|
32886
32916
|
setWrapper
|
|
32887
32917
|
} = useActions();
|
|
32888
32918
|
const onAction = async action => {
|
|
32889
|
-
const prompt = action.message ||
|
|
32919
|
+
const prompt = action.message || action.label;
|
|
32920
|
+
clear();
|
|
32890
32921
|
await send(prompt, response => {
|
|
32891
32922
|
// console.log('PageActions.onChunk', response.chunks);
|
|
32892
32923
|
}, response => {
|
|
@@ -32904,7 +32935,11 @@ const PageActions = _ref => {
|
|
|
32904
32935
|
}), wrapper.actions.map(x => /*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
32905
32936
|
type: "button",
|
|
32906
32937
|
className: getClassNames(style$h.action),
|
|
32907
|
-
|
|
32938
|
+
disabled: streaming,
|
|
32939
|
+
onClick: e => {
|
|
32940
|
+
e.stopPropagation();
|
|
32941
|
+
onAction(x);
|
|
32942
|
+
},
|
|
32908
32943
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(ActionIcon, {
|
|
32909
32944
|
action: x
|
|
32910
32945
|
}), /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
@@ -40819,6 +40854,9 @@ const PageHistory = _ref => {
|
|
|
40819
40854
|
removeHistory
|
|
40820
40855
|
} = useLlm(state => state.actions);
|
|
40821
40856
|
// console.log('item', item);
|
|
40857
|
+
if (!item.user) {
|
|
40858
|
+
return;
|
|
40859
|
+
}
|
|
40822
40860
|
return /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
40823
40861
|
className: getClassNames(style$e.history),
|
|
40824
40862
|
onClick: () => setHistory(item),
|
|
@@ -41336,7 +41374,11 @@ styleInject(css_248z$5);
|
|
|
41336
41374
|
const PageSubmit = () => {
|
|
41337
41375
|
const label = useLabel();
|
|
41338
41376
|
useLlm(state => state.components);
|
|
41377
|
+
const streaming = useLlm(state => state.streaming);
|
|
41339
41378
|
const prompt = useLlm(state => state.prompt);
|
|
41379
|
+
const {
|
|
41380
|
+
clear
|
|
41381
|
+
} = useLlm(state => state.actions);
|
|
41340
41382
|
const {
|
|
41341
41383
|
send
|
|
41342
41384
|
} = useLlmView(state => state.actions);
|
|
@@ -41345,6 +41387,7 @@ const PageSubmit = () => {
|
|
|
41345
41387
|
if (!prompt) {
|
|
41346
41388
|
return;
|
|
41347
41389
|
}
|
|
41390
|
+
clear();
|
|
41348
41391
|
await send(prompt, response => {
|
|
41349
41392
|
// console.log('PagePrompt.onChunk', response.chunks);
|
|
41350
41393
|
}, response => {
|
|
@@ -41354,7 +41397,7 @@ const PageSubmit = () => {
|
|
|
41354
41397
|
return /*#__PURE__*/jsxRuntimeExports.jsx("button", {
|
|
41355
41398
|
type: "submit",
|
|
41356
41399
|
className: getClassNames(style$5.submit),
|
|
41357
|
-
|
|
41400
|
+
disabled: !prompt || streaming,
|
|
41358
41401
|
"aria-label": label('llm.sendPrompt'),
|
|
41359
41402
|
onClick: onSubmit,
|
|
41360
41403
|
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconLlmArrowUp, {})
|
|
@@ -41399,7 +41442,8 @@ const PageTextarea = () => {
|
|
|
41399
41442
|
const prompt = useLlm(state => state.prompt);
|
|
41400
41443
|
const streaming = useLlm(state => state.streaming);
|
|
41401
41444
|
const {
|
|
41402
|
-
setPrompt
|
|
41445
|
+
setPrompt,
|
|
41446
|
+
clear
|
|
41403
41447
|
} = useLlm(state => state.actions);
|
|
41404
41448
|
const {
|
|
41405
41449
|
send
|
|
@@ -41410,6 +41454,7 @@ const PageTextarea = () => {
|
|
|
41410
41454
|
if (!prompt) {
|
|
41411
41455
|
return;
|
|
41412
41456
|
}
|
|
41457
|
+
clear();
|
|
41413
41458
|
await send(prompt, response => {
|
|
41414
41459
|
// console.log('PagePrompt.onChunk', response.chunks);
|
|
41415
41460
|
}, response => {
|
|
@@ -41421,7 +41466,7 @@ const PageTextarea = () => {
|
|
|
41421
41466
|
setPrompt(prompt);
|
|
41422
41467
|
};
|
|
41423
41468
|
const onKeyDown = event => {
|
|
41424
|
-
if (event.code == 'Enter' && !event.shiftKey) {
|
|
41469
|
+
if (event.code == 'Enter' && !event.shiftKey && !streaming) {
|
|
41425
41470
|
onSubmit(event);
|
|
41426
41471
|
}
|
|
41427
41472
|
};
|
|
@@ -41473,10 +41518,10 @@ const PageThread = () => {
|
|
|
41473
41518
|
window.scrollTo({
|
|
41474
41519
|
top: 0
|
|
41475
41520
|
});
|
|
41476
|
-
/*
|
|
41477
|
-
if (ref.current) {
|
|
41478
|
-
ref.current.scrollIntoView();
|
|
41479
|
-
}
|
|
41521
|
+
/*
|
|
41522
|
+
if (ref.current) {
|
|
41523
|
+
ref.current.scrollIntoView();
|
|
41524
|
+
}
|
|
41480
41525
|
*/
|
|
41481
41526
|
}, [message, hasValidChunks]);
|
|
41482
41527
|
const classNames = getClassNames(style$2.thread);
|
|
@@ -41954,15 +41999,15 @@ const Scroller = _ref => {
|
|
|
41954
41999
|
}
|
|
41955
42000
|
},
|
|
41956
42001
|
start: () => {
|
|
41957
|
-
/*
|
|
41958
|
-
if (innerRef.current) {
|
|
41959
|
-
}
|
|
42002
|
+
/*
|
|
42003
|
+
if (innerRef.current) {
|
|
42004
|
+
}
|
|
41960
42005
|
*/
|
|
41961
42006
|
},
|
|
41962
42007
|
stop: () => {
|
|
41963
|
-
/*
|
|
41964
|
-
if (innerRef.current) {
|
|
41965
|
-
}
|
|
42008
|
+
/*
|
|
42009
|
+
if (innerRef.current) {
|
|
42010
|
+
}
|
|
41966
42011
|
*/
|
|
41967
42012
|
}
|
|
41968
42013
|
});
|
|
@@ -42151,30 +42196,30 @@ const Suggestions = () => {
|
|
|
42151
42196
|
});
|
|
42152
42197
|
};
|
|
42153
42198
|
|
|
42154
|
-
/*
|
|
42155
|
-
|
|
42156
|
-
const swiperProps = {
|
|
42157
|
-
modules: [FreeMode],
|
|
42158
|
-
spaceBetween: 8,
|
|
42159
|
-
freeMode: true,
|
|
42160
|
-
slidesPerView: 'auto' as const,
|
|
42161
|
-
slidesOffsetAfter: clamp(20, 110),
|
|
42162
|
-
slidesOffsetBefore: clamp(20, 110),
|
|
42163
|
-
};
|
|
42164
|
-
|
|
42165
|
-
<section className="llm__prompt-suggestions">
|
|
42166
|
-
<div className="llm__suggestions">
|
|
42167
|
-
<Swiper {...swiperProps} onInit={swiper => swiper.update()}>
|
|
42168
|
-
{app?.contents.sampleInputTexts?.map((s, j) => (
|
|
42169
|
-
<SwiperSlide key={j}>
|
|
42170
|
-
<button type="button" className="llm__pill" onClick={() => onClick(s)}>
|
|
42171
|
-
{s.sampleInputText}
|
|
42172
|
-
</button>
|
|
42173
|
-
</SwiperSlide>
|
|
42174
|
-
))}
|
|
42175
|
-
</Swiper>
|
|
42176
|
-
</div>
|
|
42177
|
-
</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>
|
|
42178
42223
|
*/
|
|
42179
42224
|
|
|
42180
42225
|
const Thread = () => {
|
|
@@ -42210,6 +42255,32 @@ const Thread = () => {
|
|
|
42210
42255
|
});
|
|
42211
42256
|
};
|
|
42212
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
|
+
};
|
|
42213
42284
|
const Trigger = () => {
|
|
42214
42285
|
const theme = useLlm(state => state.theme);
|
|
42215
42286
|
const {
|
|
@@ -42217,16 +42288,21 @@ const Trigger = () => {
|
|
|
42217
42288
|
} = useLlm(state => state.components);
|
|
42218
42289
|
const app = useLlm(state => state.app);
|
|
42219
42290
|
const opened = useLlmView(state => state.opened);
|
|
42291
|
+
const minimized = useLlmView(state => state.minimized);
|
|
42220
42292
|
const {
|
|
42221
|
-
open
|
|
42293
|
+
open,
|
|
42294
|
+
setMinimized
|
|
42222
42295
|
} = useLlmView(state => state.actions);
|
|
42223
42296
|
const label = useLabel();
|
|
42297
|
+
const enableMinimize = app?.contents.enableMinimize;
|
|
42224
42298
|
const collapsedWelcomeText = messageMapper(app?.contents.collapsedWelcomeText);
|
|
42225
42299
|
const collapsedWelcomeTextCta = messageMapper(app?.contents.collapsedWelcomeTextCta);
|
|
42226
42300
|
const collapsedWelcomeTextHover = messageMapper(app?.contents.collapsedWelcomeTextHover);
|
|
42227
42301
|
const position = theme.trigger?.position || 'bottom';
|
|
42228
42302
|
return /*#__PURE__*/jsxRuntimeExports.jsxs(motion.nav, {
|
|
42229
|
-
className: getClassNames('llm__trigger', '-' + position
|
|
42303
|
+
className: getClassNames('llm__trigger', '-' + position, {
|
|
42304
|
+
'-minimized': minimized
|
|
42305
|
+
}),
|
|
42230
42306
|
initial: {
|
|
42231
42307
|
y: '200%',
|
|
42232
42308
|
opacity: 0
|
|
@@ -42240,12 +42316,12 @@ const Trigger = () => {
|
|
|
42240
42316
|
opacity: 0
|
|
42241
42317
|
},
|
|
42242
42318
|
transition: {
|
|
42243
|
-
duration: .4
|
|
42319
|
+
duration: 0.4
|
|
42244
42320
|
},
|
|
42245
42321
|
"aria-label": "Trigger"
|
|
42246
|
-
/*
|
|
42247
|
-
aria-expanded={opened}
|
|
42248
|
-
aria-controls={mainId}
|
|
42322
|
+
/*
|
|
42323
|
+
aria-expanded={opened}
|
|
42324
|
+
aria-controls={mainId}
|
|
42249
42325
|
*/,
|
|
42250
42326
|
onClick: () => open(),
|
|
42251
42327
|
children: [/*#__PURE__*/jsxRuntimeExports.jsxs("button", {
|
|
@@ -42256,14 +42332,20 @@ const Trigger = () => {
|
|
|
42256
42332
|
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Blob, {}), /*#__PURE__*/jsxRuntimeExports.jsx("span", {
|
|
42257
42333
|
children: label('llm.button')
|
|
42258
42334
|
})]
|
|
42259
|
-
}), !opened && (collapsedWelcomeText || collapsedWelcomeTextCta || collapsedWelcomeTextHover) && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
42335
|
+
}), !opened && !minimized && (collapsedWelcomeText || collapsedWelcomeTextCta || collapsedWelcomeTextHover) && /*#__PURE__*/jsxRuntimeExports.jsxs("div", {
|
|
42260
42336
|
className: "llm__trigger-popup -llm-t-body2",
|
|
42261
42337
|
children: [(collapsedWelcomeText || collapsedWelcomeTextCta) && /*#__PURE__*/jsxRuntimeExports.jsxs(motion.div, {
|
|
42262
42338
|
className: "llm__trigger-message",
|
|
42263
42339
|
exit: {
|
|
42264
42340
|
opacity: 0
|
|
42265
42341
|
},
|
|
42266
|
-
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", {
|
|
42267
42349
|
type: "button",
|
|
42268
42350
|
className: "llm__trigger-cta",
|
|
42269
42351
|
children: collapsedWelcomeTextCta
|
|
@@ -43426,13 +43508,13 @@ class MessageDecoder {
|
|
|
43426
43508
|
decodeMessages(messages) {
|
|
43427
43509
|
return messages.map(x => {
|
|
43428
43510
|
if (Array.isArray(x.content)) {
|
|
43429
|
-
/*
|
|
43430
|
-
if (x.role === 'user') {
|
|
43431
|
-
return ({
|
|
43432
|
-
...x,
|
|
43433
|
-
chunks: x.content.map(x => this.decodeChunk(x)),
|
|
43434
|
-
});
|
|
43435
|
-
}
|
|
43511
|
+
/*
|
|
43512
|
+
if (x.role === 'user') {
|
|
43513
|
+
return ({
|
|
43514
|
+
...x,
|
|
43515
|
+
chunks: x.content.map(x => this.decodeChunk(x)),
|
|
43516
|
+
});
|
|
43517
|
+
}
|
|
43436
43518
|
*/
|
|
43437
43519
|
return {
|
|
43438
43520
|
...x,
|
|
@@ -43673,163 +43755,163 @@ class MessageDecoder {
|
|
|
43673
43755
|
return chunkItems;
|
|
43674
43756
|
}
|
|
43675
43757
|
|
|
43676
|
-
/*
|
|
43677
|
-
chunksToChunkItems___(chunks: LlmChunk[], response?: StreamResponse): LlmChunkItem[] {
|
|
43678
|
-
const chunkItems: LlmChunkItem[] = [];
|
|
43679
|
-
chunks.forEach(x => {
|
|
43680
|
-
const chunk: LlmChunkItem = typeof x === 'string' ? { type: 'text', text: x } : x;
|
|
43681
|
-
const lastMessage = chunkItems[chunkItems.length - 1];
|
|
43682
|
-
switch (chunk.type) {
|
|
43683
|
-
case 'text':
|
|
43684
|
-
if (lastMessage && isChunkText(lastMessage)) {
|
|
43685
|
-
const text = chunk.text;
|
|
43686
|
-
const lastChunkText = lastMessage;
|
|
43687
|
-
if (chunkItems.indexOf(lastChunkText) > 0) {
|
|
43688
|
-
// secondary chunk
|
|
43689
|
-
lastChunkText.text += text;
|
|
43690
|
-
} else if (!lastChunkText.text.includes('\n')) {
|
|
43691
|
-
// uncompleted first chunk
|
|
43692
|
-
if (text.includes('\n')) {
|
|
43693
|
-
const lines = text.split('\n');
|
|
43694
|
-
lines.forEach((line, i) => {
|
|
43695
|
-
const lastChar = (lines.length > i + 1) ? '\n' : '';
|
|
43696
|
-
if (i === 0) {
|
|
43697
|
-
lastChunkText.text += line + lastChar;
|
|
43698
|
-
} else if (line.length > 0) {
|
|
43699
|
-
chunkItems.push({
|
|
43700
|
-
type: 'text',
|
|
43701
|
-
text: line + lastChar,
|
|
43702
|
-
});
|
|
43703
|
-
}
|
|
43704
|
-
});
|
|
43705
|
-
} else {
|
|
43706
|
-
// uncompleted first chunk
|
|
43707
|
-
lastChunkText.text += text;
|
|
43708
|
-
}
|
|
43709
|
-
} else {
|
|
43710
|
-
// completed first chunk
|
|
43711
|
-
chunkItems.push(chunk);
|
|
43712
|
-
}
|
|
43713
|
-
} else {
|
|
43714
|
-
// new text chunk
|
|
43715
|
-
chunkItems.push(chunk);
|
|
43716
|
-
}
|
|
43717
|
-
break;
|
|
43718
|
-
case 'log':
|
|
43719
|
-
break;
|
|
43720
|
-
case 'error':
|
|
43721
|
-
chunkItems.push(chunk);
|
|
43722
|
-
break;
|
|
43723
|
-
case 'header': {
|
|
43724
|
-
const { type, ...rest } = chunk;
|
|
43725
|
-
if (response) {
|
|
43726
|
-
Object.assign(response, rest);
|
|
43727
|
-
}
|
|
43728
|
-
// console.log('header', response);
|
|
43729
|
-
}
|
|
43730
|
-
break;
|
|
43731
|
-
case 'info': {
|
|
43732
|
-
if (response) {
|
|
43733
|
-
// !!! deprecated
|
|
43734
|
-
response.threadId = chunk.threadId || response.threadId;
|
|
43735
|
-
}
|
|
43736
|
-
}
|
|
43737
|
-
break;
|
|
43738
|
-
case 'end':
|
|
43739
|
-
break;
|
|
43740
|
-
case 'action':
|
|
43741
|
-
case 'actionItem':
|
|
43742
|
-
if (lastMessage && lastMessage.type === 'actionGroup') {
|
|
43743
|
-
lastMessage.items.push(chunk);
|
|
43744
|
-
} else {
|
|
43745
|
-
chunkItems.push({
|
|
43746
|
-
type: 'actionGroup',
|
|
43747
|
-
items: [chunk],
|
|
43748
|
-
});
|
|
43749
|
-
}
|
|
43750
|
-
break;
|
|
43751
|
-
case 'cardItem':
|
|
43752
|
-
if (lastMessage && lastMessage.type === 'cardGroup') {
|
|
43753
|
-
lastMessage.items.push(chunk);
|
|
43754
|
-
} else {
|
|
43755
|
-
chunkItems.push({
|
|
43756
|
-
type: 'cardGroup',
|
|
43757
|
-
items: [chunk],
|
|
43758
|
-
});
|
|
43759
|
-
}
|
|
43760
|
-
break;
|
|
43761
|
-
case 'productItem':
|
|
43762
|
-
if (lastMessage && lastMessage.type === 'productGroup') {
|
|
43763
|
-
lastMessage.items.push(chunk);
|
|
43764
|
-
} else {
|
|
43765
|
-
chunkItems.push({
|
|
43766
|
-
type: 'productGroup',
|
|
43767
|
-
items: [chunk],
|
|
43768
|
-
});
|
|
43769
|
-
}
|
|
43770
|
-
break;
|
|
43771
|
-
case 'eventItem':
|
|
43772
|
-
if (lastMessage && lastMessage.type === 'eventGroup') {
|
|
43773
|
-
lastMessage.items.push(chunk);
|
|
43774
|
-
} else {
|
|
43775
|
-
chunkItems.push({
|
|
43776
|
-
type: 'eventGroup',
|
|
43777
|
-
items: [chunk],
|
|
43778
|
-
});
|
|
43779
|
-
}
|
|
43780
|
-
break;
|
|
43781
|
-
case 'poiItem':
|
|
43782
|
-
if (lastMessage && lastMessage.type === 'poiGroup') {
|
|
43783
|
-
lastMessage.items.push(chunk);
|
|
43784
|
-
} else {
|
|
43785
|
-
chunkItems.push({
|
|
43786
|
-
type: 'poiGroup',
|
|
43787
|
-
items: [chunk],
|
|
43788
|
-
});
|
|
43789
|
-
}
|
|
43790
|
-
break;
|
|
43791
|
-
case 'tripadvisor':
|
|
43792
|
-
case 'tripadvisorItem':
|
|
43793
|
-
if (lastMessage && lastMessage.type === 'tripadvisorGroup') {
|
|
43794
|
-
lastMessage.items.push({
|
|
43795
|
-
...chunk,
|
|
43796
|
-
type: 'tripadvisorItem',
|
|
43797
|
-
});
|
|
43798
|
-
} else {
|
|
43799
|
-
chunkItems.push({
|
|
43800
|
-
type: 'tripadvisorGroup',
|
|
43801
|
-
items: [{
|
|
43802
|
-
...chunk,
|
|
43803
|
-
type: 'tripadvisorItem',
|
|
43804
|
-
}],
|
|
43805
|
-
});
|
|
43806
|
-
}
|
|
43807
|
-
break;
|
|
43808
|
-
default:
|
|
43809
|
-
if (
|
|
43810
|
-
typeof chunk.type === 'string' &&
|
|
43811
|
-
chunk.type.match(/Item$/)
|
|
43812
|
-
) {
|
|
43813
|
-
const baseName = chunk.type.replace('Item', '');
|
|
43814
|
-
const groupName = `${baseName}Group`;
|
|
43815
|
-
if (lastMessage && lastMessage.type === groupName) {
|
|
43816
|
-
(lastMessage as { items: (typeof x)[] }).items.push(x);
|
|
43817
|
-
} else {
|
|
43818
|
-
chunkItems.push({
|
|
43819
|
-
type: groupName,
|
|
43820
|
-
items: [{
|
|
43821
|
-
...chunk,
|
|
43822
|
-
type: baseName,
|
|
43823
|
-
}],
|
|
43824
|
-
} as unknown as LlmChunkUnknownItem);
|
|
43825
|
-
}
|
|
43826
|
-
} else {
|
|
43827
|
-
chunkItems.push(chunk);
|
|
43828
|
-
}
|
|
43829
|
-
}
|
|
43830
|
-
});
|
|
43831
|
-
return chunkItems;
|
|
43832
|
-
}
|
|
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
|
+
}
|
|
43833
43915
|
*/
|
|
43834
43916
|
|
|
43835
43917
|
static decodeThread(thread) {
|
|
@@ -43984,10 +44066,10 @@ class MessageService extends MessageDecoder {
|
|
|
43984
44066
|
return;
|
|
43985
44067
|
}
|
|
43986
44068
|
const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
|
|
43987
|
-
/*
|
|
43988
|
-
if (error instanceof TypeError) {
|
|
43989
|
-
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
43990
|
-
}
|
|
44069
|
+
/*
|
|
44070
|
+
if (error instanceof TypeError) {
|
|
44071
|
+
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44072
|
+
}
|
|
43991
44073
|
*/
|
|
43992
44074
|
if (typeof onEnd === 'function') {
|
|
43993
44075
|
const errorChunk = {
|
|
@@ -44106,10 +44188,10 @@ class MessageService extends MessageDecoder {
|
|
|
44106
44188
|
} catch (error) {
|
|
44107
44189
|
console.error('MessageService.mockMessage.error', error);
|
|
44108
44190
|
const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
|
|
44109
|
-
/*
|
|
44110
|
-
if (error instanceof TypeError) {
|
|
44111
|
-
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44112
|
-
}
|
|
44191
|
+
/*
|
|
44192
|
+
if (error instanceof TypeError) {
|
|
44193
|
+
errorMessage = 'TypeError: Browser may not support async iteration';
|
|
44194
|
+
}
|
|
44113
44195
|
*/
|
|
44114
44196
|
if (typeof onEnd === 'function') {
|
|
44115
44197
|
const errorChunk = {
|
|
@@ -44164,36 +44246,36 @@ function readChunks(reader) {
|
|
|
44164
44246
|
};
|
|
44165
44247
|
}
|
|
44166
44248
|
|
|
44167
|
-
/*
|
|
44168
|
-
async function* streamAsyncIterable<T>(stream: ReadableStream<T>) {
|
|
44169
|
-
const reader = stream.getReader();
|
|
44170
|
-
try {
|
|
44171
|
-
while (true) {
|
|
44172
|
-
const { done, value } = await reader.read();
|
|
44173
|
-
if (done) return;
|
|
44174
|
-
yield value;
|
|
44175
|
-
}
|
|
44176
|
-
} finally {
|
|
44177
|
-
reader.releaseLock();
|
|
44178
|
-
}
|
|
44179
|
-
}
|
|
44180
|
-
|
|
44181
|
-
class Iterator {
|
|
44182
|
-
}
|
|
44183
|
-
|
|
44184
|
-
(Iterator as any).prototype[Symbol.asyncIterator] = async function* () {
|
|
44185
|
-
const reader = this.getReader();
|
|
44186
|
-
try {
|
|
44187
|
-
while (true) {
|
|
44188
|
-
const { done, value } = await reader.read();
|
|
44189
|
-
if (done) return;
|
|
44190
|
-
yield value;
|
|
44191
|
-
}
|
|
44192
|
-
}
|
|
44193
|
-
finally {
|
|
44194
|
-
reader.releaseLock();
|
|
44195
|
-
}
|
|
44196
|
-
};
|
|
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
|
+
};
|
|
44197
44279
|
*/
|
|
44198
44280
|
|
|
44199
44281
|
class ApiService {
|
|
@@ -44796,19 +44878,19 @@ class DefaultTextToSpeech {
|
|
|
44796
44878
|
utterance.onerror = error => {
|
|
44797
44879
|
console.warn('DefaultTextToSpeech.speak.onerror', error);
|
|
44798
44880
|
};
|
|
44799
|
-
/*
|
|
44800
|
-
utterance.onboundary = (event) => {
|
|
44801
|
-
console.log('DefaultTextToSpeech.speak.onboundary', event);
|
|
44802
|
-
};
|
|
44803
|
-
utterance.onmark = (event) => {
|
|
44804
|
-
console.log('DefaultTextToSpeech.speak.onmark', event);
|
|
44805
|
-
};
|
|
44806
|
-
utterance.onpause = (event) => {
|
|
44807
|
-
console.log('DefaultTextToSpeech.speak.onpause', event);
|
|
44808
|
-
};
|
|
44809
|
-
utterance.onresume = (event) => {
|
|
44810
|
-
console.log('DefaultTextToSpeech.speak.onresume', event);
|
|
44811
|
-
};
|
|
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
|
+
};
|
|
44812
44894
|
*/
|
|
44813
44895
|
utterance.voice = voice;
|
|
44814
44896
|
utterance.pitch = pitch;
|
|
@@ -44992,12 +45074,12 @@ class DefaultSpeechToText {
|
|
|
44992
45074
|
return this.recognizer_;
|
|
44993
45075
|
} else {
|
|
44994
45076
|
const recognizer = new this.recognition();
|
|
44995
|
-
/*
|
|
44996
|
-
const grammar =
|
|
44997
|
-
"#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 ;";
|
|
44998
|
-
const grammarList = new this.grammarList();
|
|
44999
|
-
grammarList.addFromString(grammar, 1);
|
|
45000
|
-
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;
|
|
45001
45083
|
*/
|
|
45002
45084
|
recognizer.lang = this.lang; // "en-US";
|
|
45003
45085
|
recognizer.continuous = true;
|
|
@@ -45015,37 +45097,37 @@ class DefaultSpeechToText {
|
|
|
45015
45097
|
// console.log('recognizer.result');
|
|
45016
45098
|
this.onResult(event);
|
|
45017
45099
|
});
|
|
45018
|
-
/*
|
|
45019
|
-
recognizer.addEventListener("audioend", (event) => {
|
|
45020
|
-
this.log('recognizer', "audioend", event);
|
|
45021
|
-
});
|
|
45022
|
-
recognizer.addEventListener("speechend", (event) => {
|
|
45023
|
-
this.log('recognizer', "speechend", event);
|
|
45024
|
-
});
|
|
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
|
+
});
|
|
45025
45107
|
*/
|
|
45026
|
-
/*
|
|
45027
|
-
audiostart
|
|
45028
|
-
Fired when the user agent has started to capture audio. Also available via the onaudiostart property.
|
|
45029
|
-
audioend
|
|
45030
|
-
Fired when the user agent has finished capturing audio. Also available via the onaudioend property.
|
|
45031
|
-
end
|
|
45032
|
-
Fired when the speech recognition service has disconnected. Also available via the onend property.
|
|
45033
|
-
error
|
|
45034
|
-
Fired when a speech recognition error occurs. Also available via the onerror property.
|
|
45035
|
-
nomatch
|
|
45036
|
-
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.
|
|
45037
|
-
result
|
|
45038
|
-
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.
|
|
45039
|
-
soundstart
|
|
45040
|
-
Fired when any sound — recognizable speech or not — has been detected. Also available via the onsoundstart property.
|
|
45041
|
-
soundend
|
|
45042
|
-
Fired when any sound — recognizable speech or not — has stopped being detected. Also available via the onsoundend property.
|
|
45043
|
-
speechstart
|
|
45044
|
-
Fired when sound that is recognized by the speech recognition service as speech has been detected. Also available via the onspeechstart property.
|
|
45045
|
-
speechend
|
|
45046
|
-
Fired when speech recognized by the speech recognition service has stopped being detected. Also available via the onspeechend property.
|
|
45047
|
-
start
|
|
45048
|
-
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.
|
|
45049
45131
|
*/
|
|
45050
45132
|
this.recognizer_ = recognizer;
|
|
45051
45133
|
return recognizer;
|
|
@@ -45214,17 +45296,17 @@ const createLlmStore = config => {
|
|
|
45214
45296
|
return c(p);
|
|
45215
45297
|
}, {
|
|
45216
45298
|
...config
|
|
45217
|
-
/**
|
|
45218
|
-
* test remote api
|
|
45219
|
-
...({
|
|
45220
|
-
appKey: 'xxxxxxxxxxxxxx',
|
|
45221
|
-
apiKey: 'xxxxxxxxxxxxxx',
|
|
45222
|
-
threadId: 'xxxxxxxxxxxxxx',
|
|
45223
|
-
endpoint: 'https://platform.websolute.ai',
|
|
45224
|
-
endpoint: 'https://platform-ai-dev.ws-deploy-01.wslabs.it',
|
|
45225
|
-
endpoint: 'http://localhost:4000/bowl',
|
|
45226
|
-
test: false,
|
|
45227
|
-
}),
|
|
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
|
+
}),
|
|
45228
45310
|
*/
|
|
45229
45311
|
});
|
|
45230
45312
|
const {
|
|
@@ -45365,12 +45447,12 @@ const createLlmStore = config => {
|
|
|
45365
45447
|
}
|
|
45366
45448
|
const thread = MessageDecoder.decodeThread(app.thread);
|
|
45367
45449
|
const testTheme = test ? getMock(locale, test).app?.contents?.customTheme : {};
|
|
45368
|
-
/*
|
|
45369
|
-
console.log(
|
|
45370
|
-
'appTheme', app.contents.customTheme,
|
|
45371
|
-
'testTheme', testTheme,
|
|
45372
|
-
'customTheme', customTheme
|
|
45373
|
-
);
|
|
45450
|
+
/*
|
|
45451
|
+
console.log(
|
|
45452
|
+
'appTheme', app.contents.customTheme,
|
|
45453
|
+
'testTheme', testTheme,
|
|
45454
|
+
'customTheme', customTheme
|
|
45455
|
+
);
|
|
45374
45456
|
*/
|
|
45375
45457
|
const theme = getThemes([app.contents.customTheme, testTheme, customTheme], config.defaultTheme);
|
|
45376
45458
|
const mode = theme.mode;
|
|
@@ -45379,22 +45461,22 @@ const createLlmStore = config => {
|
|
|
45379
45461
|
// console.log('useLlm.storedHistory', storedHistory);
|
|
45380
45462
|
const history = await apiService.decorateHistory(storedHistory, mode);
|
|
45381
45463
|
// console.log('useLlm.history', history);
|
|
45382
|
-
/*
|
|
45383
|
-
// !!! session restored via threadId storage merge
|
|
45384
|
-
if (storageMode === 'session') {
|
|
45385
|
-
// console.log('storageMode', storageMode, history);
|
|
45386
|
-
if (history.length > 0) {
|
|
45387
|
-
thread = {
|
|
45388
|
-
threadId: history[0].threadId,
|
|
45389
|
-
messages: history[0].messages,
|
|
45390
|
-
};
|
|
45391
|
-
}
|
|
45392
|
-
}
|
|
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
|
+
}
|
|
45393
45475
|
*/
|
|
45394
|
-
/*
|
|
45395
|
-
console.log(
|
|
45396
|
-
'theme', theme
|
|
45397
|
-
);
|
|
45476
|
+
/*
|
|
45477
|
+
console.log(
|
|
45478
|
+
'theme', theme
|
|
45479
|
+
);
|
|
45398
45480
|
*/
|
|
45399
45481
|
const vars = getVars(theme);
|
|
45400
45482
|
createVars(vars);
|
|
@@ -45493,12 +45575,12 @@ const createLlmStore = config => {
|
|
|
45493
45575
|
};
|
|
45494
45576
|
const responseMessages = [...messages, assistantMessage];
|
|
45495
45577
|
// 15/12/2025 disabling form request feature, todo add payload flag
|
|
45496
|
-
/*
|
|
45497
|
-
if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
|
|
45498
|
-
chunks.push({
|
|
45499
|
-
type: 'formRequest',
|
|
45500
|
-
});
|
|
45501
|
-
}
|
|
45578
|
+
/*
|
|
45579
|
+
if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
|
|
45580
|
+
chunks.push({
|
|
45581
|
+
type: 'formRequest',
|
|
45582
|
+
});
|
|
45583
|
+
}
|
|
45502
45584
|
*/
|
|
45503
45585
|
// filtering history
|
|
45504
45586
|
const validChunks = chunks.filter(x => typeof x.type === 'string' && !['header', 'info', 'end', 'formRequest', 'formRecap', 'formRecapSuccess', 'formRecapError'].includes(x.type));
|
|
@@ -45766,10 +45848,10 @@ const createLlmStore = config => {
|
|
|
45766
45848
|
threadId: history.threadId,
|
|
45767
45849
|
message: history.assistant,
|
|
45768
45850
|
messages: history.messages
|
|
45769
|
-
/*
|
|
45770
|
-
messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
|
|
45771
|
-
[...state.messages, history.user, history.assistant] :
|
|
45772
|
-
state.messages,
|
|
45851
|
+
/*
|
|
45852
|
+
messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
|
|
45853
|
+
[...state.messages, history.user, history.assistant] :
|
|
45854
|
+
state.messages,
|
|
45773
45855
|
*/
|
|
45774
45856
|
}));
|
|
45775
45857
|
},
|
|
@@ -45813,10 +45895,10 @@ const createLlmStore = config => {
|
|
|
45813
45895
|
currentState.storedHistory = persistedState.storedHistory && [...persistedState.storedHistory];
|
|
45814
45896
|
currentState.speakEnabled = persistedState.speakEnabled || false;
|
|
45815
45897
|
speech.enabled = currentState.speakEnabled;
|
|
45816
|
-
/*
|
|
45817
|
-
if (persistedState.messages) {
|
|
45818
|
-
currentState.messages = [...persistedState.messages];
|
|
45819
|
-
}
|
|
45898
|
+
/*
|
|
45899
|
+
if (persistedState.messages) {
|
|
45900
|
+
currentState.messages = [...persistedState.messages];
|
|
45901
|
+
}
|
|
45820
45902
|
*/
|
|
45821
45903
|
currentState.hydrated = true;
|
|
45822
45904
|
// console.log('currentState', currentState);
|
|
@@ -46475,21 +46557,21 @@ function renderInstance(node, props, instance) {
|
|
|
46475
46557
|
if (!node.hasAttribute('data-llm')) {
|
|
46476
46558
|
node.setAttribute('data-llm', '');
|
|
46477
46559
|
|
|
46478
|
-
/*
|
|
46479
|
-
const host = node;
|
|
46480
|
-
const shadow = host.attachShadow({ mode: 'open' });
|
|
46481
|
-
const shadowRoot = document.createElement('div');
|
|
46482
|
-
if (typeof window !== 'undefined' && 'llms__' in window) {
|
|
46483
|
-
const llmStyle = (window['llms__'] || []) as string[];
|
|
46484
|
-
const adoptedStyleSheets = llmStyle.map(style => {
|
|
46485
|
-
const sheet = new CSSStyleSheet();
|
|
46486
|
-
sheet.replaceSync(style);
|
|
46487
|
-
return sheet;
|
|
46488
|
-
});
|
|
46489
|
-
shadow.adoptedStyleSheets = adoptedStyleSheets;
|
|
46490
|
-
}
|
|
46491
|
-
shadowRoot.setAttribute('data-llm', '');
|
|
46492
|
-
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);
|
|
46493
46575
|
*/
|
|
46494
46576
|
|
|
46495
46577
|
const root = client.createRoot(node);
|
|
@@ -46562,10 +46644,10 @@ function observeMutations(targetElement, callback) {
|
|
|
46562
46644
|
if (mutation.type === 'childList') {
|
|
46563
46645
|
callback(mutation);
|
|
46564
46646
|
}
|
|
46565
|
-
/*
|
|
46566
|
-
else if (mutation.type === 'attributes') {
|
|
46567
|
-
console.log(`The ${mutation.attributeName} attribute was modified.`);
|
|
46568
|
-
}
|
|
46647
|
+
/*
|
|
46648
|
+
else if (mutation.type === 'attributes') {
|
|
46649
|
+
console.log(`The ${mutation.attributeName} attribute was modified.`);
|
|
46650
|
+
}
|
|
46569
46651
|
*/
|
|
46570
46652
|
}
|
|
46571
46653
|
});
|