@liip/liipgpt 1.0.0-rc.9 → 2.0.0
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/README.md +4 -129
- package/button/liipgpt-button.iife.js +240 -0
- package/chat/liipgpt-chat.iife.js +303 -803
- package/config/index.cjs +4313 -0
- package/config/index.d.ts +9517 -949
- package/config/index.js +3463 -2248
- package/configurator/_app/env.js +1 -0
- package/configurator/_app/immutable/chunks/BWd1KRA2.js +67 -0
- package/configurator/_app/immutable/chunks/BtLfsQWl.js +15 -0
- package/configurator/_app/immutable/chunks/CBFTM35p.js +367 -0
- package/configurator/_app/immutable/chunks/CP9-4jcs.js +1 -0
- package/configurator/_app/immutable/chunks/CfQtRUjK.js +1 -0
- package/configurator/_app/immutable/chunks/Cgm2UlUC.js +1 -0
- package/configurator/_app/immutable/chunks/ChcTJagy.js +3 -0
- package/configurator/_app/immutable/chunks/D-Dn-KSg.js +1 -0
- package/configurator/_app/immutable/chunks/Daj9x7sZ.js +1 -0
- package/configurator/_app/immutable/chunks/DvEdoyY3.js +1 -0
- package/configurator/_app/immutable/chunks/LjIoA1Wm.js +1 -0
- package/configurator/_app/immutable/chunks/NZTpNUN0.js +1 -0
- package/configurator/_app/immutable/chunks/TMezqz9A.js +1 -0
- package/configurator/_app/immutable/chunks/pxprCMm0.js +1 -0
- package/configurator/_app/immutable/entry/app.B4WSrzpv.js +2 -0
- package/configurator/_app/immutable/entry/start.GK6q9XMZ.js +1 -0
- package/configurator/_app/immutable/nodes/0.B7euNXzq.js +58 -0
- package/configurator/_app/immutable/nodes/1.C9w5e9w0.js +1 -0
- package/configurator/_app/immutable/nodes/2.CWOgfthk.js +28 -0
- package/configurator/_app/immutable/nodes/3.BaHVKKga.js +897 -0
- package/configurator/_app/version.json +1 -0
- package/configurator/favicon.png +0 -0
- package/configurator/index.html +38 -0
- package/configurator/sidebar.html +38 -0
- package/index.cjs +11201 -0
- package/index.d.ts +14435 -0
- package/index.js +11180 -0
- package/package.json +20 -13
- package/chat/index.html +0 -242
- package/config/index.umd.cjs +0 -1
- package/lib/config/chat-config.d.ts +0 -957
- package/lib/config/clamp.d.ts +0 -3
- package/lib/config/config-definition.d.ts +0 -1635
- package/lib/config/css-variables.d.ts +0 -9
- package/lib/config/custom-css.d.ts +0 -1
- package/lib/config/demo-chat-history.d.ts +0 -78
- package/lib/config/simple-config.d.ts +0 -458
- package/lib/config/translations-definition.d.ts +0 -221
- package/lib/config/types-index.d.ts +0 -3
- package/lib/config/utils.d.ts +0 -23
- package/lib/lib/agnostic-storage.d.ts +0 -1
- package/lib/lib/chat-message-types.d.ts +0 -53
- package/lib/lib/feedback.d.ts +0 -0
- package/lib/lib/index.d.ts +0 -3
- package/lib/lib/liipgpt-client.d.ts +0 -92
- package/lib/lib/markdown.d.ts +0 -2
- package/lib/lib/message-store.d.ts +0 -15
- package/lib/lib/sse-v2-types.d.ts +0 -57
- package/lib/lib/utils.d.ts +0 -2
- package/lib/liipgpt-client.js +0 -5570
- package/lib/liipgpt-client.umd.cjs +0 -59
package/README.md
CHANGED
|
@@ -1,137 +1,12 @@
|
|
|
1
1
|
# LiipGPT Chat & Library
|
|
2
2
|
|
|
3
|
-
This package provides
|
|
3
|
+
This package provides the following:
|
|
4
4
|
|
|
5
5
|
1. A web component for embedding the LiipGPT chat UI
|
|
6
|
-
2. A
|
|
6
|
+
2. A web component for embedding the LiipGPT button as a link
|
|
7
|
+
3. A client library for interacting with the LiipGPT API
|
|
7
8
|
|
|
8
|
-
# Chat UI
|
|
9
9
|
|
|
10
|
-
## Setup
|
|
11
10
|
|
|
12
|
-
### With NPM
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
<liipgpt-chat org="..." api-url="..." api-key="..."></liipgpt-chat>
|
|
16
|
-
|
|
17
|
-
<script type="module">
|
|
18
|
-
import '@liip/liipgpt/chat';
|
|
19
|
-
</script>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### With CDN
|
|
23
|
-
|
|
24
|
-
```html
|
|
25
|
-
<!DOCTYPE html>
|
|
26
|
-
<html>
|
|
27
|
-
<head>
|
|
28
|
-
<script
|
|
29
|
-
async
|
|
30
|
-
src="https://cdn.jsdelivr.net/npm/@liip/liipgpt@1.0.0-rc.9/chat/liipgpt-chat.iife.js"
|
|
31
|
-
></script>
|
|
32
|
-
</head>
|
|
33
|
-
<body>
|
|
34
|
-
<liipgpt-chat org="..." api-url="..." api-key="..."></liipgpt-chat>
|
|
35
|
-
</body>
|
|
36
|
-
</html>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
We recommend using `async` to load the script. If you are concerned that the script could slow down the site `defer` can also be used.
|
|
40
|
-
|
|
41
|
-
## Web Component Attributes
|
|
42
|
-
|
|
43
|
-
- `org`: Is used to select theme and translation based on the organization. All available orgs are previewed [here](https://liipgpt.pages.liip.ch/liipgpt-chat/?org=liipgpt).
|
|
44
|
-
- `api-url`: URL to the chat backend
|
|
45
|
-
- `api-key`: API key that can be configured in the admin ui
|
|
46
|
-
- `lang` (optional): this can be used to control the chat ui language by the parent
|
|
47
|
-
|
|
48
|
-
## Flyout Configuration
|
|
49
|
-
|
|
50
|
-
The chat ui is responsive based on the parent container. If you want embed the chat ui (e.g. in a flyout) make sure the parent has a predefined width and height.
|
|
51
|
-
|
|
52
|
-
## Language Support
|
|
53
|
-
|
|
54
|
-
The component supports multiple languages with the following priority:
|
|
55
|
-
|
|
56
|
-
1. Language was set via the `lang` attribute
|
|
57
|
-
2. User selected language in the chat UI
|
|
58
|
-
3. Browser language
|
|
59
|
-
4. Fallback to "en"
|
|
60
|
-
|
|
61
|
-
Supported UI languages: 'en', 'de', 'fr', 'it'
|
|
62
|
-
|
|
63
|
-
## Loader settings
|
|
64
|
-
|
|
65
|
-
A simple loader is provided by default, you can override colors to fit your brand by using the `loaderBackground` and `loaderColor` attributes:
|
|
66
|
-
|
|
67
|
-
```html
|
|
68
|
-
<liipgpt-chat ... loaderBackground="green" loaderColor="white"></liipgpt-chat>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Remarks:
|
|
72
|
-
|
|
73
|
-
- it's recommended to set the same background color (as `loaderBackground`) on the parent container, to avoid a potential flickering.
|
|
74
|
-
- you can pass CSS gradients on the `loaderBackground` attribute.
|
|
75
|
-
|
|
76
|
-
### Custom loader
|
|
77
|
-
|
|
78
|
-
You can also provide your own loader by using the `slot="loader"` attribute on a `div`, within the `liipgpt-chat` element:
|
|
79
|
-
|
|
80
|
-
```html
|
|
81
|
-
<liipgpt-chat org="..." api-url="..." api-key="...">
|
|
82
|
-
<div slot="loader" style="...">
|
|
83
|
-
<svg>your animated svg here</svg>
|
|
84
|
-
<div>or a simple message</div>
|
|
85
|
-
</div>
|
|
86
|
-
</liipgpt-chat>
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
# Library Usage
|
|
90
|
-
|
|
91
|
-
For custom AI integrations, you can use the LiipGPT client:
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
import { LiipGPTClient } from '@liip/liipgpt';
|
|
95
|
-
|
|
96
|
-
const client = new LiipGPTClient({
|
|
97
|
-
apiUrl: 'YOUR_API_URL',
|
|
98
|
-
apiKey: 'YOUR_API_KEY',
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// Start a chat conversation
|
|
102
|
-
const response = client.chat('What can you tell me about Generative AI?');
|
|
103
|
-
|
|
104
|
-
// Subscribe to streaming responses
|
|
105
|
-
response.subscribe((message) => {
|
|
106
|
-
if (message.state === 'streaming') {
|
|
107
|
-
console.log(message.payload.message.markdown);
|
|
108
|
-
}
|
|
109
|
-
if (message.state === 'done') {
|
|
110
|
-
console.log('Chat complete');
|
|
111
|
-
}
|
|
112
|
-
if (message.state === 'error') {
|
|
113
|
-
console.error(message.errorMessage);
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Node.js
|
|
119
|
-
|
|
120
|
-
When using the LiipGPT client in Node.js environments, you'll need to provide an `EventSource` implementation since it's not available natively. You can use the `eventsource` package:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
npm install eventsource
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
Here's how to use the client in Node.js:
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
import { LiipGPTClient } from '@liip/liipgpt';
|
|
130
|
-
import { EventSource } from 'eventsource';
|
|
131
|
-
|
|
132
|
-
const client = new LiipGPTClient({
|
|
133
|
-
apiKey: 'YOUR_API_KEY',
|
|
134
|
-
apiUrl: 'YOUR_API_URL',
|
|
135
|
-
EventSource, // Provide the EventSource implementation
|
|
136
|
-
});
|
|
137
|
-
```
|
|
12
|
+
For more information please refer to: [docs.liipgpt.ch](https://docs.liipgpt.ch)
|