@astermind/cybernetic-chatbot-client 2.2.21 → 2.2.30

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.
@@ -643,6 +643,10 @@
643
643
  // Tokenize and build document frequency
644
644
  const docFreq = new Map();
645
645
  for (const doc of documents) {
646
+ // Skip documents without content
647
+ if (!doc.content) {
648
+ continue;
649
+ }
646
650
  const tokens = this.tokenize(doc.content);
647
651
  const uniqueTokens = new Set(tokens);
648
652
  // Count document frequency
@@ -793,6 +797,9 @@
793
797
  * Tokenize text into words
794
798
  */
795
799
  tokenize(text) {
800
+ if (!text || typeof text !== 'string') {
801
+ return [];
802
+ }
796
803
  return text
797
804
  .toLowerCase()
798
805
  .replace(/[^\w\s]/g, ' ')