@elizaos/plugin-bootstrap 1.4.2 → 1.4.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.js CHANGED
@@ -6942,15 +6942,30 @@ async function processAttachments(attachments, runtime) {
6942
6942
  });
6943
6943
  if (typeof response === "string") {
6944
6944
  const parsedXml = parseKeyValueXml9(response);
6945
- if (parsedXml?.description && parsedXml?.text) {
6946
- processedAttachment.description = parsedXml.description;
6945
+ if (parsedXml && (parsedXml.description || parsedXml.text)) {
6946
+ processedAttachment.description = parsedXml.description || "";
6947
6947
  processedAttachment.title = parsedXml.title || "Image";
6948
- processedAttachment.text = parsedXml.text;
6948
+ processedAttachment.text = parsedXml.text || parsedXml.description || "";
6949
6949
  runtime.logger.debug(
6950
6950
  `[Bootstrap] Generated description: ${processedAttachment.description?.substring(0, 100)}...`
6951
6951
  );
6952
6952
  } else {
6953
- runtime.logger.warn(`[Bootstrap] Failed to parse XML response for image description`);
6953
+ const responseStr = response;
6954
+ const titleMatch = responseStr.match(/<title>([^<]+)<\/title>/);
6955
+ const descMatch = responseStr.match(/<description>([^<]+)<\/description>/);
6956
+ const textMatch = responseStr.match(/<text>([^<]+)<\/text>/);
6957
+ if (titleMatch || descMatch || textMatch) {
6958
+ processedAttachment.title = titleMatch?.[1] || "Image";
6959
+ processedAttachment.description = descMatch?.[1] || "";
6960
+ processedAttachment.text = textMatch?.[1] || descMatch?.[1] || "";
6961
+ runtime.logger.debug(
6962
+ `[Bootstrap] Used fallback XML parsing - description: ${processedAttachment.description?.substring(0, 100)}...`
6963
+ );
6964
+ } else {
6965
+ runtime.logger.warn(
6966
+ `[Bootstrap] Failed to parse XML response for image description`
6967
+ );
6968
+ }
6954
6969
  }
6955
6970
  } else if (response && typeof response === "object" && "description" in response) {
6956
6971
  processedAttachment.description = response.description;