@websolutespa/bom-llm 3.1.2 → 4.0.0-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @websolutespa/bom-llm
2
2
 
3
+ ## 4.0.0-next.7
4
+
5
+ ## 4.0.0-next.6
6
+
7
+ ### Patch Changes
8
+
9
+ - d0f1be7: Generated projects build and run again: externals, peer dependencies and exports.
10
+
11
+ - `bom-mixer-image` is loaded by Node, not bundled: the web apps list it in `serverExternalPackages` and leave it out of `transpilePackages`. Turbopack bundled `sharp`'s native addon through it (`non-ecmascript placeable asset`, the image route answered 500). The package has no runtime import of `next` any more (`Response.redirect`, type-only imports), so it loads in plain Node.
12
+ Projects: in `src/mixer/web/next.config.ts` add `serverExternalPackages: ['@websolutespa/bom-mixer-image']` and filter it out of `transpilePackages`, as the samples do.
13
+ - The other mixer packages import `next/server` again (no `.js`): they are transpiled by Next. `@websolutespa/test/vitest` inlines `@websolutespa/*` (`server.deps.inline`), so project tests compile them like Next does.
14
+ - `schema-dts` is a peer dependency (`^2.1.0`) of `bom-mixer-models`, `bom-mixer-ui` and `bom-mixer-hooks`: their published `.d.ts` imported an inlined copy of it, and generated projects failed to type check (`TS2321: Excessive stack depth` in `test-pagination.tsx`).
15
+ - `bom-mixer-checkout` publishes `./server` again under pnpm: a stray `publishConfig.exports` with a Windows separator replaced the exports map.
16
+ - `payload-plugin-search` no longer requires `@payloadcms/richtext-slate`: it was a peer used only by its own tests, auto-installed at the newest Payload version, and Payload refused to start on the version mismatch.
17
+ - `bom create` downloads the samples of its own release tag (falls back to `main` when the tag does not exist) and writes `^<cli version>` for every `@websolutespa` dependency, local packages included, instead of `latest`.
18
+ - `react-error-boundary ^6.1.6`, `@ariakit/react ^0.4.17`, `rollup-plugin-postcss ^4.0.2` everywhere.
19
+
3
20
  ## 3.1.2
4
21
 
5
22
  ## 3.1.1
package/README.md CHANGED
@@ -1,153 +1,159 @@
1
- # @websolutespa/bom-llm
2
-
3
- [![npm version](https://badge.fury.io/js/%40websolutespa%2Fbom-llm.svg)](https://badge.fury.io/js/%40websolutespa%2Fbom-llm)
4
-
5
- [![status alpha](https://img.shields.io/badge/status-alpha-red.svg)](https://shields.io/)
6
-
7
- LLM module of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
8
-
9
- # Bom LLM Plugin
10
-
11
- This plugin automatically adds UI components to manage LLM Chatbot by [websolute](https://www.websolute.com/).
12
-
13
- ### Requirements:
14
-
15
- - You need a personal appKey and apiKey to use this plugin, for more info contact [websolute](https://www.websolute.com/contatti)
16
-
17
- ## Usage
18
-
19
- You can load the script directly via jsDelivr or installing via npm.
20
-
21
- ### Using jsDelivr
22
-
23
- ```html
24
- <script type="module" src="https://cdn.jsdelivr.net/npm/@websolutespa/bom-llm/dist/umd/index.js"></script>
25
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@websolutespa/bom-llm/dist/umd/index.css">
26
- <script>
27
- document.addEventListener('DOMContentLoaded', () => {
28
- if ('bomLlm' in window) {
29
- const searchParams = new URLSearchParams(window.location.search);
30
- const options = {
31
- appKey: 'MY_APP_KEY',
32
- apiKey: 'MY_API_KEY',
33
- threadId: searchParams.get('llmThreadId'),
34
- };
35
- bomLlm(options);
36
- }
37
- });
38
- </script>
39
- ```
40
-
41
- ### Using npm
42
-
43
- Install library using npm.
44
-
45
- ```bash
46
- npm i @websolutespa/bom-llm --save
47
- ```
48
-
49
- Import css from node_modules.
50
-
51
- ```html
52
- <link rel="stylesheet" href="node_modules/@websolutespa/bom-llm/dist/umd/index.css">
53
- ```
54
-
55
- Import and consume plugin.
56
-
57
- ```js
58
- import { bomLlm } from '@websolutespa/bom-llm';
59
-
60
- document.addEventListener('DOMContentLoaded', () => {
61
- if ('bomLlm' in window) {
62
- const searchParams = new URLSearchParams(window.location.search);
63
- const options = {
64
- appKey: 'MY_APP_KEY',
65
- apiKey: 'MY_API_KEY',
66
- threadId: searchParams.get('llmThreadId'),
67
- };
68
- // returned instance
69
- const llm = bomLlm(options);
70
- }
71
- });
72
- ```
73
-
74
- Using imperatively.
75
-
76
- ```js
77
- const options = {
78
- appKey: 'MY_APP_KEY',
79
- apiKey: 'MY_API_KEY',
80
- imperative: true, // hide trigger button
81
- };
82
- const llm = bomLlm(options);
83
- // using open command imperatively
84
- setTimeout(() => {
85
- llm.open();
86
- }, 4000);
87
- ```
88
-
89
- Using embed tag.
90
-
91
- ```html
92
- <llm-embed />
93
- ```
94
-
95
- ### Running test
96
-
97
- Add parameter test = true.
98
-
99
- ```js
100
- const searchParams = new URLSearchParams(window.location.search);
101
- const options = {
102
- appKey: 'MY_APP_KEY',
103
- apiKey: 'MY_API_KEY',
104
- threadId: searchParams.get('llmThreadId'),
105
- test: true,
106
- };
107
- bomLlm(options);
108
- ```
109
-
110
- ### Decorate external url
111
-
112
- You can decorate every json item from the knowledgeBase customizing its external url.
113
- decorateUrl method can be a promise.
114
-
115
- ```js
116
- const searchParams = new URLSearchParams(window.location.search);
117
- const options = {
118
- appKey: 'MY_APP_KEY',
119
- apiKey: 'MY_API_KEY',
120
- threadId: searchParams.get('llmThreadId'),
121
- decorateUrl: (item) => {
122
- switch (item.type) {
123
- case 'event':
124
- case 'eventItem':
125
- return `https://acme.com/event?id=${item.id}`;
126
- default:
127
- return;
128
- }
129
- },
130
- };
131
- bomLlm(options);
132
- ```
133
-
134
- ### Handling external actions
135
-
136
- You can handle the click event of the generated cta action with the onAction handler.
137
-
138
- ```js
139
- const searchParams = new URLSearchParams(window.location.search);
140
- const options = {
141
- appKey: 'MY_APP_KEY',
142
- apiKey: 'MY_API_KEY',
143
- threadId: searchParams.get('llmThreadId'),
144
- onAction: (item) => {
145
- console.log('onAction', item.id, item.title);
146
- },
147
- };
148
- bomLlm(options);
149
- ```
150
-
151
- ---
152
-
153
- ##### *this library is for internal usage and not production ready*
1
+ # @websolutespa/bom-llm
2
+
3
+ [![npm version](https://badge.fury.io/js/%40websolutespa%2Fbom-llm.svg)](https://badge.fury.io/js/%40websolutespa%2Fbom-llm)
4
+
5
+ [![status alpha](https://img.shields.io/badge/status-alpha-red.svg)](https://shields.io/)
6
+
7
+ LLM module of the [BOM Repository](https://github.com/websolutespa/bom) by [websolute](https://www.websolute.com/).
8
+
9
+ # Bom LLM Plugin
10
+
11
+ This plugin automatically adds UI components to manage LLM Chatbot by [websolute](https://www.websolute.com/).
12
+
13
+ ### Requirements:
14
+
15
+ - You need a personal appKey and apiKey to use this plugin, for more info contact [websolute](https://www.websolute.com/contatti)
16
+
17
+ ## Usage
18
+
19
+ You can load the script directly via jsDelivr or installing via npm.
20
+
21
+ ### Using jsDelivr
22
+
23
+ ```html
24
+ <script
25
+ type="module"
26
+ src="https://cdn.jsdelivr.net/npm/@websolutespa/bom-llm/dist/umd/index.js"
27
+ ></script>
28
+ <link
29
+ rel="stylesheet"
30
+ href="https://cdn.jsdelivr.net/npm/@websolutespa/bom-llm/dist/umd/index.css"
31
+ />
32
+ <script>
33
+ document.addEventListener('DOMContentLoaded', () => {
34
+ if ('bomLlm' in window) {
35
+ const searchParams = new URLSearchParams(window.location.search);
36
+ const options = {
37
+ appKey: 'MY_APP_KEY',
38
+ apiKey: 'MY_API_KEY',
39
+ threadId: searchParams.get('llmThreadId'),
40
+ };
41
+ bomLlm(options);
42
+ }
43
+ });
44
+ </script>
45
+ ```
46
+
47
+ ### Using npm
48
+
49
+ Install library using npm.
50
+
51
+ ```bash
52
+ npm i @websolutespa/bom-llm --save
53
+ ```
54
+
55
+ Import css from node_modules.
56
+
57
+ ```html
58
+ <link rel="stylesheet" href="node_modules/@websolutespa/bom-llm/dist/umd/index.css" />
59
+ ```
60
+
61
+ Import and consume plugin.
62
+
63
+ ```js
64
+ import { bomLlm } from '@websolutespa/bom-llm';
65
+
66
+ document.addEventListener('DOMContentLoaded', () => {
67
+ if ('bomLlm' in window) {
68
+ const searchParams = new URLSearchParams(window.location.search);
69
+ const options = {
70
+ appKey: 'MY_APP_KEY',
71
+ apiKey: 'MY_API_KEY',
72
+ threadId: searchParams.get('llmThreadId'),
73
+ };
74
+ // returned instance
75
+ const llm = bomLlm(options);
76
+ }
77
+ });
78
+ ```
79
+
80
+ Using imperatively.
81
+
82
+ ```js
83
+ const options = {
84
+ appKey: 'MY_APP_KEY',
85
+ apiKey: 'MY_API_KEY',
86
+ imperative: true, // hide trigger button
87
+ };
88
+ const llm = bomLlm(options);
89
+ // using open command imperatively
90
+ setTimeout(() => {
91
+ llm.open();
92
+ }, 4000);
93
+ ```
94
+
95
+ Using embed tag.
96
+
97
+ ```html
98
+ <llm-embed />
99
+ ```
100
+
101
+ ### Running test
102
+
103
+ Add parameter test = true.
104
+
105
+ ```js
106
+ const searchParams = new URLSearchParams(window.location.search);
107
+ const options = {
108
+ appKey: 'MY_APP_KEY',
109
+ apiKey: 'MY_API_KEY',
110
+ threadId: searchParams.get('llmThreadId'),
111
+ test: true,
112
+ };
113
+ bomLlm(options);
114
+ ```
115
+
116
+ ### Decorate external url
117
+
118
+ You can decorate every json item from the knowledgeBase customizing its external url.
119
+ decorateUrl method can be a promise.
120
+
121
+ ```js
122
+ const searchParams = new URLSearchParams(window.location.search);
123
+ const options = {
124
+ appKey: 'MY_APP_KEY',
125
+ apiKey: 'MY_API_KEY',
126
+ threadId: searchParams.get('llmThreadId'),
127
+ decorateUrl: (item) => {
128
+ switch (item.type) {
129
+ case 'event':
130
+ case 'eventItem':
131
+ return `https://acme.com/event?id=${item.id}`;
132
+ default:
133
+ return;
134
+ }
135
+ },
136
+ };
137
+ bomLlm(options);
138
+ ```
139
+
140
+ ### Handling external actions
141
+
142
+ You can handle the click event of the generated cta action with the onAction handler.
143
+
144
+ ```js
145
+ const searchParams = new URLSearchParams(window.location.search);
146
+ const options = {
147
+ appKey: 'MY_APP_KEY',
148
+ apiKey: 'MY_API_KEY',
149
+ threadId: searchParams.get('llmThreadId'),
150
+ onAction: (item) => {
151
+ console.log('onAction', item.id, item.title);
152
+ },
153
+ };
154
+ bomLlm(options);
155
+ ```
156
+
157
+ ---
158
+
159
+ ##### _this library is for internal usage and not production ready_