@liip/liipgpt 0.0.13 → 0.0.15
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/chat/index.html +34 -1
- package/chat/liipgpt-chat.iife.js +213 -79
- package/lib/liipgpt-client.d.ts +10 -10
- package/lib/liipgpt-client.js +151 -124
- package/lib/liipgpt-client.umd.cjs +17 -17
- package/lib/tooltip.d.ts +12 -0
- package/package.json +1 -1
package/chat/index.html
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
const orgs = ["alva","default","liipgpt"];
|
|
20
20
|
|
|
21
21
|
const sidebarTop = document.getElementById('sidebar__top');
|
|
22
|
+
const sidebarCenter = document.getElementById('sidebar__center');
|
|
22
23
|
const sidebarBottom = document.getElementById('sidebar__bottom');
|
|
23
24
|
|
|
24
25
|
orgs.forEach((org) => {
|
|
@@ -39,16 +40,44 @@
|
|
|
39
40
|
boxLayoutBtn.onclick = () => document.getElementById('chat-wrapper').classList.add('box-layout');
|
|
40
41
|
sidebarBottom.appendChild(boxLayoutBtn);
|
|
41
42
|
|
|
43
|
+
// Add language toggle buttons
|
|
44
|
+
const langContainer = document.createElement('div');
|
|
45
|
+
langContainer.style.display = 'grid';
|
|
46
|
+
langContainer.style.gridTemplateColumns = 'repeat(2, 1fr)';
|
|
47
|
+
langContainer.style.gap = '8px';
|
|
48
|
+
|
|
49
|
+
const languages = ['en', 'de', 'fr', 'it'];
|
|
50
|
+
languages.forEach((lang) => {
|
|
51
|
+
const langLink = document.createElement('a');
|
|
52
|
+
langLink.classList.add('button');
|
|
53
|
+
langLink.textContent = lang;
|
|
54
|
+
langLink.href = '#';
|
|
55
|
+
langLink.style.textDecoration = 'none';
|
|
56
|
+
langLink.onclick = (e) => {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
const url = new URL(window.location.href);
|
|
59
|
+
url.searchParams.set('lang', lang.toLowerCase());
|
|
60
|
+
window.location.href = url.toString();
|
|
61
|
+
};
|
|
62
|
+
langContainer.appendChild(langLink);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
sidebarBottom.appendChild(langContainer);
|
|
66
|
+
|
|
42
67
|
let chat;
|
|
43
68
|
|
|
44
69
|
function setOrg(org) {
|
|
45
70
|
chat?.remove();
|
|
46
71
|
|
|
72
|
+
const params = new URLSearchParams(window.location.search);
|
|
73
|
+
const forceLang = params.get('lang');
|
|
74
|
+
|
|
47
75
|
chat = document.createElement('liipgpt-chat');
|
|
48
76
|
chat.id = 'chat';
|
|
49
77
|
chat.setAttribute('org', org);
|
|
50
78
|
chat.setAttribute('apiUrl', 'https://liipgpt.api.dev.genai.liip.ch/liipgpt');
|
|
51
79
|
chat.setAttribute('apiKey', 'X9hL4Gp5W2D7eRtF');
|
|
80
|
+
chat.setAttribute('lang', forceLang);
|
|
52
81
|
document.getElementById('chat-wrapper').appendChild(chat);
|
|
53
82
|
|
|
54
83
|
const url = new URL(window.location.href);
|
|
@@ -90,6 +119,7 @@
|
|
|
90
119
|
min-width: 150px;
|
|
91
120
|
height: 100vh;
|
|
92
121
|
box-sizing: border-box;
|
|
122
|
+
font-size: 0.8rem;
|
|
93
123
|
}
|
|
94
124
|
|
|
95
125
|
#sidebar__top {
|
|
@@ -104,7 +134,8 @@
|
|
|
104
134
|
gap: 8px;
|
|
105
135
|
}
|
|
106
136
|
|
|
107
|
-
#sidebar button
|
|
137
|
+
#sidebar button,
|
|
138
|
+
#sidebar .button {
|
|
108
139
|
padding: 8px 16px;
|
|
109
140
|
border: 1px solid #ddd;
|
|
110
141
|
border-radius: 4px;
|
|
@@ -112,6 +143,8 @@
|
|
|
112
143
|
color: black;
|
|
113
144
|
cursor: pointer;
|
|
114
145
|
transition: background-color 0.2s;
|
|
146
|
+
font-size: inherit;
|
|
147
|
+
text-align: center;
|
|
115
148
|
}
|
|
116
149
|
#sidebar button:hover {
|
|
117
150
|
background-color: #eee;
|