llmasaservice-ui 0.1.4 → 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 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;
@@ -43,7 +41,7 @@
43
41
  border-radius: 0.3rem;
44
42
  cursor: pointer;
45
43
  height: 30px;
46
- width: 40px;
44
+ width: 30px;
47
45
  padding: 0;
48
46
  margin: 0;
49
47
  justify-content: center;
@@ -92,6 +90,10 @@
92
90
  width: 18px;
93
91
  height: 18px;
94
92
  }
93
+ .side-panel .icon-svg-large {
94
+ width: 24px;
95
+ height: 24px;
96
+ }
95
97
  .side-panel .copy-button:hover {
96
98
  border: 1px solid #007bff;
97
99
  border-radius: 3px;
@@ -117,8 +119,6 @@
117
119
  sans-serif;
118
120
  font-size: small;
119
121
  color: #eee;
120
- width: 300px;
121
- height: 100vh;
122
122
  background-color: #424242;
123
123
  display: flex;
124
124
  flex-direction: column;
@@ -153,7 +153,11 @@
153
153
  border-radius: 0.3rem;
154
154
  cursor: pointer;
155
155
  height: 30px;
156
- width: 40px;
156
+ width: 30px;
157
+ padding: 0;
158
+ margin: 0;
159
+ justify-content: center;
160
+ align-items: center;
157
161
  }
158
162
  .side-panel-dark .send-button:hover {
159
163
  background-color: #0056b3;
@@ -198,6 +202,10 @@
198
202
  width: 18px;
199
203
  height: 18px;
200
204
  }
205
+ .side-panel-dark .icon-svg-large {
206
+ width: 24px;
207
+ height: 24px;
208
+ }
201
209
  .side-panel-dark .copy-button:hover {
202
210
  border: 1px solid #aaa;
203
211
  border-radius: 3px;
package/dist/index.d.mts CHANGED
@@ -16,6 +16,8 @@ interface ChatPanelProps {
16
16
  thumbsDownClick?: () => void;
17
17
  theme?: "light" | "dark";
18
18
  markdownClass?: string;
19
+ width?: string;
20
+ height?: string;
19
21
  }
20
22
  declare const ChatPanel: React.FC<ChatPanelProps>;
21
23
 
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@ interface ChatPanelProps {
16
16
  thumbsDownClick?: () => void;
17
17
  theme?: "light" | "dark";
18
18
  markdownClass?: string;
19
+ width?: string;
20
+ height?: string;
19
21
  }
20
22
  declare const ChatPanel: React.FC<ChatPanelProps>;
21
23
 
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",
@@ -200,9 +202,9 @@ var ChatPanel = ({
200
202
  "stroke-width": "2",
201
203
  stroke: "currentColor",
202
204
  fill: "none",
203
- "stroke-linecap": "round",
204
- "stroke-linejoin": "round",
205
- className: "icon-svg"
205
+ strokeLinecap: "round",
206
+ strokeLinejoin: "round",
207
+ className: "icon-svg-large"
206
208
  },
207
209
  /* @__PURE__ */ import_react.default.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
208
210
  /* @__PURE__ */ import_react.default.createElement("path", { d: "M10 14l11 -11" }),
@@ -215,7 +217,7 @@ var ChatPanel = ({
215
217
  "stroke-width": "1",
216
218
  stroke: "currentColor",
217
219
  fill: "currentColor",
218
- className: "icon-svg"
220
+ className: "icon-svg-large"
219
221
  },
220
222
  /* @__PURE__ */ import_react.default.createElement("path", { d: "M8 8h16v16H8z" })
221
223
  )))));
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",
@@ -167,9 +169,9 @@ var ChatPanel = ({
167
169
  "stroke-width": "2",
168
170
  stroke: "currentColor",
169
171
  fill: "none",
170
- "stroke-linecap": "round",
171
- "stroke-linejoin": "round",
172
- className: "icon-svg"
172
+ strokeLinecap: "round",
173
+ strokeLinejoin: "round",
174
+ className: "icon-svg-large"
173
175
  },
174
176
  /* @__PURE__ */ React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
175
177
  /* @__PURE__ */ React.createElement("path", { d: "M10 14l11 -11" }),
@@ -182,7 +184,7 @@ var ChatPanel = ({
182
184
  "stroke-width": "1",
183
185
  stroke: "currentColor",
184
186
  fill: "currentColor",
185
- className: "icon-svg"
187
+ className: "icon-svg-large"
186
188
  },
187
189
  /* @__PURE__ */ React.createElement("path", { d: "M8 8h16v16H8z" })
188
190
  )))));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmasaservice-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Prebuilt UI components for LLMAsAService.io",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
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;
@@ -43,7 +41,7 @@
43
41
  border-radius: 0.3rem;
44
42
  cursor: pointer;
45
43
  height: 30px;
46
- width: 40px;
44
+ width: 30px;
47
45
  padding: 0;
48
46
  margin: 0;
49
47
  justify-content: center;
@@ -100,6 +98,12 @@
100
98
  height: 18px;
101
99
  }
102
100
 
101
+ .side-panel .icon-svg-large {
102
+ width: 24px;
103
+ height: 24px;
104
+ }
105
+
106
+
103
107
  .side-panel .copy-button:hover {
104
108
  border: 1px solid #007bff;
105
109
  border-radius: 3px;
@@ -126,8 +130,6 @@
126
130
  font-family: "Roboto", Arial, Helvetica, sans-serif;
127
131
  font-size: small;
128
132
  color: #eee;
129
- width: 300px;
130
- height: 100vh;
131
133
  background-color: #424242;
132
134
  display: flex;
133
135
  flex-direction: column;
@@ -165,7 +167,11 @@
165
167
  border-radius: 0.3rem;
166
168
  cursor: pointer;
167
169
  height: 30px;
168
- width: 40px;
170
+ width: 30px;
171
+ padding: 0;
172
+ margin: 0;
173
+ justify-content: center;
174
+ align-items: center;
169
175
  }
170
176
 
171
177
  .side-panel-dark .send-button:hover {
@@ -218,6 +224,12 @@
218
224
  height: 18px;
219
225
  }
220
226
 
227
+ .side-panel-dark .icon-svg-large {
228
+ width: 24px;
229
+ height: 24px;
230
+ }
231
+
232
+
221
233
  .side-panel-dark .copy-button:hover {
222
234
  border: 1px solid #aaa;
223
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}
@@ -204,9 +208,9 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
204
208
  stroke-width="2"
205
209
  stroke="currentColor"
206
210
  fill="none"
207
- stroke-linecap="round"
208
- stroke-linejoin="round"
209
- className="icon-svg"
211
+ strokeLinecap="round"
212
+ strokeLinejoin="round"
213
+ className="icon-svg-large"
210
214
  >
211
215
  <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
212
216
  <path d="M10 14l11 -11"></path>
@@ -219,7 +223,7 @@ const ChatPanel: React.FC<ChatPanelProps> = ({
219
223
  stroke-width="1"
220
224
  stroke="currentColor"
221
225
  fill="currentColor"
222
- className="icon-svg"
226
+ className="icon-svg-large"
223
227
  >
224
228
  <path d="M8 8h16v16H8z" />
225
229
  </svg>
@@ -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
  };