This commit is contained in:
@@ -47,6 +47,10 @@ export class InMemoryMemoryStore implements BoxBrainMemoryStore {
|
||||
return stored;
|
||||
}
|
||||
|
||||
async listFacts(spaceId: string): Promise<StoredFact[]> {
|
||||
return [...(this.facts.get(spaceId) ?? [])].sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
||||
}
|
||||
|
||||
async findFacts(spaceId: string, topics: string[]): Promise<StoredFact[]> {
|
||||
const facts = this.facts.get(spaceId) ?? [];
|
||||
if (topics.length === 0) return [...facts];
|
||||
@@ -120,6 +124,17 @@ export class IdentityDbMemoryStore implements BoxBrainMemoryStore {
|
||||
return this.fromIdentityFact(stored);
|
||||
}
|
||||
|
||||
async listFacts(spaceId: string): Promise<StoredFact[]> {
|
||||
const topics = await this.options.db.listTopics({ spaceName: spaceId, includeFacts: true });
|
||||
const collected = new Map<string, StoredFact>();
|
||||
for (const topic of topics) {
|
||||
for (const fact of topic.facts) {
|
||||
collected.set(fact.id, this.fromIdentityFact(fact));
|
||||
}
|
||||
}
|
||||
return [...collected.values()].sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
||||
}
|
||||
|
||||
async findFacts(spaceId: string, topics: string[]): Promise<StoredFact[]> {
|
||||
const uniqueTopics = normalizeTopics(topics);
|
||||
const collected = new Map<string, StoredFact>();
|
||||
|
||||
Reference in New Issue
Block a user