llmasaservice-ui 0.3.10 → 0.3.11

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
@@ -123,13 +123,15 @@ var ChatPanel = ({
123
123
  console.log("groups", groups);
124
124
  const matchIndex = groups[groups.length - 2];
125
125
  const buttonId = `button-${index}-${matchIndex}`;
126
+ console.log("buttonId", buttonId, action);
126
127
  let html = match;
127
128
  if (action.type === "button" || action.type === "callback") {
128
129
  const button = document.getElementById(buttonId);
129
130
  if (!button) {
131
+ console.log("Creating button", buttonId, action);
130
132
  html = `<button id="${buttonId}">${(_a = action.markdown) != null ? _a : match}</button>`;
131
133
  }
132
- } else if (action.type === "markdown") {
134
+ } else if (action.type === "markdown" || action.type === "html") {
133
135
  html = (_b = action.markdown) != null ? _b : "";
134
136
  }
135
137
  html = html.replace(new RegExp("\\$match", "g"), match);
@@ -140,6 +142,7 @@ var ChatPanel = ({
140
142
  const button = document.getElementById(buttonId);
141
143
  if (button) {
142
144
  if (!button.onclick) {
145
+ console.log("Setting button click event", buttonId, action);
143
146
  button.onclick = () => {
144
147
  if (action.callback) {
145
148
  action.callback(match, groups);
@@ -156,6 +159,7 @@ var ChatPanel = ({
156
159
  }
157
160
  }
158
161
  }, 0);
162
+ console.log("html", html);
159
163
  return html;
160
164
  });
161
165
  });
package/dist/index.mjs CHANGED
@@ -90,13 +90,15 @@ var ChatPanel = ({
90
90
  console.log("groups", groups);
91
91
  const matchIndex = groups[groups.length - 2];
92
92
  const buttonId = `button-${index}-${matchIndex}`;
93
+ console.log("buttonId", buttonId, action);
93
94
  let html = match;
94
95
  if (action.type === "button" || action.type === "callback") {
95
96
  const button = document.getElementById(buttonId);
96
97
  if (!button) {
98
+ console.log("Creating button", buttonId, action);
97
99
  html = `<button id="${buttonId}">${(_a = action.markdown) != null ? _a : match}</button>`;
98
100
  }
99
- } else if (action.type === "markdown") {
101
+ } else if (action.type === "markdown" || action.type === "html") {
100
102
  html = (_b = action.markdown) != null ? _b : "";
101
103
  }
102
104
  html = html.replace(new RegExp("\\$match", "g"), match);
@@ -107,6 +109,7 @@ var ChatPanel = ({
107
109
  const button = document.getElementById(buttonId);
108
110
  if (button) {
109
111
  if (!button.onclick) {
112
+ console.log("Setting button click event", buttonId, action);
110
113
  button.onclick = () => {
111
114
  if (action.callback) {
112
115
  action.callback(match, groups);
@@ -123,6 +126,7 @@ var ChatPanel = ({
123
126
  }
124
127
  }
125
128
  }, 0);
129
+ console.log("html", html);
126
130
  return html;
127
131
  });
128
132
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmasaservice-ui",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
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
@@ -125,16 +125,17 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
125
125
  console.log("groups", groups);
126
126
 
127
127
  const matchIndex = groups[groups.length - 2]; // The second-to-last argument is the match index
128
-
129
128
  const buttonId = `button-${index}-${matchIndex}`;
129
+ console.log("buttonId", buttonId, action);
130
130
 
131
131
  let html = match;
132
132
  if (action.type === "button" || action.type === "callback") {
133
133
  const button = document.getElementById(buttonId);
134
134
  if (!button) {
135
+ console.log("Creating button", buttonId, action);
135
136
  html = `<button id="${buttonId}">${action.markdown ?? match}</button>`;
136
137
  }
137
- } else if (action.type === "markdown") {
138
+ } else if (action.type === "markdown" || action.type === "html") {
138
139
  html = action.markdown ?? "";
139
140
  }
140
141
 
@@ -147,6 +148,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
147
148
  const button = document.getElementById(buttonId);
148
149
  if (button) {
149
150
  if (!button.onclick) {
151
+ console.log("Setting button click event", buttonId, action);
150
152
  button.onclick = () => {
151
153
  if (action.callback) {
152
154
  action.callback(match, groups);
@@ -163,6 +165,8 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
163
165
  }
164
166
  }
165
167
  }, 0);
168
+
169
+ console.log("html", html);
166
170
  return html;
167
171
  });
168
172
  });