llmasaservice-ui 0.1.4 → 0.1.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/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;
@@ -35,6 +33,7 @@
35
33
  border-radius: 4px;
36
34
  height: 50px;
37
35
  resize: none;
36
+ color: #000;
38
37
  }
39
38
  .side-panel .send-button {
40
39
  background-color: #007bff;
@@ -43,7 +42,7 @@
43
42
  border-radius: 0.3rem;
44
43
  cursor: pointer;
45
44
  height: 30px;
46
- width: 40px;
45
+ width: 30px;
47
46
  padding: 0;
48
47
  margin: 0;
49
48
  justify-content: center;
@@ -92,6 +91,10 @@
92
91
  width: 18px;
93
92
  height: 18px;
94
93
  }
94
+ .side-panel .icon-svg-large {
95
+ width: 24px;
96
+ height: 24px;
97
+ }
95
98
  .side-panel .copy-button:hover {
96
99
  border: 1px solid #007bff;
97
100
  border-radius: 3px;
@@ -117,8 +120,6 @@
117
120
  sans-serif;
118
121
  font-size: small;
119
122
  color: #eee;
120
- width: 300px;
121
- height: 100vh;
122
123
  background-color: #424242;
123
124
  display: flex;
124
125
  flex-direction: column;
@@ -145,6 +146,7 @@
145
146
  border-radius: 4px;
146
147
  height: 50px;
147
148
  resize: none;
149
+ color: #000;
148
150
  }
149
151
  .side-panel-dark .send-button {
150
152
  background-color: #007bff;
@@ -153,7 +155,11 @@
153
155
  border-radius: 0.3rem;
154
156
  cursor: pointer;
155
157
  height: 30px;
156
- width: 40px;
158
+ width: 30px;
159
+ padding: 0;
160
+ margin: 0;
161
+ justify-content: center;
162
+ align-items: center;
157
163
  }
158
164
  .side-panel-dark .send-button:hover {
159
165
  background-color: #0056b3;
@@ -198,6 +204,10 @@
198
204
  width: 18px;
199
205
  height: 18px;
200
206
  }
207
+ .side-panel-dark .icon-svg-large {
208
+ width: 24px;
209
+ height: 24px;
210
+ }
201
211
  .side-panel-dark .copy-button:hover {
202
212
  border: 1px solid #aaa;
203
213
  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.6",
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;
@@ -18,7 +16,6 @@
18
16
  font-weight: bold;
19
17
  margin-bottom: 10px;
20
18
  text-align: center;
21
-
22
19
  }
23
20
  .side-panel .input-container {
24
21
  display: flex;
@@ -34,6 +31,7 @@
34
31
  border-radius: 4px;
35
32
  height: 50px;
36
33
  resize: none;
34
+ color: #000;
37
35
  }
38
36
 
39
37
  .side-panel .send-button {
@@ -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,12 +98,16 @@
100
98
  height: 18px;
101
99
  }
102
100
 
101
+ .side-panel .icon-svg-large {
102
+ width: 24px;
103
+ height: 24px;
104
+ }
105
+
103
106
  .side-panel .copy-button:hover {
104
107
  border: 1px solid #007bff;
105
108
  border-radius: 3px;
106
109
  }
107
110
 
108
-
109
111
  .side-panel .thumbs-button {
110
112
  font-size: 10px;
111
113
  border: 0px solid #007bff;
@@ -126,8 +128,6 @@
126
128
  font-family: "Roboto", Arial, Helvetica, sans-serif;
127
129
  font-size: small;
128
130
  color: #eee;
129
- width: 300px;
130
- height: 100vh;
131
131
  background-color: #424242;
132
132
  display: flex;
133
133
  flex-direction: column;
@@ -156,6 +156,7 @@
156
156
  border-radius: 4px;
157
157
  height: 50px;
158
158
  resize: none;
159
+ color: #000;
159
160
  }
160
161
 
161
162
  .side-panel-dark .send-button {
@@ -165,7 +166,11 @@
165
166
  border-radius: 0.3rem;
166
167
  cursor: pointer;
167
168
  height: 30px;
168
- width: 40px;
169
+ width: 30px;
170
+ padding: 0;
171
+ margin: 0;
172
+ justify-content: center;
173
+ align-items: center;
169
174
  }
170
175
 
171
176
  .side-panel-dark .send-button:hover {
@@ -218,6 +223,11 @@
218
223
  height: 18px;
219
224
  }
220
225
 
226
+ .side-panel-dark .icon-svg-large {
227
+ width: 24px;
228
+ height: 24px;
229
+ }
230
+
221
231
  .side-panel-dark .copy-button:hover {
222
232
  border: 1px solid #aaa;
223
233
  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
  };