llmasaservice-ui 0.3.5 → 0.3.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 +3 -4
- package/dist/index.mjs +3 -4
- package/package.json +1 -1
- package/src/ChatPanel.tsx +6 -7
package/dist/index.js
CHANGED
|
@@ -116,9 +116,11 @@ var ChatPanel = ({
|
|
|
116
116
|
let newResponse = response;
|
|
117
117
|
if (actions && actions.length > 0) {
|
|
118
118
|
actions.forEach((action, index) => {
|
|
119
|
-
const regex = new RegExp(action.pattern, "
|
|
119
|
+
const regex = new RegExp(action.pattern, "gmi");
|
|
120
120
|
newResponse = newResponse.replace(regex, (match, ...groups) => {
|
|
121
121
|
var _a;
|
|
122
|
+
console.log("match", match);
|
|
123
|
+
console.log("groups", groups);
|
|
122
124
|
const matchIndex = groups[groups.length - 2];
|
|
123
125
|
const buttonId = `button-${index}-${matchIndex}`;
|
|
124
126
|
let html = match;
|
|
@@ -169,14 +171,11 @@ var ChatPanel = ({
|
|
|
169
171
|
return element.scrollHeight > element.clientHeight;
|
|
170
172
|
}
|
|
171
173
|
(0, import_react.useEffect)(() => {
|
|
172
|
-
console.log("initialPrompt", initialPrompt);
|
|
173
|
-
console.log("lastPrompt", lastPrompt);
|
|
174
174
|
if (initialPrompt && initialPrompt !== "") {
|
|
175
175
|
if (initialPrompt !== lastPrompt) {
|
|
176
176
|
setIsLoading(true);
|
|
177
177
|
if (lastController) stop(lastController);
|
|
178
178
|
const controller = new AbortController();
|
|
179
|
-
console.log("sending initial prompt", initialPrompt);
|
|
180
179
|
send(initialPrompt, messages, data, true, true, service, controller);
|
|
181
180
|
setLastPrompt(initialPrompt);
|
|
182
181
|
setLastController(controller);
|
package/dist/index.mjs
CHANGED
|
@@ -83,9 +83,11 @@ var ChatPanel = ({
|
|
|
83
83
|
let newResponse = response;
|
|
84
84
|
if (actions && actions.length > 0) {
|
|
85
85
|
actions.forEach((action, index) => {
|
|
86
|
-
const regex = new RegExp(action.pattern, "
|
|
86
|
+
const regex = new RegExp(action.pattern, "gmi");
|
|
87
87
|
newResponse = newResponse.replace(regex, (match, ...groups) => {
|
|
88
88
|
var _a;
|
|
89
|
+
console.log("match", match);
|
|
90
|
+
console.log("groups", groups);
|
|
89
91
|
const matchIndex = groups[groups.length - 2];
|
|
90
92
|
const buttonId = `button-${index}-${matchIndex}`;
|
|
91
93
|
let html = match;
|
|
@@ -136,14 +138,11 @@ var ChatPanel = ({
|
|
|
136
138
|
return element.scrollHeight > element.clientHeight;
|
|
137
139
|
}
|
|
138
140
|
useEffect(() => {
|
|
139
|
-
console.log("initialPrompt", initialPrompt);
|
|
140
|
-
console.log("lastPrompt", lastPrompt);
|
|
141
141
|
if (initialPrompt && initialPrompt !== "") {
|
|
142
142
|
if (initialPrompt !== lastPrompt) {
|
|
143
143
|
setIsLoading(true);
|
|
144
144
|
if (lastController) stop(lastController);
|
|
145
145
|
const controller = new AbortController();
|
|
146
|
-
console.log("sending initial prompt", initialPrompt);
|
|
147
146
|
send(initialPrompt, messages, data, true, true, service, controller);
|
|
148
147
|
setLastPrompt(initialPrompt);
|
|
149
148
|
setLastController(controller);
|
package/package.json
CHANGED
package/src/ChatPanel.tsx
CHANGED
|
@@ -108,7 +108,7 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
"pattern": "the",
|
|
111
|
-
"type": "button",
|
|
111
|
+
"type": "button",
|
|
112
112
|
"clickCode": "alert(match);"
|
|
113
113
|
}
|
|
114
114
|
]
|
|
@@ -118,8 +118,12 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
118
118
|
// replace actions with links
|
|
119
119
|
if (actions && actions.length > 0) {
|
|
120
120
|
actions.forEach((action, index) => {
|
|
121
|
-
const regex = new RegExp(action.pattern, "
|
|
121
|
+
const regex = new RegExp(action.pattern, "gmi");
|
|
122
122
|
newResponse = newResponse.replace(regex, (match, ...groups) => {
|
|
123
|
+
|
|
124
|
+
console.log("match", match);
|
|
125
|
+
console.log("groups", groups);
|
|
126
|
+
|
|
123
127
|
const matchIndex = groups[groups.length - 2]; // The second-to-last argument is the match index
|
|
124
128
|
|
|
125
129
|
const buttonId = `button-${index}-${matchIndex}`;
|
|
@@ -179,9 +183,6 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
179
183
|
|
|
180
184
|
// initial prompt change. Reset the chat history and get this response
|
|
181
185
|
useEffect(() => {
|
|
182
|
-
console.log("initialPrompt", initialPrompt);
|
|
183
|
-
console.log("lastPrompt", lastPrompt);
|
|
184
|
-
|
|
185
186
|
if (initialPrompt && initialPrompt !== "") {
|
|
186
187
|
if (initialPrompt !== lastPrompt) {
|
|
187
188
|
setIsLoading(true);
|
|
@@ -189,8 +190,6 @@ const ChatPanel: React.FC<ChatPanelProps & ExtraProps> = ({
|
|
|
189
190
|
if (lastController) stop(lastController);
|
|
190
191
|
const controller = new AbortController();
|
|
191
192
|
|
|
192
|
-
console.log("sending initial prompt", initialPrompt);
|
|
193
|
-
|
|
194
193
|
send(initialPrompt, messages, data, true, true, service, controller);
|
|
195
194
|
setLastPrompt(initialPrompt);
|
|
196
195
|
setLastController(controller);
|