@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/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) {
@@ -8129,7 +8129,7 @@ reactJsxRuntime_production_min.jsxs = q$2;
8129
8129
  }
8130
8130
  var jsxRuntimeExports = jsxRuntime.exports;
8131
8131
 
8132
- const [useLayout, LayoutContextProvider] = createGenericContext();
8132
+ const [useLayout_, LayoutContextProvider] = createGenericContext();
8133
8133
  function LayoutProvider(_ref) {
8134
8134
  let {
8135
8135
  children,
@@ -8141,6 +8141,7 @@ function LayoutProvider(_ref) {
8141
8141
  children: children
8142
8142
  });
8143
8143
  }
8144
+ const useLayout = useLayout_;
8144
8145
 
8145
8146
  function useAutosizeTextArea(textAreaRef, value) {
8146
8147
  reactExports.useEffect(() => {
@@ -8786,41 +8787,41 @@ function useCurrency(currency, locale) {
8786
8787
  }, locale);
8787
8788
  }
8788
8789
 
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
-
8790
+ /*
8791
+ import { useMemo } from 'react';
8792
+ import { useNumber } from '../useNumber/useNumber';
8793
+ import { useLayout } from '../useLayout/useLayout';
8794
+
8795
+ export function useCurrency(currency: string = 'EUR', locale?: string): (value: number) => string {
8796
+ const layout = useLayout();
8797
+ const currentLocale = locale || layout.locale;
8798
+
8799
+ const formatter = useMemo(() => {
8800
+ const options = { style: 'currency', currency };
8801
+ const formatter = new Intl.NumberFormat(currentLocale, options).format;
8802
+ return formatter;
8803
+ }, [currency, currentLocale]);
8804
+
8805
+ return formatter;
8806
+ }
8807
+
8807
8808
  */
8808
8809
 
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
-
8810
+ /*
8811
+
8812
+ export function useCurrency(value: number, currency: string = 'EUR', locale?: string): string {
8813
+
8814
+ const layout = useLayout();
8815
+
8816
+ const currentLocale = locale || layout.locale;
8817
+
8818
+ return useMemo(() => {
8819
+ const options = { style: 'currency', currency };
8820
+ const formattedValue = new Intl.NumberFormat(currentLocale, options).format(value);
8821
+ return formattedValue;
8822
+ }, [value, currency, currentLocale]);
8823
+ }
8824
+
8824
8825
  */
8825
8826
 
8826
8827
  function useDateTimeFormat(options, locale) {
@@ -8895,13 +8896,13 @@ function useFocusTrap$1(ref, options) {
8895
8896
  return [state, setState];
8896
8897
  }
8897
8898
 
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.
8899
+ /**
8900
+ * KeyBinding Codes
8901
+ * The content of this file is based on the design of the open source project "microsoft/vscode",
8902
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8903
+ *
8904
+ * We inherit the KeyMod values from "microsoft/vscode",
8905
+ * but use the Browser's KeyboardEvent event implementation, and all values are used only as identification.
8905
8906
  */
8906
8907
 
8907
8908
  let KeyCode = /*#__PURE__*/function (KeyCode) {
@@ -9135,20 +9136,20 @@ function parseParams(label, params) {
9135
9136
  });
9136
9137
  }
9137
9138
 
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
- }
9139
+ /*
9140
+ import { useCallback, useEffect, useRef } from 'react';
9141
+
9142
+ export function useMounted(): () => boolean {
9143
+ const ref = useRef<boolean>(false);
9144
+ const get = useCallback(() => ref.current, []);
9145
+ useEffect(() => {
9146
+ ref.current = true;
9147
+ return () => {
9148
+ ref.current = false;
9149
+ };
9150
+ }, []);
9151
+ return get;
9152
+ }
9152
9153
  */
9153
9154
 
9154
9155
  function useMounted() {
@@ -19990,13 +19991,13 @@ const createLlmViewStore = _ref => {
19990
19991
  lastScrollTop = 0;
19991
19992
  }
19992
19993
  };
19993
- /*
19994
- if ('ResizeObserver' in window) {
19995
- const resizeObserver = new ResizeObserver((entries) => {
19996
- onScroll();
19997
- });
19998
- resizeObserver.observe(document.scrollingElement as HTMLElement);
19999
- }
19994
+ /*
19995
+ if ('ResizeObserver' in window) {
19996
+ const resizeObserver = new ResizeObserver((entries) => {
19997
+ onScroll();
19998
+ });
19999
+ resizeObserver.observe(document.scrollingElement as HTMLElement);
20000
+ }
20000
20001
  */
20001
20002
  window.addEventListener('scroll', onScroll);
20002
20003
  window.addEventListener('resize', onResize);
@@ -23346,11 +23347,11 @@ const Text = props => {
23346
23347
  <img src="${href}"${title ? ` title="${title}"` : ''} alt="" />
23347
23348
  </a>`;
23348
23349
  }
23349
- /*
23350
- html(html: string, block?: boolean) {
23351
- console.log('html', html);
23352
- return html;
23353
- },
23350
+ /*
23351
+ html(html: string, block?: boolean) {
23352
+ console.log('html', html);
23353
+ return html;
23354
+ },
23354
23355
  */
23355
23356
  }
23356
23357
  });
@@ -31966,12 +31967,12 @@ function sanitizeBlockType(type) {
31966
31967
  return type.replace(/Item$/, '');
31967
31968
  }
31968
31969
 
31969
- /*
31970
- export type LlmChunkImage = {
31971
- type: 'image';
31972
- id: string;
31973
- src: string;
31974
- };
31970
+ /*
31971
+ export type LlmChunkImage = {
31972
+ type: 'image';
31973
+ id: string;
31974
+ src: string;
31975
+ };
31975
31976
  */
31976
31977
 
31977
31978
  // media
@@ -31994,11 +31995,11 @@ export type LlmChunkImage = {
31994
31995
 
31995
31996
  // !!! todo move to bom-core
31996
31997
 
31997
- /*
31998
- export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
31999
- type: LlmChunkUnknownItemType;
32000
- id: IEquatable;
32001
- };
31998
+ /*
31999
+ export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> & {
32000
+ type: LlmChunkUnknownItemType;
32001
+ id: IEquatable;
32002
+ };
32002
32003
  */
32003
32004
 
32004
32005
  // !!! todo
@@ -32007,55 +32008,55 @@ export type LlmChunkUnknownItem = Omit<Record<string, unknown>, 'type' | 'id'> &
32007
32008
  // type StuctureMappedType<T extends LlmChunkType> = { [K in T]: Array<LlmChunkItem<K>> };
32008
32009
  // export type LlmChunkItems<T extends LlmChunkType = LlmChunkType> = Record<T, (item: Extract<LlmChunkItem, { type: T }>) => string>;
32009
32010
 
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
- };
32011
+ /*
32012
+ export type LlmThemeItem = Record<string, CSSProperties> & {
32013
+ [key: string]: string | boolean | number;
32014
+ };
32015
+
32016
+ export type LlmThemeTypography = Omit<CSSProperties, 'textTransform'> & {
32017
+ family?: CSSProperties['fontFamily'];
32018
+ size?: CSSProperties['fontSize'];
32019
+ weight?: CSSProperties['fontWeight'];
32020
+ fontSizeMin?: string;
32021
+ fontSizeMax?: string;
32022
+ textTransform?: string;
32023
+ };
32024
+
32025
+ export type LlmThemeColor = {
32026
+ [key: string]: CSSProperties['color'] | LlmThemeColor;
32027
+ };
32028
+
32029
+ export type LlmThemeProps = {
32030
+ mode?: string;
32031
+ scale?: number;
32032
+ font?: {
32033
+ primary: CSSProperties['fontFamily'];
32034
+ secondary: CSSProperties['fontFamily'];
32035
+ source: string;
32036
+ };
32037
+ typography?: Record<string, LlmThemeTypography>,
32038
+ color?: LlmThemeColor;
32039
+ canvas?: {
32040
+ opacity?: number;
32041
+ enabled?: boolean;
32042
+ };
32043
+ border?: CSSProperties['border'];
32044
+ toaster?: ToasterProps['theme'];
32045
+ };
32045
32046
  */
32046
32047
 
32047
- /*
32048
- export type LlmTheme = Omit<{
32049
- [key: string]: LlmThemeItem | CSSProperties;
32050
- }, keyof LlmThemeProps> & LlmThemeProps;
32048
+ /*
32049
+ export type LlmTheme = Omit<{
32050
+ [key: string]: LlmThemeItem | CSSProperties;
32051
+ }, keyof LlmThemeProps> & LlmThemeProps;
32051
32052
  */
32052
32053
 
32053
- /*
32054
- export type LlmThemeBase = {
32055
- [key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
32056
- };
32057
-
32058
- export type LlmTheme = LlmThemeBase & LlmThemeProps;
32054
+ /*
32055
+ export type LlmThemeBase = {
32056
+ [key: string]: CSSProperties | string | number | boolean | LlmThemeBase;
32057
+ };
32058
+
32059
+ export type LlmTheme = LlmThemeBase & LlmThemeProps;
32059
32060
  */
32060
32061
 
32061
32062
  const LLM_DEFAULT_MIME_TYPES = '.jpg, .jpeg, .png, .svg, .webp, .txt, .md, .pdf, .csv, .doc, .xls, .ppt';
@@ -32290,14 +32291,14 @@ const Feedback = _ref => {
32290
32291
  const feedbackType = type || theme.feedback?.type || 'stars';
32291
32292
  const classNames = getClassNames('llm__feedback', `llm__feedback--${feedbackType}`);
32292
32293
 
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
- };
32294
+ /*
32295
+ const [feedbackRating, setFeedbackRating] = useState<number>();
32296
+ const onRating = async (event: ChangeEvent<HTMLInputElement>) => {
32297
+ console.log(event.currentTarget);
32298
+ const value = String(event.currentTarget.value);
32299
+ const rating = parseInt(value);
32300
+ setFeedbackRating(rating);
32301
+ };
32301
32302
  */
32302
32303
 
32303
32304
  const onSubmit = async event => {
@@ -32434,8 +32435,8 @@ const Feedback = _ref => {
32434
32435
  });
32435
32436
  };
32436
32437
 
32437
- /*
32438
- <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
32438
+ /*
32439
+ <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
32439
32440
  */
32440
32441
  const Font = () => {
32441
32442
  const theme = useLlm(state => state.theme);
@@ -41518,10 +41519,10 @@ const PageThread = () => {
41518
41519
  window.scrollTo({
41519
41520
  top: 0
41520
41521
  });
41521
- /*
41522
- if (ref.current) {
41523
- ref.current.scrollIntoView();
41524
- }
41522
+ /*
41523
+ if (ref.current) {
41524
+ ref.current.scrollIntoView();
41525
+ }
41525
41526
  */
41526
41527
  }, [message, hasValidChunks]);
41527
41528
  const classNames = getClassNames(style$2.thread);
@@ -41999,15 +42000,15 @@ const Scroller = _ref => {
41999
42000
  }
42000
42001
  },
42001
42002
  start: () => {
42002
- /*
42003
- if (innerRef.current) {
42004
- }
42003
+ /*
42004
+ if (innerRef.current) {
42005
+ }
42005
42006
  */
42006
42007
  },
42007
42008
  stop: () => {
42008
- /*
42009
- if (innerRef.current) {
42010
- }
42009
+ /*
42010
+ if (innerRef.current) {
42011
+ }
42011
42012
  */
42012
42013
  }
42013
42014
  });
@@ -42196,30 +42197,30 @@ const Suggestions = () => {
42196
42197
  });
42197
42198
  };
42198
42199
 
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>
42200
+ /*
42201
+
42202
+ const swiperProps = {
42203
+ modules: [FreeMode],
42204
+ spaceBetween: 8,
42205
+ freeMode: true,
42206
+ slidesPerView: 'auto' as const,
42207
+ slidesOffsetAfter: clamp(20, 110),
42208
+ slidesOffsetBefore: clamp(20, 110),
42209
+ };
42210
+
42211
+ <section className="llm__prompt-suggestions">
42212
+ <div className="llm__suggestions">
42213
+ <Swiper {...swiperProps} onInit={swiper => swiper.update()}>
42214
+ {app?.contents.sampleInputTexts?.map((s, j) => (
42215
+ <SwiperSlide key={j}>
42216
+ <button type="button" className="llm__pill" onClick={() => onClick(s)}>
42217
+ {s.sampleInputText}
42218
+ </button>
42219
+ </SwiperSlide>
42220
+ ))}
42221
+ </Swiper>
42222
+ </div>
42223
+ </section>
42223
42224
  */
42224
42225
 
42225
42226
  const Thread = () => {
@@ -42319,9 +42320,9 @@ const Trigger = () => {
42319
42320
  duration: 0.4
42320
42321
  },
42321
42322
  "aria-label": "Trigger"
42322
- /*
42323
- aria-expanded={opened}
42324
- aria-controls={mainId}
42323
+ /*
42324
+ aria-expanded={opened}
42325
+ aria-controls={mainId}
42325
42326
  */,
42326
42327
  onClick: () => open(),
42327
42328
  children: [/*#__PURE__*/jsxRuntimeExports.jsxs("button", {
@@ -43508,13 +43509,13 @@ class MessageDecoder {
43508
43509
  decodeMessages(messages) {
43509
43510
  return messages.map(x => {
43510
43511
  if (Array.isArray(x.content)) {
43511
- /*
43512
- if (x.role === 'user') {
43513
- return ({
43514
- ...x,
43515
- chunks: x.content.map(x => this.decodeChunk(x)),
43516
- });
43517
- }
43512
+ /*
43513
+ if (x.role === 'user') {
43514
+ return ({
43515
+ ...x,
43516
+ chunks: x.content.map(x => this.decodeChunk(x)),
43517
+ });
43518
+ }
43518
43519
  */
43519
43520
  return {
43520
43521
  ...x,
@@ -43755,163 +43756,163 @@ class MessageDecoder {
43755
43756
  return chunkItems;
43756
43757
  }
43757
43758
 
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
- }
43759
+ /*
43760
+ chunksToChunkItems___(chunks: LlmChunk[], response?: StreamResponse): LlmChunkItem[] {
43761
+ const chunkItems: LlmChunkItem[] = [];
43762
+ chunks.forEach(x => {
43763
+ const chunk: LlmChunkItem = typeof x === 'string' ? { type: 'text', text: x } : x;
43764
+ const lastMessage = chunkItems[chunkItems.length - 1];
43765
+ switch (chunk.type) {
43766
+ case 'text':
43767
+ if (lastMessage && isChunkText(lastMessage)) {
43768
+ const text = chunk.text;
43769
+ const lastChunkText = lastMessage;
43770
+ if (chunkItems.indexOf(lastChunkText) > 0) {
43771
+ // secondary chunk
43772
+ lastChunkText.text += text;
43773
+ } else if (!lastChunkText.text.includes('\n')) {
43774
+ // uncompleted first chunk
43775
+ if (text.includes('\n')) {
43776
+ const lines = text.split('\n');
43777
+ lines.forEach((line, i) => {
43778
+ const lastChar = (lines.length > i + 1) ? '\n' : '';
43779
+ if (i === 0) {
43780
+ lastChunkText.text += line + lastChar;
43781
+ } else if (line.length > 0) {
43782
+ chunkItems.push({
43783
+ type: 'text',
43784
+ text: line + lastChar,
43785
+ });
43786
+ }
43787
+ });
43788
+ } else {
43789
+ // uncompleted first chunk
43790
+ lastChunkText.text += text;
43791
+ }
43792
+ } else {
43793
+ // completed first chunk
43794
+ chunkItems.push(chunk);
43795
+ }
43796
+ } else {
43797
+ // new text chunk
43798
+ chunkItems.push(chunk);
43799
+ }
43800
+ break;
43801
+ case 'log':
43802
+ break;
43803
+ case 'error':
43804
+ chunkItems.push(chunk);
43805
+ break;
43806
+ case 'header': {
43807
+ const { type, ...rest } = chunk;
43808
+ if (response) {
43809
+ Object.assign(response, rest);
43810
+ }
43811
+ // console.log('header', response);
43812
+ }
43813
+ break;
43814
+ case 'info': {
43815
+ if (response) {
43816
+ // !!! deprecated
43817
+ response.threadId = chunk.threadId || response.threadId;
43818
+ }
43819
+ }
43820
+ break;
43821
+ case 'end':
43822
+ break;
43823
+ case 'action':
43824
+ case 'actionItem':
43825
+ if (lastMessage && lastMessage.type === 'actionGroup') {
43826
+ lastMessage.items.push(chunk);
43827
+ } else {
43828
+ chunkItems.push({
43829
+ type: 'actionGroup',
43830
+ items: [chunk],
43831
+ });
43832
+ }
43833
+ break;
43834
+ case 'cardItem':
43835
+ if (lastMessage && lastMessage.type === 'cardGroup') {
43836
+ lastMessage.items.push(chunk);
43837
+ } else {
43838
+ chunkItems.push({
43839
+ type: 'cardGroup',
43840
+ items: [chunk],
43841
+ });
43842
+ }
43843
+ break;
43844
+ case 'productItem':
43845
+ if (lastMessage && lastMessage.type === 'productGroup') {
43846
+ lastMessage.items.push(chunk);
43847
+ } else {
43848
+ chunkItems.push({
43849
+ type: 'productGroup',
43850
+ items: [chunk],
43851
+ });
43852
+ }
43853
+ break;
43854
+ case 'eventItem':
43855
+ if (lastMessage && lastMessage.type === 'eventGroup') {
43856
+ lastMessage.items.push(chunk);
43857
+ } else {
43858
+ chunkItems.push({
43859
+ type: 'eventGroup',
43860
+ items: [chunk],
43861
+ });
43862
+ }
43863
+ break;
43864
+ case 'poiItem':
43865
+ if (lastMessage && lastMessage.type === 'poiGroup') {
43866
+ lastMessage.items.push(chunk);
43867
+ } else {
43868
+ chunkItems.push({
43869
+ type: 'poiGroup',
43870
+ items: [chunk],
43871
+ });
43872
+ }
43873
+ break;
43874
+ case 'tripadvisor':
43875
+ case 'tripadvisorItem':
43876
+ if (lastMessage && lastMessage.type === 'tripadvisorGroup') {
43877
+ lastMessage.items.push({
43878
+ ...chunk,
43879
+ type: 'tripadvisorItem',
43880
+ });
43881
+ } else {
43882
+ chunkItems.push({
43883
+ type: 'tripadvisorGroup',
43884
+ items: [{
43885
+ ...chunk,
43886
+ type: 'tripadvisorItem',
43887
+ }],
43888
+ });
43889
+ }
43890
+ break;
43891
+ default:
43892
+ if (
43893
+ typeof chunk.type === 'string' &&
43894
+ chunk.type.match(/Item$/)
43895
+ ) {
43896
+ const baseName = chunk.type.replace('Item', '');
43897
+ const groupName = `${baseName}Group`;
43898
+ if (lastMessage && lastMessage.type === groupName) {
43899
+ (lastMessage as { items: (typeof x)[] }).items.push(x);
43900
+ } else {
43901
+ chunkItems.push({
43902
+ type: groupName,
43903
+ items: [{
43904
+ ...chunk,
43905
+ type: baseName,
43906
+ }],
43907
+ } as unknown as LlmChunkUnknownItem);
43908
+ }
43909
+ } else {
43910
+ chunkItems.push(chunk);
43911
+ }
43912
+ }
43913
+ });
43914
+ return chunkItems;
43915
+ }
43915
43916
  */
43916
43917
 
43917
43918
  static decodeThread(thread) {
@@ -44066,10 +44067,10 @@ class MessageService extends MessageDecoder {
44066
44067
  return;
44067
44068
  }
44068
44069
  const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
44069
- /*
44070
- if (error instanceof TypeError) {
44071
- errorMessage = 'TypeError: Browser may not support async iteration';
44072
- }
44070
+ /*
44071
+ if (error instanceof TypeError) {
44072
+ errorMessage = 'TypeError: Browser may not support async iteration';
44073
+ }
44073
44074
  */
44074
44075
  if (typeof onEnd === 'function') {
44075
44076
  const errorChunk = {
@@ -44188,10 +44189,10 @@ class MessageService extends MessageDecoder {
44188
44189
  } catch (error) {
44189
44190
  console.error('MessageService.mockMessage.error', error);
44190
44191
  const errorMessage = typeof error === 'string' ? error : JSON.stringify(error, null, 2);
44191
- /*
44192
- if (error instanceof TypeError) {
44193
- errorMessage = 'TypeError: Browser may not support async iteration';
44194
- }
44192
+ /*
44193
+ if (error instanceof TypeError) {
44194
+ errorMessage = 'TypeError: Browser may not support async iteration';
44195
+ }
44195
44196
  */
44196
44197
  if (typeof onEnd === 'function') {
44197
44198
  const errorChunk = {
@@ -44246,36 +44247,36 @@ function readChunks(reader) {
44246
44247
  };
44247
44248
  }
44248
44249
 
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
- };
44250
+ /*
44251
+ async function* streamAsyncIterable<T>(stream: ReadableStream<T>) {
44252
+ const reader = stream.getReader();
44253
+ try {
44254
+ while (true) {
44255
+ const { done, value } = await reader.read();
44256
+ if (done) return;
44257
+ yield value;
44258
+ }
44259
+ } finally {
44260
+ reader.releaseLock();
44261
+ }
44262
+ }
44263
+
44264
+ class Iterator {
44265
+ }
44266
+
44267
+ (Iterator as any).prototype[Symbol.asyncIterator] = async function* () {
44268
+ const reader = this.getReader();
44269
+ try {
44270
+ while (true) {
44271
+ const { done, value } = await reader.read();
44272
+ if (done) return;
44273
+ yield value;
44274
+ }
44275
+ }
44276
+ finally {
44277
+ reader.releaseLock();
44278
+ }
44279
+ };
44279
44280
  */
44280
44281
 
44281
44282
  class ApiService {
@@ -44878,19 +44879,19 @@ class DefaultTextToSpeech {
44878
44879
  utterance.onerror = error => {
44879
44880
  console.warn('DefaultTextToSpeech.speak.onerror', error);
44880
44881
  };
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
- };
44882
+ /*
44883
+ utterance.onboundary = (event) => {
44884
+ console.log('DefaultTextToSpeech.speak.onboundary', event);
44885
+ };
44886
+ utterance.onmark = (event) => {
44887
+ console.log('DefaultTextToSpeech.speak.onmark', event);
44888
+ };
44889
+ utterance.onpause = (event) => {
44890
+ console.log('DefaultTextToSpeech.speak.onpause', event);
44891
+ };
44892
+ utterance.onresume = (event) => {
44893
+ console.log('DefaultTextToSpeech.speak.onresume', event);
44894
+ };
44894
44895
  */
44895
44896
  utterance.voice = voice;
44896
44897
  utterance.pitch = pitch;
@@ -45074,12 +45075,12 @@ class DefaultSpeechToText {
45074
45075
  return this.recognizer_;
45075
45076
  } else {
45076
45077
  const recognizer = new this.recognition();
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;
45078
+ /*
45079
+ const grammar =
45080
+ "#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 ;";
45081
+ const grammarList = new this.grammarList();
45082
+ grammarList.addFromString(grammar, 1);
45083
+ recognizer.grammars = grammarList;
45083
45084
  */
45084
45085
  recognizer.lang = this.lang; // "en-US";
45085
45086
  recognizer.continuous = true;
@@ -45097,37 +45098,37 @@ class DefaultSpeechToText {
45097
45098
  // console.log('recognizer.result');
45098
45099
  this.onResult(event);
45099
45100
  });
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
- });
45101
+ /*
45102
+ recognizer.addEventListener("audioend", (event) => {
45103
+ this.log('recognizer', "audioend", event);
45104
+ });
45105
+ recognizer.addEventListener("speechend", (event) => {
45106
+ this.log('recognizer', "speechend", event);
45107
+ });
45107
45108
  */
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.
45109
+ /*
45110
+ audiostart
45111
+ Fired when the user agent has started to capture audio. Also available via the onaudiostart property.
45112
+ audioend
45113
+ Fired when the user agent has finished capturing audio. Also available via the onaudioend property.
45114
+ end
45115
+ Fired when the speech recognition service has disconnected. Also available via the onend property.
45116
+ error
45117
+ Fired when a speech recognition error occurs. Also available via the onerror property.
45118
+ nomatch
45119
+ 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.
45120
+ result
45121
+ 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.
45122
+ soundstart
45123
+ Fired when any sound — recognizable speech or not — has been detected. Also available via the onsoundstart property.
45124
+ soundend
45125
+ Fired when any sound — recognizable speech or not — has stopped being detected. Also available via the onsoundend property.
45126
+ speechstart
45127
+ Fired when sound that is recognized by the speech recognition service as speech has been detected. Also available via the onspeechstart property.
45128
+ speechend
45129
+ Fired when speech recognized by the speech recognition service has stopped being detected. Also available via the onspeechend property.
45130
+ start
45131
+ 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.
45131
45132
  */
45132
45133
  this.recognizer_ = recognizer;
45133
45134
  return recognizer;
@@ -45296,17 +45297,17 @@ const createLlmStore = config => {
45296
45297
  return c(p);
45297
45298
  }, {
45298
45299
  ...config
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
- }),
45300
+ /**
45301
+ * test remote api
45302
+ ...({
45303
+ appKey: 'xxxxxxxxxxxxxx',
45304
+ apiKey: 'xxxxxxxxxxxxxx',
45305
+ threadId: 'xxxxxxxxxxxxxx',
45306
+ endpoint: 'https://platform.websolute.ai',
45307
+ endpoint: 'https://platform-ai-dev.ws-deploy-01.wslabs.it',
45308
+ endpoint: 'http://localhost:4000/bowl',
45309
+ test: false,
45310
+ }),
45310
45311
  */
45311
45312
  });
45312
45313
  const {
@@ -45321,6 +45322,7 @@ const createLlmStore = config => {
45321
45322
  decorateUrl,
45322
45323
  label,
45323
45324
  onAction,
45325
+ onMessage,
45324
45326
  ...options
45325
45327
  } = sanitizedConfig;
45326
45328
  const theme = getThemes([customTheme], config.defaultTheme);
@@ -45447,12 +45449,12 @@ const createLlmStore = config => {
45447
45449
  }
45448
45450
  const thread = MessageDecoder.decodeThread(app.thread);
45449
45451
  const testTheme = test ? getMock(locale, test).app?.contents?.customTheme : {};
45450
- /*
45451
- console.log(
45452
- 'appTheme', app.contents.customTheme,
45453
- 'testTheme', testTheme,
45454
- 'customTheme', customTheme
45455
- );
45452
+ /*
45453
+ console.log(
45454
+ 'appTheme', app.contents.customTheme,
45455
+ 'testTheme', testTheme,
45456
+ 'customTheme', customTheme
45457
+ );
45456
45458
  */
45457
45459
  const theme = getThemes([app.contents.customTheme, testTheme, customTheme], config.defaultTheme);
45458
45460
  const mode = theme.mode;
@@ -45461,22 +45463,22 @@ const createLlmStore = config => {
45461
45463
  // console.log('useLlm.storedHistory', storedHistory);
45462
45464
  const history = await apiService.decorateHistory(storedHistory, mode);
45463
45465
  // console.log('useLlm.history', history);
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
- }
45466
+ /*
45467
+ // !!! session restored via threadId storage merge
45468
+ if (storageMode === 'session') {
45469
+ // console.log('storageMode', storageMode, history);
45470
+ if (history.length > 0) {
45471
+ thread = {
45472
+ threadId: history[0].threadId,
45473
+ messages: history[0].messages,
45474
+ };
45475
+ }
45476
+ }
45475
45477
  */
45476
- /*
45477
- console.log(
45478
- 'theme', theme
45479
- );
45478
+ /*
45479
+ console.log(
45480
+ 'theme', theme
45481
+ );
45480
45482
  */
45481
45483
  const vars = getVars(theme);
45482
45484
  createVars(vars);
@@ -45560,6 +45562,7 @@ const createLlmStore = config => {
45560
45562
  if (typeof onMessage === 'function') {
45561
45563
  onMessage(response);
45562
45564
  }
45565
+ state.actions.onMessage(response);
45563
45566
  },
45564
45567
  // onEnd
45565
45568
  response => {
@@ -45575,12 +45578,12 @@ const createLlmStore = config => {
45575
45578
  };
45576
45579
  const responseMessages = [...messages, assistantMessage];
45577
45580
  // 15/12/2025 disabling form request feature, todo add payload flag
45578
- /*
45579
- if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
45580
- chunks.push({
45581
- type: 'formRequest',
45582
- });
45583
- }
45581
+ /*
45582
+ if (messageService && messageService.shouldAddFormRequest(responseMessages)) {
45583
+ chunks.push({
45584
+ type: 'formRequest',
45585
+ });
45586
+ }
45584
45587
  */
45585
45588
  // filtering history
45586
45589
  const validChunks = chunks.filter(x => typeof x.type === 'string' && !['header', 'info', 'end', 'formRequest', 'formRecap', 'formRecapSuccess', 'formRecapError'].includes(x.type));
@@ -45848,10 +45851,10 @@ const createLlmStore = config => {
45848
45851
  threadId: history.threadId,
45849
45852
  message: history.assistant,
45850
45853
  messages: history.messages
45851
- /*
45852
- messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
45853
- [...state.messages, history.user, history.assistant] :
45854
- state.messages,
45854
+ /*
45855
+ messages: state.messages.findIndex(x => x.messageId === history.messageId) === -1 ?
45856
+ [...state.messages, history.user, history.assistant] :
45857
+ state.messages,
45855
45858
  */
45856
45859
  }));
45857
45860
  },
@@ -45861,6 +45864,12 @@ const createLlmStore = config => {
45861
45864
  }
45862
45865
  return;
45863
45866
  },
45867
+ onMessage: async message => {
45868
+ if (typeof onMessage === 'function') {
45869
+ return await onMessage(message);
45870
+ }
45871
+ return;
45872
+ },
45864
45873
  clear: () => {
45865
45874
  const {
45866
45875
  abort
@@ -45895,10 +45904,10 @@ const createLlmStore = config => {
45895
45904
  currentState.storedHistory = persistedState.storedHistory && [...persistedState.storedHistory];
45896
45905
  currentState.speakEnabled = persistedState.speakEnabled || false;
45897
45906
  speech.enabled = currentState.speakEnabled;
45898
- /*
45899
- if (persistedState.messages) {
45900
- currentState.messages = [...persistedState.messages];
45901
- }
45907
+ /*
45908
+ if (persistedState.messages) {
45909
+ currentState.messages = [...persistedState.messages];
45910
+ }
45902
45911
  */
45903
45912
  currentState.hydrated = true;
45904
45913
  // console.log('currentState', currentState);
@@ -46472,6 +46481,13 @@ const App = _ref => {
46472
46481
  id: data.market,
46473
46482
  title: data.market
46474
46483
  }],
46484
+ app: {
46485
+ id: 'app',
46486
+ brand: {
46487
+ name: 'Mixer',
46488
+ social: []
46489
+ }
46490
+ },
46475
46491
  menu: {},
46476
46492
  topLevelHrefs: {},
46477
46493
  topLevelRoutes: {}
@@ -46557,21 +46573,21 @@ function renderInstance(node, props, instance) {
46557
46573
  if (!node.hasAttribute('data-llm')) {
46558
46574
  node.setAttribute('data-llm', '');
46559
46575
 
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);
46576
+ /*
46577
+ const host = node;
46578
+ const shadow = host.attachShadow({ mode: 'open' });
46579
+ const shadowRoot = document.createElement('div');
46580
+ if (typeof window !== 'undefined' && 'llms__' in window) {
46581
+ const llmStyle = (window['llms__'] || []) as string[];
46582
+ const adoptedStyleSheets = llmStyle.map(style => {
46583
+ const sheet = new CSSStyleSheet();
46584
+ sheet.replaceSync(style);
46585
+ return sheet;
46586
+ });
46587
+ shadow.adoptedStyleSheets = adoptedStyleSheets;
46588
+ }
46589
+ shadowRoot.setAttribute('data-llm', '');
46590
+ shadow.appendChild(shadowRoot);
46575
46591
  */
46576
46592
 
46577
46593
  const root = client.createRoot(node);
@@ -46644,10 +46660,10 @@ function observeMutations(targetElement, callback) {
46644
46660
  if (mutation.type === 'childList') {
46645
46661
  callback(mutation);
46646
46662
  }
46647
- /*
46648
- else if (mutation.type === 'attributes') {
46649
- console.log(`The ${mutation.attributeName} attribute was modified.`);
46650
- }
46663
+ /*
46664
+ else if (mutation.type === 'attributes') {
46665
+ console.log(`The ${mutation.attributeName} attribute was modified.`);
46666
+ }
46651
46667
  */
46652
46668
  }
46653
46669
  });