llmasaservice-ui 0.1.3 → 0.1.5
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/dist/index.css +20 -6
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +31 -3
- package/dist/index.mjs +31 -3
- package/package.json +1 -1
- package/src/ChatPanel.css +24 -6
- package/src/ChatPanel.tsx +32 -2
- package/src/stories/ChatPanel.stories.ts +21 -0
package/dist/index.css
CHANGED
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
sans-serif;
|
|
8
8
|
font-size: small;
|
|
9
9
|
color: #000;
|
|
10
|
-
width: 300px;
|
|
11
|
-
height: 100vh;
|
|
12
10
|
background-color: #eee;
|
|
13
11
|
display: flex;
|
|
14
12
|
flex-direction: column;
|
|
@@ -40,9 +38,14 @@
|
|
|
40
38
|
background-color: #007bff;
|
|
41
39
|
color: white;
|
|
42
40
|
border: none;
|
|
43
|
-
border-radius:
|
|
41
|
+
border-radius: 0.3rem;
|
|
44
42
|
cursor: pointer;
|
|
45
43
|
height: 30px;
|
|
44
|
+
width: 30px;
|
|
45
|
+
padding: 0;
|
|
46
|
+
margin: 0;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
46
49
|
}
|
|
47
50
|
.side-panel .send-button:hover {
|
|
48
51
|
background-color: #0056b3;
|
|
@@ -87,6 +90,10 @@
|
|
|
87
90
|
width: 18px;
|
|
88
91
|
height: 18px;
|
|
89
92
|
}
|
|
93
|
+
.side-panel .icon-svg-large {
|
|
94
|
+
width: 24px;
|
|
95
|
+
height: 24px;
|
|
96
|
+
}
|
|
90
97
|
.side-panel .copy-button:hover {
|
|
91
98
|
border: 1px solid #007bff;
|
|
92
99
|
border-radius: 3px;
|
|
@@ -112,8 +119,6 @@
|
|
|
112
119
|
sans-serif;
|
|
113
120
|
font-size: small;
|
|
114
121
|
color: #eee;
|
|
115
|
-
width: 300px;
|
|
116
|
-
height: 100vh;
|
|
117
122
|
background-color: #424242;
|
|
118
123
|
display: flex;
|
|
119
124
|
flex-direction: column;
|
|
@@ -145,9 +150,14 @@
|
|
|
145
150
|
background-color: #007bff;
|
|
146
151
|
color: white;
|
|
147
152
|
border: none;
|
|
148
|
-
border-radius:
|
|
153
|
+
border-radius: 0.3rem;
|
|
149
154
|
cursor: pointer;
|
|
150
155
|
height: 30px;
|
|
156
|
+
width: 30px;
|
|
157
|
+
padding: 0;
|
|
158
|
+
margin: 0;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
align-items: center;
|
|
151
161
|
}
|
|
152
162
|
.side-panel-dark .send-button:hover {
|
|
153
163
|
background-color: #0056b3;
|
|
@@ -192,6 +202,10 @@
|
|
|
192
202
|
width: 18px;
|
|
193
203
|
height: 18px;
|
|
194
204
|
}
|
|
205
|
+
.side-panel-dark .icon-svg-large {
|
|
206
|
+
width: 24px;
|
|
207
|
+
height: 24px;
|
|
208
|
+
}
|
|
195
209
|
.side-panel-dark .copy-button:hover {
|
|
196
210
|
border: 1px solid #aaa;
|
|
197
211
|
border-radius: 3px;
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -66,7 +66,9 @@ var ChatPanel = ({
|
|
|
66
66
|
thumbsUpClick,
|
|
67
67
|
thumbsDownClick,
|
|
68
68
|
theme = "light",
|
|
69
|
-
markdownClass = null
|
|
69
|
+
markdownClass = null,
|
|
70
|
+
width = "300px",
|
|
71
|
+
height = "100vh"
|
|
70
72
|
}) => {
|
|
71
73
|
const { send, response, idle, stop } = (0, import_llmasaservice_client.useLLM)({
|
|
72
74
|
project_id,
|
|
@@ -132,7 +134,7 @@ var ChatPanel = ({
|
|
|
132
134
|
function copyToClipboard(text) {
|
|
133
135
|
navigator.clipboard.writeText(text);
|
|
134
136
|
}
|
|
135
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "side-panel" + (theme === "light" ? "" : "-dark") }, /* @__PURE__ */ import_react.default.createElement("div", { className: "title" }, title), /* @__PURE__ */ import_react.default.createElement("div", { className: "responseArea" }, isLoading ? /* @__PURE__ */ import_react.default.createElement("div", { className: "loading-text" }, "loading...") : null, Object.entries(history).map(([prompt, response2], index) => /* @__PURE__ */ import_react.default.createElement("div", { className: "history-entry", key: index }, hideInitialPrompt && index === 0 ? null : /* @__PURE__ */ import_react.default.createElement("div", { className: "prompt" }, prompt), /* @__PURE__ */ import_react.default.createElement("div", { className: "response" }, /* @__PURE__ */ import_react.default.createElement(import_react_markdown.default, { className: markdownClass }, response2), /* @__PURE__ */ import_react.default.createElement(
|
|
137
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { style: { width, height }, className: "side-panel" + (theme === "light" ? "" : "-dark") }, /* @__PURE__ */ import_react.default.createElement("div", { className: "title" }, title), /* @__PURE__ */ import_react.default.createElement("div", { className: "responseArea" }, isLoading ? /* @__PURE__ */ import_react.default.createElement("div", { className: "loading-text" }, "loading...") : null, Object.entries(history).map(([prompt, response2], index) => /* @__PURE__ */ import_react.default.createElement("div", { className: "history-entry", key: index }, hideInitialPrompt && index === 0 ? null : /* @__PURE__ */ import_react.default.createElement("div", { className: "prompt" }, prompt), /* @__PURE__ */ import_react.default.createElement("div", { className: "response" }, /* @__PURE__ */ import_react.default.createElement(import_react_markdown.default, { className: markdownClass }, response2), /* @__PURE__ */ import_react.default.createElement(
|
|
136
138
|
"button",
|
|
137
139
|
{
|
|
138
140
|
className: "copy-button",
|
|
@@ -192,7 +194,33 @@ var ChatPanel = ({
|
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
|
-
), /* @__PURE__ */ import_react.default.createElement("button", { className: "send-button", onClick: continueChat }, idle ?
|
|
197
|
+
), /* @__PURE__ */ import_react.default.createElement("button", { className: "send-button", onClick: continueChat }, idle ? /* @__PURE__ */ import_react.default.createElement(
|
|
198
|
+
"svg",
|
|
199
|
+
{
|
|
200
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
201
|
+
viewBox: "0 0 24 24",
|
|
202
|
+
"stroke-width": "2",
|
|
203
|
+
stroke: "currentColor",
|
|
204
|
+
fill: "none",
|
|
205
|
+
strokeLinecap: "round",
|
|
206
|
+
strokeLinejoin: "round",
|
|
207
|
+
className: "icon-svg-large"
|
|
208
|
+
},
|
|
209
|
+
/* @__PURE__ */ import_react.default.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
210
|
+
/* @__PURE__ */ import_react.default.createElement("path", { d: "M10 14l11 -11" }),
|
|
211
|
+
/* @__PURE__ */ import_react.default.createElement("path", { d: "M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5" })
|
|
212
|
+
) : /* @__PURE__ */ import_react.default.createElement(
|
|
213
|
+
"svg",
|
|
214
|
+
{
|
|
215
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
216
|
+
viewBox: "0 0 24 24",
|
|
217
|
+
"stroke-width": "1",
|
|
218
|
+
stroke: "currentColor",
|
|
219
|
+
fill: "currentColor",
|
|
220
|
+
className: "icon-svg-large"
|
|
221
|
+
},
|
|
222
|
+
/* @__PURE__ */ import_react.default.createElement("path", { d: "M8 8h16v16H8z" })
|
|
223
|
+
)))));
|
|
196
224
|
};
|
|
197
225
|
var ChatPanel_default = ChatPanel;
|
|
198
226
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,9 @@ var ChatPanel = ({
|
|
|
33
33
|
thumbsUpClick,
|
|
34
34
|
thumbsDownClick,
|
|
35
35
|
theme = "light",
|
|
36
|
-
markdownClass = null
|
|
36
|
+
markdownClass = null,
|
|
37
|
+
width = "300px",
|
|
38
|
+
height = "100vh"
|
|
37
39
|
}) => {
|
|
38
40
|
const { send, response, idle, stop } = useLLM({
|
|
39
41
|
project_id,
|
|
@@ -99,7 +101,7 @@ var ChatPanel = ({
|
|
|
99
101
|
function copyToClipboard(text) {
|
|
100
102
|
navigator.clipboard.writeText(text);
|
|
101
103
|
}
|
|
102
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "side-panel" + (theme === "light" ? "" : "-dark") }, /* @__PURE__ */ React.createElement("div", { className: "title" }, title), /* @__PURE__ */ React.createElement("div", { className: "responseArea" }, isLoading ? /* @__PURE__ */ React.createElement("div", { className: "loading-text" }, "loading...") : null, Object.entries(history).map(([prompt, response2], index) => /* @__PURE__ */ React.createElement("div", { className: "history-entry", key: index }, hideInitialPrompt && index === 0 ? null : /* @__PURE__ */ React.createElement("div", { className: "prompt" }, prompt), /* @__PURE__ */ React.createElement("div", { className: "response" }, /* @__PURE__ */ React.createElement(ReactMarkdown, { className: markdownClass }, response2), /* @__PURE__ */ React.createElement(
|
|
104
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { style: { width, height }, className: "side-panel" + (theme === "light" ? "" : "-dark") }, /* @__PURE__ */ React.createElement("div", { className: "title" }, title), /* @__PURE__ */ React.createElement("div", { className: "responseArea" }, isLoading ? /* @__PURE__ */ React.createElement("div", { className: "loading-text" }, "loading...") : null, Object.entries(history).map(([prompt, response2], index) => /* @__PURE__ */ React.createElement("div", { className: "history-entry", key: index }, hideInitialPrompt && index === 0 ? null : /* @__PURE__ */ React.createElement("div", { className: "prompt" }, prompt), /* @__PURE__ */ React.createElement("div", { className: "response" }, /* @__PURE__ */ React.createElement(ReactMarkdown, { className: markdownClass }, response2), /* @__PURE__ */ React.createElement(
|
|
103
105
|
"button",
|
|
104
106
|
{
|
|
105
107
|
className: "copy-button",
|
|
@@ -159,7 +161,33 @@ var ChatPanel = ({
|
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
|
-
), /* @__PURE__ */ React.createElement("button", { className: "send-button", onClick: continueChat }, idle ?
|
|
164
|
+
), /* @__PURE__ */ React.createElement("button", { className: "send-button", onClick: continueChat }, idle ? /* @__PURE__ */ React.createElement(
|
|
165
|
+
"svg",
|
|
166
|
+
{
|
|
167
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
168
|
+
viewBox: "0 0 24 24",
|
|
169
|
+
"stroke-width": "2",
|
|
170
|
+
stroke: "currentColor",
|
|
171
|
+
fill: "none",
|
|
172
|
+
strokeLinecap: "round",
|
|
173
|
+
strokeLinejoin: "round",
|
|
174
|
+
className: "icon-svg-large"
|
|
175
|
+
},
|
|
176
|
+
/* @__PURE__ */ React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
177
|
+
/* @__PURE__ */ React.createElement("path", { d: "M10 14l11 -11" }),
|
|
178
|
+
/* @__PURE__ */ React.createElement("path", { d: "M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5" })
|
|
179
|
+
) : /* @__PURE__ */ React.createElement(
|
|
180
|
+
"svg",
|
|
181
|
+
{
|
|
182
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
183
|
+
viewBox: "0 0 24 24",
|
|
184
|
+
"stroke-width": "1",
|
|
185
|
+
stroke: "currentColor",
|
|
186
|
+
fill: "currentColor",
|
|
187
|
+
className: "icon-svg-large"
|
|
188
|
+
},
|
|
189
|
+
/* @__PURE__ */ React.createElement("path", { d: "M8 8h16v16H8z" })
|
|
190
|
+
)))));
|
|
163
191
|
};
|
|
164
192
|
var ChatPanel_default = ChatPanel;
|
|
165
193
|
export {
|
package/package.json
CHANGED
package/src/ChatPanel.css
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
font-family: "Roboto", Arial, Helvetica, sans-serif;
|
|
4
4
|
font-size: small;
|
|
5
5
|
color: #000;
|
|
6
|
-
width: 300px;
|
|
7
|
-
height: 100vh;
|
|
8
6
|
background-color: #eee;
|
|
9
7
|
display: flex;
|
|
10
8
|
flex-direction: column;
|
|
@@ -40,9 +38,14 @@
|
|
|
40
38
|
background-color: #007bff;
|
|
41
39
|
color: white;
|
|
42
40
|
border: none;
|
|
43
|
-
border-radius:
|
|
41
|
+
border-radius: 0.3rem;
|
|
44
42
|
cursor: pointer;
|
|
45
43
|
height: 30px;
|
|
44
|
+
width: 30px;
|
|
45
|
+
padding: 0;
|
|
46
|
+
margin: 0;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
.side-panel .send-button:hover {
|
|
@@ -95,6 +98,12 @@
|
|
|
95
98
|
height: 18px;
|
|
96
99
|
}
|
|
97
100
|
|
|
101
|
+
.side-panel .icon-svg-large {
|
|
102
|
+
width: 24px;
|
|
103
|
+
height: 24px;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
98
107
|
.side-panel .copy-button:hover {
|
|
99
108
|
border: 1px solid #007bff;
|
|
100
109
|
border-radius: 3px;
|
|
@@ -121,8 +130,6 @@
|
|
|
121
130
|
font-family: "Roboto", Arial, Helvetica, sans-serif;
|
|
122
131
|
font-size: small;
|
|
123
132
|
color: #eee;
|
|
124
|
-
width: 300px;
|
|
125
|
-
height: 100vh;
|
|
126
133
|
background-color: #424242;
|
|
127
134
|
display: flex;
|
|
128
135
|
flex-direction: column;
|
|
@@ -157,9 +164,14 @@
|
|
|
157
164
|
background-color: #007bff;
|
|
158
165
|
color: white;
|
|
159
166
|
border: none;
|
|
160
|
-
border-radius:
|
|
167
|
+
border-radius: 0.3rem;
|
|
161
168
|
cursor: pointer;
|
|
162
169
|
height: 30px;
|
|
170
|
+
width: 30px;
|
|
171
|
+
padding: 0;
|
|
172
|
+
margin: 0;
|
|
173
|
+
justify-content: center;
|
|
174
|
+
align-items: center;
|
|
163
175
|
}
|
|
164
176
|
|
|
165
177
|
.side-panel-dark .send-button:hover {
|
|
@@ -212,6 +224,12 @@
|
|
|
212
224
|
height: 18px;
|
|
213
225
|
}
|
|
214
226
|
|
|
227
|
+
.side-panel-dark .icon-svg-large {
|
|
228
|
+
width: 24px;
|
|
229
|
+
height: 24px;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
215
233
|
.side-panel-dark .copy-button:hover {
|
|
216
234
|
border: 1px solid #aaa;
|
|
217
235
|
border-radius: 3px;
|
package/src/ChatPanel.tsx
CHANGED
|
@@ -15,6 +15,8 @@ export interface ChatPanelProps {
|
|
|
15
15
|
thumbsDownClick?: () => void;
|
|
16
16
|
theme?: "light" | "dark";
|
|
17
17
|
markdownClass?: string;
|
|
18
|
+
width?: string;
|
|
19
|
+
height?: string;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
const ChatPanel: React.FC<ChatPanelProps> = ({
|
|
@@ -29,6 +31,8 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
|
|
|
29
31
|
thumbsDownClick,
|
|
30
32
|
theme = "light",
|
|
31
33
|
markdownClass = null,
|
|
34
|
+
width = "300px",
|
|
35
|
+
height = "100vh",
|
|
32
36
|
}) => {
|
|
33
37
|
const { send, response, idle, stop } = useLLM({
|
|
34
38
|
project_id: project_id,
|
|
@@ -116,7 +120,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
|
|
|
116
120
|
|
|
117
121
|
return (
|
|
118
122
|
<>
|
|
119
|
-
<div className={"side-panel" + (theme === "light" ? "" : "-dark")}>
|
|
123
|
+
<div style={{width: width, height: height}} className={"side-panel" + (theme === "light" ? "" : "-dark")}>
|
|
120
124
|
<div className="title">{title}</div>
|
|
121
125
|
<div className="responseArea">
|
|
122
126
|
{isLoading ? <div className="loading-text">loading...</div> : null}
|
|
@@ -197,7 +201,33 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
|
|
|
197
201
|
}}
|
|
198
202
|
></textarea>
|
|
199
203
|
<button className="send-button" onClick={continueChat}>
|
|
200
|
-
{idle ?
|
|
204
|
+
{idle ? (
|
|
205
|
+
<svg
|
|
206
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
207
|
+
viewBox="0 0 24 24"
|
|
208
|
+
stroke-width="2"
|
|
209
|
+
stroke="currentColor"
|
|
210
|
+
fill="none"
|
|
211
|
+
strokeLinecap="round"
|
|
212
|
+
strokeLinejoin="round"
|
|
213
|
+
className="icon-svg-large"
|
|
214
|
+
>
|
|
215
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
|
216
|
+
<path d="M10 14l11 -11"></path>
|
|
217
|
+
<path d="M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5"></path>
|
|
218
|
+
</svg>
|
|
219
|
+
) : (
|
|
220
|
+
<svg
|
|
221
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
222
|
+
viewBox="0 0 24 24"
|
|
223
|
+
stroke-width="1"
|
|
224
|
+
stroke="currentColor"
|
|
225
|
+
fill="currentColor"
|
|
226
|
+
className="icon-svg-large"
|
|
227
|
+
>
|
|
228
|
+
<path d="M8 8h16v16H8z" />
|
|
229
|
+
</svg>
|
|
230
|
+
)}
|
|
201
231
|
</button>
|
|
202
232
|
</div>
|
|
203
233
|
</div>
|
|
@@ -23,6 +23,8 @@ export const ChatPanelStory: Story = {
|
|
|
23
23
|
placeholder: "Type a message",
|
|
24
24
|
theme: "light",
|
|
25
25
|
messages: [],
|
|
26
|
+
width:"300px",
|
|
27
|
+
height:"100vh",
|
|
26
28
|
},
|
|
27
29
|
};
|
|
28
30
|
|
|
@@ -36,6 +38,8 @@ export const ChatPanelThumbsStory: Story = {
|
|
|
36
38
|
theme: "dark",
|
|
37
39
|
thumbsUpClick: () => alert("Thumbs up clicked"),
|
|
38
40
|
thumbsDownClick: () => alert("Thumbs down clicked"),
|
|
41
|
+
width:"300px",
|
|
42
|
+
height:"100vh",
|
|
39
43
|
},
|
|
40
44
|
};
|
|
41
45
|
|
|
@@ -55,5 +59,22 @@ export const ChatPanelSystemInstructionStory: Story = {
|
|
|
55
59
|
content: "Give all responses like a pirate",
|
|
56
60
|
},
|
|
57
61
|
],
|
|
62
|
+
width:"300px",
|
|
63
|
+
height:"100vh",
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const ChatPanelHorizontalThumbsStory: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
title: "Chat",
|
|
70
|
+
project_id: "[get this from your control panel]",
|
|
71
|
+
initialPrompt: "Hi",
|
|
72
|
+
hideInitialPrompt: true,
|
|
73
|
+
placeholder: "Type a message",
|
|
74
|
+
theme: "dark",
|
|
75
|
+
thumbsUpClick: () => alert("Thumbs up clicked"),
|
|
76
|
+
thumbsDownClick: () => alert("Thumbs down clicked"),
|
|
77
|
+
width:"800px",
|
|
78
|
+
height:"400px",
|
|
58
79
|
},
|
|
59
80
|
};
|