llmasaservice-ui 0.7.4 → 0.7.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.js CHANGED
@@ -248,15 +248,15 @@ var ChatPanel = ({
248
248
  actions.forEach((action, index) => {
249
249
  const regex = new RegExp(action.pattern, "gmi");
250
250
  newResponse = newResponse.replace(regex, (match, ...groups) => {
251
- var _a, _b, _c;
251
+ var _a, _b;
252
252
  console.log("action match", match, groups);
253
253
  const matchIndex = groups[groups.length - 2];
254
254
  const buttonId = `button-${messages.length}-${index}-${matchIndex}`;
255
255
  let html = match;
256
256
  if (action.type === "button" || action.type === "callback") {
257
- html = `<button id="${buttonId}" style="${(_a = action.style) != null ? _a : "button"}">${(_b = action.markdown) != null ? _b : match}</button>`;
257
+ html = ` <button id="${buttonId}" ${action.style ? 'class=" ' + action.style + '"' : ""}>${(_a = action.markdown) != null ? _a : match}</button>`;
258
258
  } else if (action.type === "markdown" || action.type === "html") {
259
- html = (_c = action.markdown) != null ? _c : "";
259
+ html = (_b = action.markdown) != null ? _b : "";
260
260
  }
261
261
  html = html.replace(new RegExp("\\$match", "g"), match);
262
262
  groups.forEach((group, index2) => {
package/dist/index.mjs CHANGED
@@ -214,15 +214,15 @@ var ChatPanel = ({
214
214
  actions.forEach((action, index) => {
215
215
  const regex = new RegExp(action.pattern, "gmi");
216
216
  newResponse = newResponse.replace(regex, (match, ...groups) => {
217
- var _a, _b, _c;
217
+ var _a, _b;
218
218
  console.log("action match", match, groups);
219
219
  const matchIndex = groups[groups.length - 2];
220
220
  const buttonId = `button-${messages.length}-${index}-${matchIndex}`;
221
221
  let html = match;
222
222
  if (action.type === "button" || action.type === "callback") {
223
- html = `<button id="${buttonId}" style="${(_a = action.style) != null ? _a : "button"}">${(_b = action.markdown) != null ? _b : match}</button>`;
223
+ html = ` <button id="${buttonId}" ${action.style ? 'class=" ' + action.style + '"' : ""}>${(_a = action.markdown) != null ? _a : match}</button>`;
224
224
  } else if (action.type === "markdown" || action.type === "html") {
225
- html = (_c = action.markdown) != null ? _c : "";
225
+ html = (_b = action.markdown) != null ? _b : "";
226
226
  }
227
227
  html = html.replace(new RegExp("\\$match", "g"), match);
228
228
  groups.forEach((group, index2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmasaservice-ui",
3
- "version": "0.7.4",
3
+ "version": "0.7.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.tsx CHANGED
@@ -178,7 +178,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
178
178
 
179
179
  let html = match;
180
180
  if (action.type === "button" || action.type === "callback") {
181
- html = `<button id="${buttonId}" style="${action.style ?? 'button'}">${
181
+ html = ` <button id="${buttonId}" ${action.style ? 'class=" ' + action.style + '"' : ''}>${
182
182
  action.markdown ?? match
183
183
  }</button>`;
184
184
  } else if (action.type === "markdown" || action.type === "html") {