llmasaservice-ui 0.3.9 → 0.3.10
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.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/package.json +1 -1
- package/src/ChatPanel.tsx +3 -3
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -118,7 +118,7 @@ var ChatPanel = ({
|
|
|
118
118
|
actions.forEach((action, index) => {
|
|
119
119
|
const regex = new RegExp(action.pattern, "gmi");
|
|
120
120
|
newResponse = newResponse.replace(regex, (match, ...groups) => {
|
|
121
|
-
var _a;
|
|
121
|
+
var _a, _b;
|
|
122
122
|
console.log("match", match);
|
|
123
123
|
console.log("groups", groups);
|
|
124
124
|
const matchIndex = groups[groups.length - 2];
|
|
@@ -127,10 +127,10 @@ var ChatPanel = ({
|
|
|
127
127
|
if (action.type === "button" || action.type === "callback") {
|
|
128
128
|
const button = document.getElementById(buttonId);
|
|
129
129
|
if (!button) {
|
|
130
|
-
html = `<button id="${buttonId}">${match}</button>`;
|
|
130
|
+
html = `<button id="${buttonId}">${(_a = action.markdown) != null ? _a : match}</button>`;
|
|
131
131
|
}
|
|
132
132
|
} else if (action.type === "markdown") {
|
|
133
|
-
html = (
|
|
133
|
+
html = (_b = action.markdown) != null ? _b : "";
|
|
134
134
|
}
|
|
135
135
|
html = html.replace(new RegExp("\\$match", "g"), match);
|
|
136
136
|
groups.forEach((group, index2) => {
|
|
@@ -142,7 +142,7 @@ var ChatPanel = ({
|
|
|
142
142
|
if (!button.onclick) {
|
|
143
143
|
button.onclick = () => {
|
|
144
144
|
if (action.callback) {
|
|
145
|
-
action.callback(match);
|
|
145
|
+
action.callback(match, groups);
|
|
146
146
|
}
|
|
147
147
|
if (action.clickCode) {
|
|
148
148
|
try {
|
package/dist/index.mjs
CHANGED
|
@@ -85,7 +85,7 @@ var ChatPanel = ({
|
|
|
85
85
|
actions.forEach((action, index) => {
|
|
86
86
|
const regex = new RegExp(action.pattern, "gmi");
|
|
87
87
|
newResponse = newResponse.replace(regex, (match, ...groups) => {
|
|
88
|
-
var _a;
|
|
88
|
+
var _a, _b;
|
|
89
89
|
console.log("match", match);
|
|
90
90
|
console.log("groups", groups);
|
|
91
91
|
const matchIndex = groups[groups.length - 2];
|
|
@@ -94,10 +94,10 @@ var ChatPanel = ({
|
|
|
94
94
|
if (action.type === "button" || action.type === "callback") {
|
|
95
95
|
const button = document.getElementById(buttonId);
|
|
96
96
|
if (!button) {
|
|
97
|
-
html = `<button id="${buttonId}">${match}</button>`;
|
|
97
|
+
html = `<button id="${buttonId}">${(_a = action.markdown) != null ? _a : match}</button>`;
|
|
98
98
|
}
|
|
99
99
|
} else if (action.type === "markdown") {
|
|
100
|
-
html = (
|
|
100
|
+
html = (_b = action.markdown) != null ? _b : "";
|
|
101
101
|
}
|
|
102
102
|
html = html.replace(new RegExp("\\$match", "g"), match);
|
|
103
103
|
groups.forEach((group, index2) => {
|
|
@@ -109,7 +109,7 @@ var ChatPanel = ({
|
|
|
109
109
|
if (!button.onclick) {
|
|
110
110
|
button.onclick = () => {
|
|
111
111
|
if (action.callback) {
|
|
112
|
-
action.callback(match);
|
|
112
|
+
action.callback(match, groups);
|
|
113
113
|
}
|
|
114
114
|
if (action.clickCode) {
|
|
115
115
|
try {
|
package/package.json
CHANGED
package/src/ChatPanel.tsx
CHANGED
|
@@ -38,7 +38,7 @@ export interface ChatPanelProps {
|
|
|
38
38
|
pattern: string;
|
|
39
39
|
type?: string;
|
|
40
40
|
markdown?: string;
|
|
41
|
-
callback?: (match: string) => void;
|
|
41
|
+
callback?: (match: string, groups: any[]) => void;
|
|
42
42
|
clickCode?: string;
|
|
43
43
|
}[];
|
|
44
44
|
}
|
|
@@ -132,7 +132,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
132
132
|
if (action.type === "button" || action.type === "callback") {
|
|
133
133
|
const button = document.getElementById(buttonId);
|
|
134
134
|
if (!button) {
|
|
135
|
-
html = `<button id="${buttonId}">${match}</button>`;
|
|
135
|
+
html = `<button id="${buttonId}">${action.markdown ?? match}</button>`;
|
|
136
136
|
}
|
|
137
137
|
} else if (action.type === "markdown") {
|
|
138
138
|
html = action.markdown ?? "";
|
|
@@ -149,7 +149,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
149
149
|
if (!button.onclick) {
|
|
150
150
|
button.onclick = () => {
|
|
151
151
|
if (action.callback) {
|
|
152
|
-
action.callback(match);
|
|
152
|
+
action.callback(match, groups);
|
|
153
153
|
}
|
|
154
154
|
if (action.clickCode) {
|
|
155
155
|
try {
|