@websolutespa/bom-llm 3.1.2 → 4.0.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +159 -153
- package/dist/esm/index.js +5498 -4553
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/umd/index.js +5499 -4554
- package/dist/umd/index.js.map +1 -1
- package/package.json +26 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @websolutespa/bom-llm
|
|
2
2
|
|
|
3
|
+
## 4.0.0-next.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d0f1be7: Generated projects build and run again: externals, peer dependencies and exports.
|
|
8
|
+
|
|
9
|
+
- `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.
|
|
10
|
+
Projects: in `src/mixer/web/next.config.ts` add `serverExternalPackages: ['@websolutespa/bom-mixer-image']` and filter it out of `transpilePackages`, as the samples do.
|
|
11
|
+
- 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.
|
|
12
|
+
- `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`).
|
|
13
|
+
- `bom-mixer-checkout` publishes `./server` again under pnpm: a stray `publishConfig.exports` with a Windows separator replaced the exports map.
|
|
14
|
+
- `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.
|
|
15
|
+
- `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`.
|
|
16
|
+
- `react-error-boundary ^6.1.6`, `@ariakit/react ^0.4.17`, `rollup-plugin-postcss ^4.0.2` everywhere.
|
|
17
|
+
|
|
3
18
|
## 3.1.2
|
|
4
19
|
|
|
5
20
|
## 3.1.1
|
package/README.md
CHANGED
|
@@ -1,153 +1,159 @@
|
|
|
1
|
-
# @websolutespa/bom-llm
|
|
2
|
-
|
|
3
|
-
[](https://badge.fury.io/js/%40websolutespa%2Fbom-llm)
|
|
4
|
-
|
|
5
|
-
[](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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Import
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
1
|
+
# @websolutespa/bom-llm
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40websolutespa%2Fbom-llm)
|
|
4
|
+
|
|
5
|
+
[](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_
|