xiaozuoassistant 0.2.36 → 0.2.38

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.
@@ -93,6 +93,23 @@ export class VectorMemory {
93
93
  }
94
94
  else {
95
95
  console.warn(`[VectorMemory] Validation search encountered a non-dimension error:`, err);
96
+ // 添加兜底重试:如果因为空表或者其他 LanceDB 的内部状态错误导致验证查询失败,
97
+ // 为了防止后续增删改查报错,我们直接抛弃这个坏掉的表,重新建!
98
+ try {
99
+ await this.db.dropTable('memories');
100
+ console.log(`[VectorMemory] Dropped potentially corrupted table due to unhandled error.`);
101
+ const dummyData = [{
102
+ id: 'init',
103
+ text: 'init',
104
+ vector: Array(testVector.length).fill(0),
105
+ metadata: { type: 'recent', timestamp: Date.now(), sessionId: 'init', tags: '' }
106
+ }];
107
+ this.table = await this.db.createTable('memories', dummyData);
108
+ console.log(`[VectorMemory] Recreated table successfully.`);
109
+ }
110
+ catch (dropErr) {
111
+ console.error(`[VectorMemory] Fallback recreation failed. Manual deletion required.`);
112
+ }
96
113
  }
97
114
  }
98
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xiaozuoassistant",
3
- "version": "0.2.36",
3
+ "version": "0.2.38",
4
4
  "description": "A local-first personal AI assistant with multi-channel support and enhanced memory.",
5
5
  "author": "mantle.lau",
6
6
  "license": "MIT",