@websolutespa/bom-llm 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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) {
@@ -8135,7 +8135,7 @@
8135
8135
  }
8136
8136
  var jsxRuntimeExports = jsxRuntime.exports;
8137
8137
 
8138
- const [useLayout, LayoutContextProvider] = createGenericContext();
8138
+ const [useLayout_, LayoutContextProvider] = createGenericContext();
8139
8139
  function LayoutProvider(_ref) {
8140
8140
  let {
8141
8141
  children,
@@ -8147,6 +8147,7 @@
8147
8147
  children: children
8148
8148
  });
8149
8149
  }
8150
+ const useLayout = useLayout_;
8150
8151
 
8151
8152
  function useAutosizeTextArea(textAreaRef, value) {
8152
8153
  reactExports.useEffect(() => {
@@ -8792,41 +8793,41 @@
8792
8793
  }, locale);
8793
8794
  }
8794
8795
 
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
-
8796
+ /*
8797
+ import { useMemo } from 'react';
8798
+ import { useNumber } from '../useNumber/useNumber';
8799
+ import { useLayout } from '../useLayout/useLayout';
8800
+
8801
+ export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
8802
+ const layout = useLayout();
8803
+ const currentLocale = locale || layout.locale;
8804
+
8805
+ const formatter = useMemo(() => {
8806
+ const options = { style: 'currency', currency };
8807
+ const formatter = new Intl.NumberFormat(currentLocale, options).format;
8808
+ return formatter;
8809
+ }, [currency, currentLocale]);
8810
+
8811
+ return formatter;
8812
+ }
8813
+
8813
8814
  */
8814
8815
 
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
-
8816
+ /*
8817
+
8818
+ export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
8819
+
8820
+ const layout = useLayout();
8821
+
8822
+ const currentLocale = locale || layout.locale;
8823
+
8824
+ return useMemo(() => {
8825
+ const options = { style: 'currency', currency };
8826
+ const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
8827
+ return formattedValue;
8828
+ }, [value, currency, currentLocale]);
8829
+ }
8830
+
8830
8831
  */
8831
8832
 
8832
8833
  function useDateTimeFormat(options, locale) {
@@ -8901,13 +8902,13 @@
8901
8902
  return [state, setState];
8902
8903
  }
8903
8904
 
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.
8905
+ /**
8906
+ * KeyBinding Codes
8907
+ * The content of this file is based on the design of the open source project "microsoft/vscode",
8908
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8909
+ *
8910
+ * We inherit the KeyMod values from "microsoft/vscode",
8911
+ * but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
8911
8912
  */
8912
8913
 
8913
8914
  let KeyCode = /*#__PURE__*/function (KeyCode) {
@@ -9141,20 +9142,20 @@
9141
9142
  });
9142
9143
  }
9143
9144
 
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
- }
9145
+ /*
9146
+ import { useCallback, useEffect, useRef } from 'react';
9147
+
9148
+ export function useMounted(): () => boolean {
9149
+ const ref = useRef<boolean>(false);
9150
+ const get = useCallback(() => ref.current, []);
9151
+ useEffect(() => {
9152
+ ref.current = true;
9153
+ return () => {
9154
+ ref.current = false;
9155
+ };
9156
+ }, []);
9157
+ return get;
9158
+ }
9158
9159
  */
9159
9160
 
9160
9161
  function useMounted() {
@@ -19996,13 +19997,13 @@
19996
19997
  lastScrollTop = 0;
19997
19998
  }
19998
19999
  };
19999
- /*
20000
- if ('ResizeObserver' in window) {
20001
- const resizeObserver = new ResizeObserver((entries) => {
20002
- onScroll();
20003
- });
20004
- resizeObserver.observe(document.scrollingElement as HTMLElement);
20005
- }
20000
+ /*
20001
+ if ('ResizeObserver' in window) {
20002
+ const resizeObserver = new ResizeObserver((entries) => {
20003
+ onScroll();
20004
+ });
20005
+ resizeObserver.observe(document.scrollingElement as HTMLElement);
20006
+ }
20006
20007
  */
20007
20008
  window.addEventListener('scroll', onScroll);
20008
20009
  window.addEventListener('resize', onResize);
@@ -23352,11 +23353,11 @@ void main(void) {
23352
23353
  <img src="${href}"${title ? ` title="${title}"` : ''} alt="" />
23353
23354
  </a>`;
23354
23355
  }
23355
- /*
23356
- html(html: string, block?: boolean) {
23357
- console.log('html', html);
23358
- return html;
23359
- },
23356
+ /*
23357
+ html(html: string, block?: boolean) {
23358
+ console.log('html', html);
23359
+ return html;
23360
+ },
23360
23361
  */
23361
23362
  }
23362
23363
  });
@@ -31972,12 +31973,12 @@ void main(void) {
31972
31973
  return type.replace(/Item$/, '');
31973
31974
  }
31974
31975
 
31975
- /*
31976
- export type LlmChunkImage = {
31977
- type: 'image';
31978
- id: string;
31979
- src: string;
31980
- };
31976
+ /*
31977
+ export type LlmChunkImage = {
31978
+ type: 'image';
31979
+ id: string;
31980
+ src: string;
31981
+ };
31981
31982
  */
31982
31983
 
31983
31984
  // media
@@ -32000,11 +32001,11 @@ void main(void) {
32000
32001
 
32001
32002
  // !!! todo move to bom-core
32002
32003
 
32003
- /*
32004
- export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
32005
- type: LlmChunkUnknownItemType;
32006
- id: IEquatable;
32007
- };
32004
+ /*
32005
+ export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
32006
+ type: LlmChunkUnknownItemType;
32007
+ id: IEquatable;
32008
+ };
32008
32009
  */
32009
32010
 
32010
32011
  // !!! todo
@@ -32013,55 +32014,55 @@ void main(void) {
32013
32014
  // type StuctureMappedType<T extends LlmChunkType> = { [K in T]: Array<LlmChunkItem<K>> };
32014
32015
  // export type LlmChunkItems<T extends LlmChunkType = LlmChunkType> = Record<T, (item: Extract<LlmChunkItem, { type: T }>) => string>;
32015
32016
 
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
- };
32017
+ /*
32018
+ export type LlmThemeItem = Record<string, CSSProperties> & {
32019
+ [key: string]: string | boolean | number;
32020
+ };
32021
+
32022
+ export type LlmThemeTypography = Omit<CSSProperties, 'textTransform'> & {
32023
+ family?: CSSProperties['fontFamily'];
32024
+ size?: CSSProperties['fontSize'];
32025
+ weight?: CSSProperties['fontWeight'];
32026
+ fontSizeMin?: string;
32027
+ fontSizeMax?: string;
32028
+ textTransform?: string;
32029
+ };
32030
+
32031
+ export type LlmThemeColor = {
32032
+ [key: string]: CSSProperties['color'] | LlmThemeColor;
32033
+ };
32034
+
32035
+ export type LlmThemeProps = {
32036
+ mode?: string;
32037
+ scale?: number;
32038
+ font?: {
32039
+ primary: CSSProperties['fontFamily'];
32040
+ secondary: CSSProperties['fontFamily'];
32041
+ source: string;
32042
+ };
32043
+ typography?: Record<string, LlmThemeTypography>,
32044
+ color?: LlmThemeColor;
32045
+ canvas?: {
32046
+ opacity?: number;
32047
+ enabled?: boolean;
32048
+ };
32049
+ border?: CSSProperties['border'];
32050
+ toaster?: ToasterProps['theme'];
32051
+ };
32051
32052
  */
32052
32053
 
32053
- /*
32054
- export type LlmTheme = Omit<{
32055
- [key: string]: LlmThemeItem | CSSProperties;
32056
- }, keyof LlmThemeProps> & LlmThemeProps;
32054
+ /*
32055
+ export type LlmTheme = Omit<{
32056
+ [key: string]: LlmThemeItem | CSSProperties;
32057
+ }, keyof LlmThemeProps> & LlmThemeProps;
32057
32058
  */
32058
32059
 
32059
- /*
32060
- export type LlmThemeBase = {
32061
- [key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
32062
- };
32063
-
32064
- export type LlmTheme = LlmThemeBase & LlmThemeProps;
32060
+ /*
32061
+ export type LlmThemeBase = {
32062
+ [key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
32063
+ };
32064
+
32065
+ export type LlmTheme = LlmThemeBase & LlmThemeProps;
32065
32066
  */
32066
32067
 
32067
32068
  const LLM_DEFAULT_MIME_TYPES = '.jpg, .jpeg, .png, .svg, .webp, .txt, .md, .pdf, .csv, .doc, .xls, .ppt';
@@ -32296,14 +32297,14 @@ void main(void) {
32296
32297
  const feedbackType = type || theme.feedback?.type || 'stars';
32297
32298
  const classNames = getClassNames('llm__feedback', `llm__feedback--${feedbackType}`);
32298
32299
 
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
- };
32300
+ /*
32301
+ const [feedbackRating, setFeedbackRating] = useState<number>();
32302
+ const onRating = async (event: ChangeEvent<HTMLInputElement>) => {
32303
+ console.log(event.currentTarget);
32304
+ const value = String(event.currentTarget.value);
32305
+ const rating = parseInt(value);
32306
+ setFeedbackRating(rating);
32307
+ };
32307
32308
  */
32308
32309
 
32309
32310
  const onSubmit = async event => {
@@ -32440,8 +32441,8 @@ void main(void) {
32440
32441
  });
32441
32442
  };
32442
32443
 
32443
- /*
32444
- <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
32444
+ /*
32445
+ <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
32445
32446
  */
32446
32447
  const Font = () => {
32447
32448
  const theme = useLlm(state => state.theme);
@@ -41524,10 +41525,10 @@ void main(void) {
41524
41525
  window.scrollTo({
41525
41526
  top: 0
41526
41527
  });
41527
- /*
41528
- if (ref.current) {
41529
- ref.current.scrollIntoView();
41530
- }
41528
+ /*
41529
+ if (ref.current) {
41530
+ ref.current.scrollIntoView();
41531
+ }
41531
41532
  */
41532
41533
  }, [message, hasValidChunks]);
41533
41534
  const classNames = getClassNames(style$2.thread);
@@ -42005,15 +42006,15 @@ void main(void) {
42005
42006
  }
42006
42007
  },
42007
42008
  start: () => {
42008
- /*
42009
- if (innerRef.current) {
42010
- }
42009
+ /*
42010
+ if (innerRef.current) {
42011
+ }
42011
42012
  */
42012
42013
  },
42013
42014
  stop: () => {
42014
- /*
42015
- if (innerRef.current) {
42016
- }
42015
+ /*
42016
+ if (innerRef.current) {
42017
+ }
42017
42018
  */
42018
42019
  }
42019
42020
  });
@@ -42202,30 +42203,30 @@ void main(void) {
42202
42203
  });
42203
42204
  };
42204
42205
 
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>
42206
+ /*
42207
+
42208
+ const swiperProps = {
42209
+ modules: [FreeMode],
42210
+ spaceBetween: 8,
42211
+ freeMode: true,
42212
+ slidesPerView: 'auto' as const,
42213
+ slidesOffsetAfter: clamp(20, 110),
42214
+ slidesOffsetBefore: clamp(20, 110),
42215
+ };
42216
+
42217
+ <section className="llm__prompt-suggestions">
42218
+ <div className="llm__suggestions">
42219
+ <Swiper {...swiperProps} onInit={swiper => swiper.update()}>
42220
+ {app?.contents.sampleInputTexts?.map((s, j) => (
42221
+ <SwiperSlide key={j}>
42222
+ <button type="button" className="llm__pill" onClick={() => onClick(s)}>
42223
+ {s.sampleInputText}
42224
+ </button>
42225
+ </SwiperSlide>
42226
+ ))}
42227
+ </Swiper>
42228
+ </div>
42229
+ </section>
42229
42230
  */
42230
42231
 
42231
42232
  const Thread = () => {
@@ -42325,9 +42326,9 @@ void main(void) {
42325
42326
  duration: 0.4
42326
42327
  },
42327
42328
  "aria-label": "Trigger"
42328
- /*
42329
- aria-expanded={opened}
42330
- aria-controls={mainId}
42329
+ /*
42330
+ aria-expanded={opened}
42331
+ aria-controls={mainId}
42331
42332
  */,
42332
42333
  onClick: () => open(),
42333
42334
  children: [/*#__PURE__*/jsxRuntimeExports.jsxs("button", {
@@ -43514,13 +43515,13 @@ ${Object.entries(vars).map(_ref2 => {
43514
43515
  decodeMessages(messages) {
43515
43516
  return messages.map(x => {
43516
43517
  if (Array.isArray(x.content)) {
43517
- /*
43518
- if (x.role === 'user') {
43519
- return ({
43520
- ...x,
43521
- chunks: x.content.map(x => this.decodeChunk(x)),
43522
- });
43523
- }
43518
+ /*
43519
+ if (x.role === 'user') {
43520
+ return ({
43521
+ ...x,
43522
+ chunks: x.content.map(x => this.decodeChunk(x)),
43523
+ });
43524
+ }
43524
43525
  */
43525
43526
  return {
43526
43527
  ...x,
@@ -43761,163 +43762,163 @@ ${Object.entries(vars).map(_ref2 => {
43761
43762
  return chunkItems;
43762
43763
  }
43763
43764
 
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
- }
43765
+ /*
43766
+ chunksToChunkItems___(chunks: LlmChunk[], response?: StreamResponse): LlmChunkItem[] {
43767
+ const chunkItems: LlmChunkItem[] = [];
43768
+ chunks.forEach(x => {
43769
+ const chunk: LlmChunkItem = typeof x === 'string' ? { type: 'text', text: x } : x;
43770
+ const lastMessage = chunkItems[chunkItems.length - 1];
43771
+ switch (chunk.type) {
43772
+ case 'text':
43773
+ if (lastMessage && isChunkText(lastMessage)) {
43774
+ const text = chunk.text;
43775
+ const lastChunkText = lastMessage;
43776
+ if (chunkItems.indexOf(lastChunkText) > 0) {
43777
+ // secondary chunk
43778
+ lastChunkText.text += text;
43779
+ } else if (!lastChunkText.text.includes('\n')) {
43780
+ // uncompleted first chunk
43781
+ if (text.includes('\n')) {
43782
+ const lines = text.split('\n');
43783
+ lines.forEach((line, i) => {
43784
+ const lastChar = (lines.length > i + 1) ? '\n' : '';
43785
+ if (i === 0) {
43786
+ lastChunkText.text += line + lastChar;
43787
+ } else if (line.length > 0) {
43788
+ chunkItems.push({
43789
+ type: 'text',
43790
+ text: line + lastChar,
43791
+ });
43792
+ }
43793
+ });
43794
+ } else {
43795
+ // uncompleted first chunk
43796
+ lastChunkText.text += text;
43797
+ }
43798
+ } else {
43799
+ // completed first chunk
43800
+ chunkItems.push(chunk);
43801
+ }
43802
+ } else {
43803
+ // new text chunk
43804
+ chunkItems.push(chunk);
43805
+ }
43806
+ break;
43807
+ case 'log':
43808
+ break;
43809
+ case 'error':
43810
+ chunkItems.push(chunk);
43811
+ break;
43812
+ case 'header': {
43813
+ const { type, ...rest } = chunk;
43814
+ if (response) {
43815
+ Object.assign(response, rest);
43816
+ }
43817
+ // console.log('header', response);
43818
+ }
43819
+ break;
43820
+ case 'info': {
43821
+ if (response) {
43822
+ // !!! deprecated
43823
+ response.threadId = chunk.threadId || response.threadId;
43824
+ }
43825
+ }
43826
+ break;
43827
+ case 'end':
43828
+ break;
43829
+ case 'action':
43830
+ case 'actionItem':
43831
+ if (lastMessage && lastMessage.type === 'actionGroup') {
43832
+ lastMessage.items.push(chunk);
43833
+ } else {
43834
+ chunkItems.push({
43835
+ type: 'actionGroup',
43836
+ items: [chunk],
43837
+ });
43838
+ }
43839
+ break;
43840
+ case 'cardItem':
43841
+ if (lastMessage && lastMessage.type === 'cardGroup') {
43842
+ lastMessage.items.push(chunk);
43843
+ } else {
43844
+ chunkItems.push({
43845
+ type: 'cardGroup',
43846
+ items: [chunk],
43847
+ });
43848
+ }
43849
+ break;
43850
+ case 'productItem':
43851
+ if (lastMessage && lastMessage.type === 'productGroup') {
43852
+ lastMessage.items.push(chunk);
43853
+ } else {
43854
+ chunkItems.push({
43855
+ type: 'productGroup',
43856
+ items: [chunk],
43857
+ });
43858
+ }
43859
+ break;
43860
+ case 'eventItem':
43861
+ if (lastMessage && lastMessage.type === 'eventGroup') {
43862
+ lastMessage.items.push(chunk);
43863
+ } else {
43864
+ chunkItems.push({
43865
+ type: 'eventGroup',
43866
+ items: [chunk],
43867
+ });
43868
+ }
43869
+ break;
43870
+ case 'poiItem':
43871
+ if (lastMessage && lastMessage.type === 'poiGroup') {
43872
+ lastMessage.items.push(chunk);
43873
+ } else {
43874
+ chunkItems.push({
43875
+ type: 'poiGroup',
43876
+ items: [chunk],
43877
+ });
43878
+ }
43879
+ break;
43880
+ case 'tripadvisor':
43881
+ case 'tripadvisorItem':
43882
+ if (lastMessage && lastMessage.type === 'tripadvisorGroup') {
43883
+ lastMessage.items.push({
43884
+ ...chunk,
43885
+ type: 'tripadvisorItem',
43886
+ });
43887
+ } else {
43888
+ chunkItems.push({
43889
+ type: 'tripadvisorGroup',
43890
+ items: [{
43891
+ ...chunk,
43892
+ type: 'tripadvisorItem',
43893
+ }],
43894
+ });
43895
+ }
43896
+ break;
43897
+ default:
43898
+ if (
43899
+ typeof chunk.type === 'string' &&
43900
+ chunk.type.match(/Item$/)
43901
+ ) {
43902
+ const baseName = chunk.type.replace('Item', '');
43903
+ const groupName = `${baseName}Group`;
43904
+ if (lastMessage && lastMessage.type === groupName) {
43905
+ (lastMessage as { items: (typeof x)[] }).items.push(x);
43906
+ } else {
43907
+ chunkItems.push({
43908
+ type: groupName,
43909
+ items: [{
43910
+ ...chunk,
43911
+ type: baseName,
43912
+ }],
43913
+ } as unknown as LlmChunkUnknownItem);
43914
+ }
43915
+ } else {
43916
+ chunkItems.push(chunk);
43917
+ }
43918
+ }
43919
+ });
43920
+ return chunkItems;
43921
+ }
43921
43922
  */
43922
43923
 
43923
43924
  static decodeThread(thread) {
@@ -44072,10 +44073,10 @@ ${Object.entries(vars).map(_ref2 => {
44072
44073
  return;
44073
44074
  }
44074
44075
  const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
44075
- /*
44076
- if (error instanceof TypeError) {
44077
- errorMessage = 'TypeError: Browser may not support async iteration';
44078
- }
44076
+ /*
44077
+ if (error instanceof TypeError) {
44078
+ errorMessage = 'TypeError: Browser may not support async iteration';
44079
+ }
44079
44080
  */
44080
44081
  if (typeof onEnd === 'function') {
44081
44082
  const errorChunk = {
@@ -44194,10 +44195,10 @@ ${Object.entries(vars).map(_ref2 => {
44194
44195
  } catch (error) {
44195
44196
  console.error('MessageService.mockMessage.error', error);
44196
44197
  const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
44197
- /*
44198
- if (error instanceof TypeError) {
44199
- errorMessage = 'TypeError: Browser may not support async iteration';
44200
- }
44198
+ /*
44199
+ if (error instanceof TypeError) {
44200
+ errorMessage = 'TypeError: Browser may not support async iteration';
44201
+ }
44201
44202
  */
44202
44203
  if (typeof onEnd === 'function') {
44203
44204
  const errorChunk = {
@@ -44252,36 +44253,36 @@ ${Object.entries(vars).map(_ref2 => {
44252
44253
  };
44253
44254
  }
44254
44255
 
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
- };
44256
+ /*
44257
+ async function* streamAsyncIterable<T>(stream: ReadableStream<T>) {
44258
+ const reader = stream.getReader();
44259
+ try {
44260
+ while (true) {
44261
+ const { done, value } = await reader.read();
44262
+ if (done) return;
44263
+ yield value;
44264
+ }
44265
+ } finally {
44266
+ reader.releaseLock();
44267
+ }
44268
+ }
44269
+
44270
+ class Iterator {
44271
+ }
44272
+
44273
+ (Iterator as any).prototype[Symbol.asyncIterator] = async function* () {
44274
+ const reader = this.getReader();
44275
+ try {
44276
+ while (true) {
44277
+ const { done, value } = await reader.read();
44278
+ if (done) return;
44279
+ yield value;
44280
+ }
44281
+ }
44282
+ finally {
44283
+ reader.releaseLock();
44284
+ }
44285
+ };
44285
44286
  */
44286
44287
 
44287
44288
  class ApiService {
@@ -44884,19 +44885,19 @@ ${Object.entries(vars).map(_ref2 => {
44884
44885
  utterance.onerror = error => {
44885
44886
  console.warn('DefaultTextToSpeech.speak.onerror', error);
44886
44887
  };
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
- };
44888
+ /*
44889
+ utterance.onboundary = (event) => {
44890
+ console.log('DefaultTextToSpeech.speak.onboundary', event);
44891
+ };
44892
+ utterance.onmark = (event) => {
44893
+ console.log('DefaultTextToSpeech.speak.onmark', event);
44894
+ };
44895
+ utterance.onpause = (event) => {
44896
+ console.log('DefaultTextToSpeech.speak.onpause', event);
44897
+ };
44898
+ utterance.onresume = (event) => {
44899
+ console.log('DefaultTextToSpeech.speak.onresume', event);
44900
+ };
44900
44901
  */
44901
44902
  utterance.voice = voice;
44902
44903
  utterance.pitch = pitch;
@@ -45080,12 +45081,12 @@ ${Object.entries(vars).map(_ref2 => {
45080
45081
  return this.recognizer_;
45081
45082
  } else {
45082
45083
  const recognizer = new this.recognition();
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;
45084
+ /*
45085
+ const grammar =
45086
+ "#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 ;";
45087
+ const grammarList = new this.grammarList();
45088
+ grammarList.addFromString(grammar, 1);
45089
+ recognizer.grammars = grammarList;
45089
45090
  */
45090
45091
  recognizer.lang = this.lang; // "en-US";
45091
45092
  recognizer.continuous = true;
@@ -45103,37 +45104,37 @@ ${Object.entries(vars).map(_ref2 => {
45103
45104
  // console.log('recognizer.result');
45104
45105
  this.onResult(event);
45105
45106
  });
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
- });
45107
+ /*
45108
+ recognizer.addEventListener("audioend", (event) => {
45109
+ this.log('recognizer', "audioend", event);
45110
+ });
45111
+ recognizer.addEventListener("speechend", (event) => {
45112
+ this.log('recognizer', "speechend", event);
45113
+ });
45113
45114
  */
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.
45115
+ /*
45116
+ audiostart
45117
+ Fired when the user agent has started to capture audio. Also available via the onaudiostart property.
45118
+ audioend
45119
+ Fired when the user agent has finished capturing audio. Also available via the onaudioend property.
45120
+ end
45121
+ Fired when the speech recognition service has disconnected. Also available via the onend property.
45122
+ error
45123
+ Fired when a speech recognition error occurs. Also available via the onerror property.
45124
+ nomatch
45125
+ 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.
45126
+ result
45127
+ 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.
45128
+ soundstart
45129
+ Fired when any sound — recognizable speech or not — has been detected. Also available via the onsoundstart property.
45130
+ soundend
45131
+ Fired when any sound — recognizable speech or not — has stopped being detected. Also available via the onsoundend property.
45132
+ speechstart
45133
+ Fired when sound that is recognized by the speech recognition service as speech has been detected. Also available via the onspeechstart property.
45134
+ speechend
45135
+ Fired when speech recognized by the speech recognition service has stopped being detected. Also available via the onspeechend property.
45136
+ start
45137
+ 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.
45137
45138
  */
45138
45139
  this.recognizer_ = recognizer;
45139
45140
  return recognizer;
@@ -45302,17 +45303,17 @@ ${Object.entries(vars).map(_ref2 => {
45302
45303
  return c(p);
45303
45304
  }, {
45304
45305
  ...config
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
- }),
45306
+ /**
45307
+ * test remote api
45308
+ ...({
45309
+ appKey: 'xxxxxxxxxxxxxx',
45310
+ apiKey: 'xxxxxxxxxxxxxx',
45311
+ threadId: 'xxxxxxxxxxxxxx',
45312
+ endpoint: 'https://platform.websolute.ai',
45313
+ endpoint: 'https://platform-ai-dev.ws-deploy-01.wslabs.it',
45314
+ endpoint: 'http://localhost:4000/bowl',
45315
+ test: false,
45316
+ }),
45316
45317
  */
45317
45318
  });
45318
45319
  const {
@@ -45327,6 +45328,7 @@ ${Object.entries(vars).map(_ref2 => {
45327
45328
  decorateUrl,
45328
45329
  label,
45329
45330
  onAction,
45331
+ onMessage,
45330
45332
  ...options
45331
45333
  } = sanitizedConfig;
45332
45334
  const theme = getThemes([customTheme], config.defaultTheme);
@@ -45453,12 +45455,12 @@ ${Object.entries(vars).map(_ref2 => {
45453
45455
  }
45454
45456
  const thread = MessageDecoder.decodeThread(app.thread);
45455
45457
  const testTheme = test ? getMock(locale, test).app?.contents?.customTheme : {};
45456
- /*
45457
- console.log(
45458
- 'appTheme', app.contents.customTheme,
45459
- 'testTheme', testTheme,
45460
- 'customTheme', customTheme
45461
- );
45458
+ /*
45459
+ console.log(
45460
+ 'appTheme', app.contents.customTheme,
45461
+ 'testTheme', testTheme,
45462
+ 'customTheme', customTheme
45463
+ );
45462
45464
  */
45463
45465
  const theme = getThemes([app.contents.customTheme, testTheme, customTheme], config.defaultTheme);
45464
45466
  const mode = theme.mode;
@@ -45467,22 +45469,22 @@ ${Object.entries(vars).map(_ref2 => {
45467
45469
  // console.log('useLlm.storedHistory', storedHistory);
45468
45470
  const history = await apiService.decorateHistory(storedHistory, mode);
45469
45471
  // console.log('useLlm.history', history);
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
- }
45472
+ /*
45473
+ // !!! session restored via threadId storage merge
45474
+ if (storageMode === 'session') {
45475
+ // console.log('storageMode', storageMode, history);
45476
+ if (history.length > 0) {
45477
+ thread = {
45478
+ threadId: history[0].threadId,
45479
+ messages: history[0].messages,
45480
+ };
45481
+ }
45482
+ }
45481
45483
  */
45482
- /*
45483
- console.log(
45484
- 'theme', theme
45485
- );
45484
+ /*
45485
+ console.log(
45486
+ 'theme', theme
45487
+ );
45486
45488
  */
45487
45489
  const vars = getVars(theme);
45488
45490
  createVars(vars);
@@ -45566,6 +45568,7 @@ ${Object.entries(vars).map(_ref2 => {
45566
45568
  if (typeof onMessage === 'function') {
45567
45569
  onMessage(response);
45568
45570
  }
45571
+ state.actions.onMessage(response);
45569
45572
  },
45570
45573
  // onEnd
45571
45574
  response => {
@@ -45581,12 +45584,12 @@ ${Object.entries(vars).map(_ref2 => {
45581
45584
  };
45582
45585
  const responseMessages = [...messages, assistantMessage];
45583
45586
  // 15/12/2025 disabling form request feature, todo add payload flag
45584
- /*
45585
- if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
45586
- chunks.push({
45587
- type: 'formRequest',
45588
- });
45589
- }
45587
+ /*
45588
+ if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
45589
+ chunks.push({
45590
+ type: 'formRequest',
45591
+ });
45592
+ }
45590
45593
  */
45591
45594
  // filtering history
45592
45595
  const validChunks = chunks.filter(x => typeof x.type === 'string' && !['header', 'info', 'end', 'formRequest', 'formRecap', 'formRecapSuccess', 'formRecapError'].includes(x.type));
@@ -45854,10 +45857,10 @@ ${Object.entries(vars).map(_ref2 => {
45854
45857
  threadId: history.threadId,
45855
45858
  message: history.assistant,
45856
45859
  messages: history.messages
45857
- /*
45858
- messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
45859
- [...state.messages, history.user, history.assistant] :
45860
- state.messages,
45860
+ /*
45861
+ messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
45862
+ [...state.messages, history.user, history.assistant] :
45863
+ state.messages,
45861
45864
  */
45862
45865
  }));
45863
45866
  },
@@ -45867,6 +45870,12 @@ ${Object.entries(vars).map(_ref2 => {
45867
45870
  }
45868
45871
  return;
45869
45872
  },
45873
+ onMessage: async message => {
45874
+ if (typeof onMessage === 'function') {
45875
+ return await onMessage(message);
45876
+ }
45877
+ return;
45878
+ },
45870
45879
  clear: () => {
45871
45880
  const {
45872
45881
  abort
@@ -45901,10 +45910,10 @@ ${Object.entries(vars).map(_ref2 => {
45901
45910
  currentState.storedHistory = persistedState.storedHistory && [...persistedState.storedHistory];
45902
45911
  currentState.speakEnabled = persistedState.speakEnabled || false;
45903
45912
  speech.enabled = currentState.speakEnabled;
45904
- /*
45905
- if (persistedState.messages) {
45906
- currentState.messages = [...persistedState.messages];
45907
- }
45913
+ /*
45914
+ if (persistedState.messages) {
45915
+ currentState.messages = [...persistedState.messages];
45916
+ }
45908
45917
  */
45909
45918
  currentState.hydrated = true;
45910
45919
  // console.log('currentState', currentState);
@@ -46478,6 +46487,13 @@ ${Object.entries(vars).map(_ref2 => {
46478
46487
  id: data.market,
46479
46488
  title: data.market
46480
46489
  }],
46490
+ app: {
46491
+ id: 'app',
46492
+ brand: {
46493
+ name: 'Mixer',
46494
+ social: []
46495
+ }
46496
+ },
46481
46497
  menu: {},
46482
46498
  topLevelHrefs: {},
46483
46499
  topLevelRoutes: {}
@@ -46563,21 +46579,21 @@ ${Object.entries(vars).map(_ref2 => {
46563
46579
  if (!node.hasAttribute('data-llm')) {
46564
46580
  node.setAttribute('data-llm', '');
46565
46581
 
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);
46582
+ /*
46583
+ const host = node;
46584
+ const shadow = host.attachShadow({ mode: 'open' });
46585
+ const shadowRoot = document.createElement('div');
46586
+ if (typeof window !== 'undefined' && 'llms__' in window) {
46587
+ const llmStyle = (window['llms__'] || []) as string[];
46588
+ const adoptedStyleSheets = llmStyle.map(style => {
46589
+ const sheet = new CSSStyleSheet();
46590
+ sheet.replaceSync(style);
46591
+ return sheet;
46592
+ });
46593
+ shadow.adoptedStyleSheets = adoptedStyleSheets;
46594
+ }
46595
+ shadowRoot.setAttribute('data-llm', '');
46596
+ shadow.appendChild(shadowRoot);
46581
46597
  */
46582
46598
 
46583
46599
  const root = client.createRoot(node);
@@ -46650,10 +46666,10 @@ ${Object.entries(vars).map(_ref2 => {
46650
46666
  if (mutation.type === 'childList') {
46651
46667
  callback(mutation);
46652
46668
  }
46653
- /*
46654
- else if (mutation.type === 'attributes') {
46655
- console.log(`The ${mutation.attributeName} attribute was modified.`);
46656
- }
46669
+ /*
46670
+ else if (mutation.type === 'attributes') {
46671
+ console.log(`The ${mutation.attributeName} attribute was modified.`);
46672
+ }
46657
46673
  */
46658
46674
  }
46659
46675
  });