chat-agent-toolkit 1.2.32 → 1.2.34
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/research-agent.cjs.js +1 -1
- package/dist/research-agent.cjs.js.map +1 -1
- package/dist/research-agent.es.js +1 -1
- package/dist/research-agent.es.js.map +1 -1
- package/package.json +1 -1
- package/src/config/config-manager.ts +295 -295
- package/src/config/config-types.ts +65 -65
- package/src/config/environment-variables.ts +16 -16
- package/src/config/index.ts +26 -26
- package/src/config/language-models-database.ts +1434 -1434
- package/src/config/mcp-server-registry.ts +24 -24
- package/src/config/model-registry.ts +271 -271
- package/src/config/model-tester.ts +211 -211
- package/src/config/model-utils.ts +193 -193
- package/src/config/provider-ui-config.ts +196 -196
- package/src/connectors/open-connector.json +130 -130
- package/src/index.ts +26 -26
- package/src/memory/ARCHITECTURE.md +302 -302
- package/src/memory/README.md +224 -224
- package/src/memory/agent-memory-manager.ts +416 -416
- package/src/memory/example.ts +343 -343
- package/src/memory/index.ts +47 -47
- package/src/memory/mastra-integration.ts +604 -604
- package/src/memory/storage/drizzle-storage.ts +236 -236
- package/src/memory/storage/in-memory-storage.ts +551 -551
- package/src/memory/storage/storage-interface.ts +68 -68
- package/src/memory/types.ts +125 -125
- package/src/models/types.ts +4 -4
- package/src/provider-logos/01-ai.png +0 -0
- package/src/provider-logos/anthropic.png +0 -0
- package/src/provider-logos/aws-bedrock.png +0 -0
- package/src/provider-logos/aws-sagemaker.png +0 -0
- package/src/provider-logos/azure-openai-service.png +0 -0
- package/src/provider-logos/chatglm.png +0 -0
- package/src/provider-logos/cohere.png +0 -0
- package/src/provider-logos/gemini.png +0 -0
- package/src/provider-logos/groqcloud.png +0 -0
- package/src/provider-logos/huggingface.png +0 -0
- package/src/provider-logos/jina.png +0 -0
- package/src/provider-logos/localai.png +0 -0
- package/src/provider-logos/mistral-ai.png +0 -0
- package/src/provider-logos/moonshot-ai.png +0 -0
- package/src/provider-logos/ollama.png +0 -0
- package/src/provider-logos/openai.png +0 -0
- package/src/provider-logos/openllm.png +0 -0
- package/src/provider-logos/openrouter.png +0 -0
- package/src/provider-logos/replicate.png +0 -0
- package/src/provider-logos/together-ai.png +0 -0
- package/src/provider-logos/tongyi.png +0 -0
- package/src/provider-logos/xorbits-inference.png +0 -0
- package/src/provider-logos/zhipu-ai.png +0 -0
- package/src/tools/index.ts +13 -13
- package/src/tools/open-connector-mastra.ts +270 -270
- package/src/tools/open-connector-mcp.ts +170 -170
- package/src/tools/qwksearch-api-tools.ts +326 -326
- package/src/tools/search/doc-utils.ts +139 -139
- package/src/tools/search/document.ts +47 -47
- package/src/tools/search/index.ts +14 -14
- package/src/tools/search/link-summarizer.ts +112 -112
- package/src/tools/search/meta-search-types.ts +62 -62
- package/src/tools/search/metaSearchAgent.ts +465 -465
- package/src/tools/search/search-handlers.ts +97 -97
- package/src/tools/search/suggestionGeneratorAgent.ts +56 -56
- package/src/types.d.ts +137 -137
- package/src/utils/index.ts +2 -2
- package/src/utils/markdown-to-html.ts +53 -53
- package/src/utils/outputParser.ts +73 -73
|
@@ -1,236 +1,236 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Drizzle Storage Adapter
|
|
3
|
-
*
|
|
4
|
-
* Implementation of IMemoryStorage using Drizzle ORM
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { sql, eq, and, desc, or, like } from "drizzle-orm";
|
|
8
|
-
import type { IMemoryStorage } from "./storage-interface";
|
|
9
|
-
import type {
|
|
10
|
-
MemoryRecord,
|
|
11
|
-
MemoryType,
|
|
12
|
-
MemorySearchOptions,
|
|
13
|
-
MemoryUpdate,
|
|
14
|
-
} from "../types";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* The Drizzle table passed to {@link DrizzleMemoryStorage} must expose these
|
|
18
|
-
* columns (see {@link createMemorySchema} for the expected shape).
|
|
19
|
-
*/
|
|
20
|
-
export interface MemoryTable {
|
|
21
|
-
id: any;
|
|
22
|
-
user_id: any;
|
|
23
|
-
memory_type: any;
|
|
24
|
-
content: any;
|
|
25
|
-
importance: any;
|
|
26
|
-
access_count: any;
|
|
27
|
-
metadata: any;
|
|
28
|
-
created_at: any;
|
|
29
|
-
updated_at: any;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Drizzle-based storage adapter.
|
|
34
|
-
*
|
|
35
|
-
* Pass the Drizzle database instance and the memory table object defined in
|
|
36
|
-
* your schema (not a table-name string) so queries reference real columns:
|
|
37
|
-
*
|
|
38
|
-
* ```ts
|
|
39
|
-
* import { sqliteTable, text, integer, real } from "drizzle-orm/sqlite-core";
|
|
40
|
-
* const userMemories = sqliteTable("user_memories", { ... });
|
|
41
|
-
* const storage = new DrizzleMemoryStorage(db, userMemories);
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export class DrizzleMemoryStorage implements IMemoryStorage {
|
|
45
|
-
private db: any;
|
|
46
|
-
private table: MemoryTable & Record<string, any>;
|
|
47
|
-
|
|
48
|
-
constructor(db: any, table: MemoryTable & Record<string, any>) {
|
|
49
|
-
this.db = db;
|
|
50
|
-
this.table = table;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Insert a new memory record
|
|
55
|
-
*/
|
|
56
|
-
async insertMemory(
|
|
57
|
-
userId: string,
|
|
58
|
-
memoryType: MemoryType,
|
|
59
|
-
content: string,
|
|
60
|
-
importance: number,
|
|
61
|
-
metadata?: Record<string, any>,
|
|
62
|
-
): Promise<string> {
|
|
63
|
-
const result = await this.db
|
|
64
|
-
.insert(this.table)
|
|
65
|
-
.values({
|
|
66
|
-
user_id: userId,
|
|
67
|
-
memory_type: memoryType,
|
|
68
|
-
content: content,
|
|
69
|
-
importance: importance,
|
|
70
|
-
access_count: 0,
|
|
71
|
-
metadata: metadata || {},
|
|
72
|
-
created_at: new Date(),
|
|
73
|
-
updated_at: new Date(),
|
|
74
|
-
})
|
|
75
|
-
.returning({ id: this.table.id });
|
|
76
|
-
|
|
77
|
-
return result[0]?.id;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Find memories by user ID and optional filters
|
|
82
|
-
*/
|
|
83
|
-
async findMemories(
|
|
84
|
-
userId: string,
|
|
85
|
-
query?: string,
|
|
86
|
-
limit: number = 10,
|
|
87
|
-
options: MemorySearchOptions = {},
|
|
88
|
-
): Promise<MemoryRecord[]> {
|
|
89
|
-
const conditions = [eq(this.table.user_id, userId)];
|
|
90
|
-
|
|
91
|
-
if (query && query.trim()) {
|
|
92
|
-
conditions.push(like(this.table.content, `%${query}%`));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (options.memoryType) {
|
|
96
|
-
conditions.push(eq(this.table.memory_type, options.memoryType));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const results = await this.db
|
|
100
|
-
.select({
|
|
101
|
-
id: this.table.id,
|
|
102
|
-
user_id: this.table.user_id,
|
|
103
|
-
memory_type: this.table.memory_type,
|
|
104
|
-
content: this.table.content,
|
|
105
|
-
importance: this.table.importance,
|
|
106
|
-
access_count: this.table.access_count,
|
|
107
|
-
metadata: this.table.metadata,
|
|
108
|
-
created_at: this.table.created_at,
|
|
109
|
-
updated_at: this.table.updated_at,
|
|
110
|
-
})
|
|
111
|
-
.from(this.table)
|
|
112
|
-
.where(and(...conditions))
|
|
113
|
-
.orderBy(
|
|
114
|
-
desc(this.table.importance),
|
|
115
|
-
desc(this.table.access_count),
|
|
116
|
-
desc(this.table.updated_at),
|
|
117
|
-
)
|
|
118
|
-
.limit(Math.min(limit, 50)); // Cap at 50 for performance
|
|
119
|
-
|
|
120
|
-
return results as MemoryRecord[];
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Find similar memories based on content
|
|
125
|
-
*/
|
|
126
|
-
async findSimilarMemories(
|
|
127
|
-
userId: string,
|
|
128
|
-
content: string,
|
|
129
|
-
limit: number = 5,
|
|
130
|
-
): Promise<MemoryRecord[]> {
|
|
131
|
-
// Simple similarity check using keywords
|
|
132
|
-
const words = content
|
|
133
|
-
.toLowerCase()
|
|
134
|
-
.split(/\s+/)
|
|
135
|
-
.filter((w) => w.length > 2);
|
|
136
|
-
const searchTerms = words.slice(0, 3); // Use first 3 words
|
|
137
|
-
|
|
138
|
-
if (searchTerms.length === 0) {
|
|
139
|
-
return [];
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const conditions = searchTerms.map((term) =>
|
|
143
|
-
like(this.table.content, `%${term}%`),
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const results = await this.db
|
|
147
|
-
.select()
|
|
148
|
-
.from(this.table)
|
|
149
|
-
.where(and(eq(this.table.user_id, userId), or(...conditions)))
|
|
150
|
-
.orderBy(desc(this.table.importance), desc(this.table.updated_at))
|
|
151
|
-
.limit(limit);
|
|
152
|
-
|
|
153
|
-
return results as MemoryRecord[];
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Update a memory record
|
|
158
|
-
*/
|
|
159
|
-
async updateMemory(id: string, updates: MemoryUpdate): Promise<void> {
|
|
160
|
-
const updateData: any = {};
|
|
161
|
-
|
|
162
|
-
if (updates.importance !== undefined) {
|
|
163
|
-
updateData.importance = updates.importance;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
if (updates.access_count !== undefined) {
|
|
167
|
-
if (typeof updates.access_count === "object" && updates.access_count.increment) {
|
|
168
|
-
updateData.access_count = sql`${this.table.access_count} + ${updates.access_count.increment}`;
|
|
169
|
-
} else {
|
|
170
|
-
updateData.access_count = updates.access_count;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (updates.updated_at !== undefined) {
|
|
175
|
-
updateData.updated_at = updates.updated_at;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
if (updates.metadata !== undefined) {
|
|
179
|
-
updateData.metadata = updates.metadata;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
await this.db.update(this.table).set(updateData).where(eq(this.table.id, id));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Delete a memory record
|
|
187
|
-
*/
|
|
188
|
-
async deleteMemory(id: string): Promise<void> {
|
|
189
|
-
await this.db.delete(this.table).where(eq(this.table.id, id));
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Get memory by ID
|
|
194
|
-
*/
|
|
195
|
-
async getMemoryById(id: string): Promise<MemoryRecord | null> {
|
|
196
|
-
const results = await this.db
|
|
197
|
-
.select()
|
|
198
|
-
.from(this.table)
|
|
199
|
-
.where(eq(this.table.id, id))
|
|
200
|
-
.limit(1);
|
|
201
|
-
|
|
202
|
-
return (results[0] as MemoryRecord) || null;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Batch update memories
|
|
207
|
-
*/
|
|
208
|
-
async batchUpdateMemories(
|
|
209
|
-
updates: Array<{ id: string; updates: MemoryUpdate }>,
|
|
210
|
-
): Promise<void> {
|
|
211
|
-
const promises = updates.map(({ id, updates: updateData }) =>
|
|
212
|
-
this.updateMemory(id, updateData),
|
|
213
|
-
);
|
|
214
|
-
await Promise.allSettled(promises);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Database schema for memory system
|
|
220
|
-
* This is kept here for reference but should be managed by your migration system
|
|
221
|
-
*/
|
|
222
|
-
export function createMemorySchema(db: any) {
|
|
223
|
-
return {
|
|
224
|
-
user_memories: {
|
|
225
|
-
id: "uuid",
|
|
226
|
-
user_id: "string",
|
|
227
|
-
memory_type: "string",
|
|
228
|
-
content: "text",
|
|
229
|
-
importance: "number",
|
|
230
|
-
access_count: "number",
|
|
231
|
-
metadata: "jsonb",
|
|
232
|
-
created_at: "timestamp",
|
|
233
|
-
updated_at: "timestamp",
|
|
234
|
-
},
|
|
235
|
-
};
|
|
236
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Drizzle Storage Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implementation of IMemoryStorage using Drizzle ORM
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { sql, eq, and, desc, or, like } from "drizzle-orm";
|
|
8
|
+
import type { IMemoryStorage } from "./storage-interface";
|
|
9
|
+
import type {
|
|
10
|
+
MemoryRecord,
|
|
11
|
+
MemoryType,
|
|
12
|
+
MemorySearchOptions,
|
|
13
|
+
MemoryUpdate,
|
|
14
|
+
} from "../types";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The Drizzle table passed to {@link DrizzleMemoryStorage} must expose these
|
|
18
|
+
* columns (see {@link createMemorySchema} for the expected shape).
|
|
19
|
+
*/
|
|
20
|
+
export interface MemoryTable {
|
|
21
|
+
id: any;
|
|
22
|
+
user_id: any;
|
|
23
|
+
memory_type: any;
|
|
24
|
+
content: any;
|
|
25
|
+
importance: any;
|
|
26
|
+
access_count: any;
|
|
27
|
+
metadata: any;
|
|
28
|
+
created_at: any;
|
|
29
|
+
updated_at: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Drizzle-based storage adapter.
|
|
34
|
+
*
|
|
35
|
+
* Pass the Drizzle database instance and the memory table object defined in
|
|
36
|
+
* your schema (not a table-name string) so queries reference real columns:
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { sqliteTable, text, integer, real } from "drizzle-orm/sqlite-core";
|
|
40
|
+
* const userMemories = sqliteTable("user_memories", { ... });
|
|
41
|
+
* const storage = new DrizzleMemoryStorage(db, userMemories);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export class DrizzleMemoryStorage implements IMemoryStorage {
|
|
45
|
+
private db: any;
|
|
46
|
+
private table: MemoryTable & Record<string, any>;
|
|
47
|
+
|
|
48
|
+
constructor(db: any, table: MemoryTable & Record<string, any>) {
|
|
49
|
+
this.db = db;
|
|
50
|
+
this.table = table;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Insert a new memory record
|
|
55
|
+
*/
|
|
56
|
+
async insertMemory(
|
|
57
|
+
userId: string,
|
|
58
|
+
memoryType: MemoryType,
|
|
59
|
+
content: string,
|
|
60
|
+
importance: number,
|
|
61
|
+
metadata?: Record<string, any>,
|
|
62
|
+
): Promise<string> {
|
|
63
|
+
const result = await this.db
|
|
64
|
+
.insert(this.table)
|
|
65
|
+
.values({
|
|
66
|
+
user_id: userId,
|
|
67
|
+
memory_type: memoryType,
|
|
68
|
+
content: content,
|
|
69
|
+
importance: importance,
|
|
70
|
+
access_count: 0,
|
|
71
|
+
metadata: metadata || {},
|
|
72
|
+
created_at: new Date(),
|
|
73
|
+
updated_at: new Date(),
|
|
74
|
+
})
|
|
75
|
+
.returning({ id: this.table.id });
|
|
76
|
+
|
|
77
|
+
return result[0]?.id;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Find memories by user ID and optional filters
|
|
82
|
+
*/
|
|
83
|
+
async findMemories(
|
|
84
|
+
userId: string,
|
|
85
|
+
query?: string,
|
|
86
|
+
limit: number = 10,
|
|
87
|
+
options: MemorySearchOptions = {},
|
|
88
|
+
): Promise<MemoryRecord[]> {
|
|
89
|
+
const conditions = [eq(this.table.user_id, userId)];
|
|
90
|
+
|
|
91
|
+
if (query && query.trim()) {
|
|
92
|
+
conditions.push(like(this.table.content, `%${query}%`));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (options.memoryType) {
|
|
96
|
+
conditions.push(eq(this.table.memory_type, options.memoryType));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const results = await this.db
|
|
100
|
+
.select({
|
|
101
|
+
id: this.table.id,
|
|
102
|
+
user_id: this.table.user_id,
|
|
103
|
+
memory_type: this.table.memory_type,
|
|
104
|
+
content: this.table.content,
|
|
105
|
+
importance: this.table.importance,
|
|
106
|
+
access_count: this.table.access_count,
|
|
107
|
+
metadata: this.table.metadata,
|
|
108
|
+
created_at: this.table.created_at,
|
|
109
|
+
updated_at: this.table.updated_at,
|
|
110
|
+
})
|
|
111
|
+
.from(this.table)
|
|
112
|
+
.where(and(...conditions))
|
|
113
|
+
.orderBy(
|
|
114
|
+
desc(this.table.importance),
|
|
115
|
+
desc(this.table.access_count),
|
|
116
|
+
desc(this.table.updated_at),
|
|
117
|
+
)
|
|
118
|
+
.limit(Math.min(limit, 50)); // Cap at 50 for performance
|
|
119
|
+
|
|
120
|
+
return results as MemoryRecord[];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Find similar memories based on content
|
|
125
|
+
*/
|
|
126
|
+
async findSimilarMemories(
|
|
127
|
+
userId: string,
|
|
128
|
+
content: string,
|
|
129
|
+
limit: number = 5,
|
|
130
|
+
): Promise<MemoryRecord[]> {
|
|
131
|
+
// Simple similarity check using keywords
|
|
132
|
+
const words = content
|
|
133
|
+
.toLowerCase()
|
|
134
|
+
.split(/\s+/)
|
|
135
|
+
.filter((w) => w.length > 2);
|
|
136
|
+
const searchTerms = words.slice(0, 3); // Use first 3 words
|
|
137
|
+
|
|
138
|
+
if (searchTerms.length === 0) {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const conditions = searchTerms.map((term) =>
|
|
143
|
+
like(this.table.content, `%${term}%`),
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
const results = await this.db
|
|
147
|
+
.select()
|
|
148
|
+
.from(this.table)
|
|
149
|
+
.where(and(eq(this.table.user_id, userId), or(...conditions)))
|
|
150
|
+
.orderBy(desc(this.table.importance), desc(this.table.updated_at))
|
|
151
|
+
.limit(limit);
|
|
152
|
+
|
|
153
|
+
return results as MemoryRecord[];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Update a memory record
|
|
158
|
+
*/
|
|
159
|
+
async updateMemory(id: string, updates: MemoryUpdate): Promise<void> {
|
|
160
|
+
const updateData: any = {};
|
|
161
|
+
|
|
162
|
+
if (updates.importance !== undefined) {
|
|
163
|
+
updateData.importance = updates.importance;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (updates.access_count !== undefined) {
|
|
167
|
+
if (typeof updates.access_count === "object" && updates.access_count.increment) {
|
|
168
|
+
updateData.access_count = sql`${this.table.access_count} + ${updates.access_count.increment}`;
|
|
169
|
+
} else {
|
|
170
|
+
updateData.access_count = updates.access_count;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (updates.updated_at !== undefined) {
|
|
175
|
+
updateData.updated_at = updates.updated_at;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (updates.metadata !== undefined) {
|
|
179
|
+
updateData.metadata = updates.metadata;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
await this.db.update(this.table).set(updateData).where(eq(this.table.id, id));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Delete a memory record
|
|
187
|
+
*/
|
|
188
|
+
async deleteMemory(id: string): Promise<void> {
|
|
189
|
+
await this.db.delete(this.table).where(eq(this.table.id, id));
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get memory by ID
|
|
194
|
+
*/
|
|
195
|
+
async getMemoryById(id: string): Promise<MemoryRecord | null> {
|
|
196
|
+
const results = await this.db
|
|
197
|
+
.select()
|
|
198
|
+
.from(this.table)
|
|
199
|
+
.where(eq(this.table.id, id))
|
|
200
|
+
.limit(1);
|
|
201
|
+
|
|
202
|
+
return (results[0] as MemoryRecord) || null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Batch update memories
|
|
207
|
+
*/
|
|
208
|
+
async batchUpdateMemories(
|
|
209
|
+
updates: Array<{ id: string; updates: MemoryUpdate }>,
|
|
210
|
+
): Promise<void> {
|
|
211
|
+
const promises = updates.map(({ id, updates: updateData }) =>
|
|
212
|
+
this.updateMemory(id, updateData),
|
|
213
|
+
);
|
|
214
|
+
await Promise.allSettled(promises);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Database schema for memory system
|
|
220
|
+
* This is kept here for reference but should be managed by your migration system
|
|
221
|
+
*/
|
|
222
|
+
export function createMemorySchema(db: any) {
|
|
223
|
+
return {
|
|
224
|
+
user_memories: {
|
|
225
|
+
id: "uuid",
|
|
226
|
+
user_id: "string",
|
|
227
|
+
memory_type: "string",
|
|
228
|
+
content: "text",
|
|
229
|
+
importance: "number",
|
|
230
|
+
access_count: "number",
|
|
231
|
+
metadata: "jsonb",
|
|
232
|
+
created_at: "timestamp",
|
|
233
|
+
updated_at: "timestamp",
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
}
|