soulbridge 0.0.9 → 0.0.10
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.
|
@@ -83,7 +83,12 @@ export class Soul {
|
|
|
83
83
|
const now = turn.at ?? Date.now();
|
|
84
84
|
const affect = turn.role === 'user' ? await this.analyzeTurn(turn.content) : emptyAffect();
|
|
85
85
|
const drafts = ruleExtract([turn]);
|
|
86
|
+
// observe runs every turn; repeating a sentence must not create a second row.
|
|
87
|
+
const seen = new Set(this.store.query({ soulId: this.soulId, userId: this.userId, limit: 10_000 }).map((m) => m.content.trim()));
|
|
86
88
|
for (const draft of drafts) {
|
|
89
|
+
if (seen.has(draft.content.trim()))
|
|
90
|
+
continue;
|
|
91
|
+
seen.add(draft.content.trim());
|
|
87
92
|
this.store.put({
|
|
88
93
|
id: `mem_${now.toString(36)}_${Math.random().toString(36).slice(2, 6)}`,
|
|
89
94
|
soulId: this.soulId,
|