@websolutespa/bom-llm 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,58 +1,71 @@
1
- # @websolutespa/bom-llm
2
-
3
- ## 0.0.9
4
-
5
- ### Patch Changes
6
-
7
- - Updating: dependencies
8
-
9
- ## 0.0.8
10
-
11
- ### Patch Changes
12
-
13
- - Modified: Speech synthesis & recognition, disclaimer, markdown
14
-
15
- ## 0.0.7
16
-
17
- ### Patch Changes
18
-
19
- - Modified: components dangerouslySetInnerHTML, styles, useLlm status opened with threadId
20
-
21
- ## 0.0.6
22
-
23
- ### Patch Changes
24
-
25
- - Fixing: threads
26
- - Modified: MessageService, FormRecap, useLlm
27
-
28
- ## 0.0.5
29
-
30
- ### Patch Changes
31
-
32
- - Added: declarations
33
- - Modified: FormRecap, QuickLinks
34
-
35
- ## 0.0.4
36
-
37
- ### Patch Changes
38
-
39
- - Modified: decorateUrl async behaviour
40
-
41
- ## 0.0.3
42
-
43
- ### Patch Changes
44
-
45
- - Added: markdown support
46
-
47
- ## 0.0.2
48
-
49
- ### Patch Changes
50
-
51
- - Added: abort stream
52
- - Modified: speech, useLlm, message service, canvas, icons
53
-
54
- ## 0.0.1
55
-
56
- ### Patch Changes
57
-
58
- - Added: first release.
1
+ # @websolutespa/bom-llm
2
+
3
+ ## 0.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: shared state between instances
8
+
9
+ ## 0.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - Added: embed options
14
+ - Added: returning instance with methods
15
+
16
+ ## 0.0.9
17
+
18
+ ### Patch Changes
19
+
20
+ - Updating: dependencies
21
+
22
+ ## 0.0.8
23
+
24
+ ### Patch Changes
25
+
26
+ - Modified: Speech synthesis & recognition, disclaimer, markdown
27
+
28
+ ## 0.0.7
29
+
30
+ ### Patch Changes
31
+
32
+ - Modified: components dangerouslySetInnerHTML, styles, useLlm status opened with threadId
33
+
34
+ ## 0.0.6
35
+
36
+ ### Patch Changes
37
+
38
+ - Fixing: threads
39
+ - Modified: MessageService, FormRecap, useLlm
40
+
41
+ ## 0.0.5
42
+
43
+ ### Patch Changes
44
+
45
+ - Added: declarations
46
+ - Modified: FormRecap, QuickLinks
47
+
48
+ ## 0.0.4
49
+
50
+ ### Patch Changes
51
+
52
+ - Modified: decorateUrl async behaviour
53
+
54
+ ## 0.0.3
55
+
56
+ ### Patch Changes
57
+
58
+ - Added: markdown support
59
+
60
+ ## 0.0.2
61
+
62
+ ### Patch Changes
63
+
64
+ - Added: abort stream
65
+ - Modified: speech, useLlm, message service, canvas, icons
66
+
67
+ ## 0.0.1
68
+
69
+ ### Patch Changes
70
+
71
+ - Added: first release.
package/README.md CHANGED
@@ -65,11 +65,28 @@ document.addEventListener('DOMContentLoaded', () => {
65
65
  apiKey: 'MY_API_KEY',
66
66
  threadId: searchParams.get('llmThreadId'),
67
67
  };
68
- bomLlm(options);
68
+ // returned instance
69
+ const llm = bomLlm(options);
69
70
  }
70
71
  });
71
72
  ```
72
73
 
74
+ Using imperatively.
75
+
76
+ ```js
77
+ const llm = bomLlm(options);
78
+ // using open command imperatively
79
+ setTimeout(() => {
80
+ llm.open();
81
+ }, 4000);
82
+ ```
83
+
84
+ Using embed tag.
85
+
86
+ ```html
87
+ <llm-embed />
88
+ ```
89
+
73
90
  ### Running test
74
91
 
75
92
  Add parameter test = true.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { LlmInstance } from '@websolutespa/bom-mixer-llm';
2
+
1
3
  type LlmItem = Record<string, any> & {
2
4
  type: string;
3
5
  };
@@ -11,8 +13,9 @@ type LlmOptions = {
11
13
  test?: boolean;
12
14
  threadId?: string;
13
15
  opened?: boolean;
16
+ embedded?: boolean;
14
17
  };
15
18
 
16
- declare function bomLlm(props: LlmOptions): void;
19
+ declare function bomLlm(props: LlmOptions): LlmInstance | undefined;
17
20
 
18
21
  export { bomLlm };
@@ -286,16 +286,27 @@
286
286
  box-sizing: border-box;
287
287
  }
288
288
 
289
+ llm-embed {
290
+ display: block;
291
+ width: 100%;
292
+ height: 760px;
293
+ max-height: 100vh;
294
+ background: transparent;
295
+ overflow: clip;
296
+ }
297
+
289
298
  .llm {
290
- position: fixed;
291
299
  display: flex;
292
300
  flex-direction: column;
293
301
  align-items: center;
294
302
  justify-content: flex-end;
295
- top: 0;
296
- left: 0;
297
303
  width: 100%;
298
304
  height: 100%;
305
+ }
306
+ .llm:not(.-embedded) {
307
+ position: fixed;
308
+ top: 0;
309
+ left: 0;
299
310
  pointer-events: none;
300
311
  z-index: 9999;
301
312
  }
@@ -1072,7 +1083,8 @@
1072
1083
  }
1073
1084
 
1074
1085
  .llm .llm__main {
1075
- position: absolute;
1086
+ display: block;
1087
+ position: relative;
1076
1088
  pointer-events: auto;
1077
1089
  inset: 0;
1078
1090
  background: var(--llm-color-ui-1);
@@ -1112,15 +1124,34 @@
1112
1124
  }
1113
1125
  .llm .llm__content {
1114
1126
  min-height: 100%;
1115
- padding-top: 100px;
1116
- padding-bottom: 180px;
1117
1127
  display: flex;
1118
1128
  flex-direction: column;
1119
1129
  justify-content: center;
1120
1130
  }
1131
+ .llm.-embedded .llm__main {
1132
+ width: 100%;
1133
+ height: 100%;
1134
+ }
1135
+ .llm.-embedded .llm__content {
1136
+ padding-top: 40px;
1137
+ padding-bottom: 180px;
1138
+ }
1139
+ @media (min-width: 1024px) {
1140
+ .llm.-embedded .llm__content {
1141
+ padding-top: 60px;
1142
+ padding-bottom: 180px;
1143
+ }
1144
+ }
1145
+ .llm:not(.-embedded) .llm__main {
1146
+ position: absolute;
1147
+ }
1148
+ .llm:not(.-embedded) .llm__content {
1149
+ padding-top: 100px;
1150
+ padding-bottom: 180px;
1151
+ }
1121
1152
  @media (min-width: 1024px) {
1122
- .llm .llm__content {
1123
- padding: 200px 0;
1153
+ .llm:not(.-embedded) .llm__content {
1154
+ padding-top: 200px;
1124
1155
  padding-bottom: 280px;
1125
1156
  }
1126
1157
  }
@@ -1593,15 +1624,17 @@
1593
1624
  border: 2px solid rgba(255, 255, 255, 0.4);
1594
1625
  }
1595
1626
  .llm .llm__message--assistant .llm__inner--string .llm__text .llm__text-body .llm__text-img {
1627
+ display: block;
1628
+ margin: 1rem 0;
1629
+ font-size: 0;
1630
+ text-decoration: none;
1631
+ }
1632
+ .llm .llm__message--assistant .llm__inner--string .llm__text .llm__text-body .llm__text-img > img {
1596
1633
  display: inline-flex;
1597
1634
  justify-content: center;
1598
1635
  align-items: center;
1599
1636
  width: 320px;
1600
1637
  height: 320px;
1601
- font-size: 0;
1602
- text-decoration: none;
1603
- }
1604
- .llm .llm__message--assistant .llm__inner--string .llm__text .llm__text-body .llm__text-img > img {
1605
1638
  object-fit: cover;
1606
1639
  }
1607
1640
  .llm .llm__text-disclaimer {