@enegelai/bot-widget 1.7.2 → 1.7.3

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.es.js CHANGED
@@ -1009,13 +1009,14 @@ class W extends Ke {
1009
1009
  this.streamingResponseBuffer = null, this.streamingResponseTagStartPos = 0, this.streamingResponseCurrentTag = null;
1010
1010
  }
1011
1011
  processStreamingResponseTagImg() {
1012
- if (!(!this.streamingResponseBuffer || !this.replyMessage)) {
1013
- if (this.streamingResponseBuffer.indexOf("![") === -1) {
1014
- j.info(`NOT IMG TAG: ${this.streamingResponseBuffer}`), this.replyMessage = this.updateMessage(this.replyMessage, this.streamingResponseBuffer), this.streamingResponseBuffer = null, this.streamingResponseCurrentTag = null;
1015
- return;
1016
- }
1017
- this.streamingResponseBuffer.indexOf(")") !== -1 && (j.info(`IMG TAG END: ${this.streamingResponseBuffer}`), this.isValidImageLink(this.streamingResponseBuffer) && (this.replyMessage = this.updateMessage(this.replyMessage, this.streamingResponseBuffer)), this.streamingResponseBuffer = null, this.streamingResponseCurrentTag = null);
1012
+ if (!this.streamingResponseBuffer || !this.replyMessage)
1013
+ return;
1014
+ if (this.streamingResponseBuffer.indexOf("![") === -1) {
1015
+ j.info(`NOT IMG TAG: ${this.streamingResponseBuffer}`), this.replyMessage = this.updateMessage(this.replyMessage, this.streamingResponseBuffer), this.streamingResponseBuffer = null, this.streamingResponseCurrentTag = null;
1016
+ return;
1018
1017
  }
1018
+ const e = this.streamingResponseBuffer.lastIndexOf("]"), c = this.streamingResponseBuffer.lastIndexOf(")");
1019
+ e === -1 || c === -1 || e > c || (j.info(`IMG TAG END: ${this.streamingResponseBuffer}`), this.isValidImageLink(this.streamingResponseBuffer) && (this.replyMessage = this.updateMessage(this.replyMessage, this.streamingResponseBuffer)), this.streamingResponseBuffer = null, this.streamingResponseCurrentTag = null);
1019
1020
  }
1020
1021
  isValidImageLink(e = "") {
1021
1022
  return !(e.indexOf("example.com") !== -1 || e.indexOf("imgur.com") !== -1 || e.indexOf("attachment:") !== -1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enegelai/bot-widget",
3
- "version": "1.7.2",
3
+ "version": "1.7.3",
4
4
  "description": "Enegel.ai Bot Widget",
5
5
  "scripts": {
6
6
  "dev": "vite",