wingbot 3.59.0 → 3.59.1
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/package.json
CHANGED
|
@@ -123,6 +123,28 @@ function chatgptPlugin (params, configuration = {}) {
|
|
|
123
123
|
.forEach((t) => {
|
|
124
124
|
let trim = t.trim();
|
|
125
125
|
|
|
126
|
+
if (annotation) {
|
|
127
|
+
// replace the annotation first
|
|
128
|
+
|
|
129
|
+
const replacements = annotation.split(MSG_REPLACE);
|
|
130
|
+
const last = replacements.length > 1
|
|
131
|
+
? replacements.length - 1
|
|
132
|
+
: replacements.length;
|
|
133
|
+
replacements.forEach((r, i) => {
|
|
134
|
+
const foundI = trim.indexOf(r.trim(), i === last
|
|
135
|
+
? trim.length - r.trim().length
|
|
136
|
+
: 0);
|
|
137
|
+
|
|
138
|
+
if (foundI === -1
|
|
139
|
+
|| (i === 0 && foundI > 0)
|
|
140
|
+
|| (i === last && (trim.length - foundI - r.length) > 0)) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
trim = trim.replace(r.trim(), '').trim();
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
126
148
|
if (annotation && annotation.includes(MSG_REPLACE)) {
|
|
127
149
|
trim = annotation.replace(MSG_REPLACE, trim);
|
|
128
150
|
} else if (annotation) {
|