@lobehub/lobehub 2.0.0-next.334 → 2.0.0-next.335
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/CHANGELOG.md +25 -0
- package/changelog/v1.json +5 -0
- package/docs/development/database-schema.dbml +34 -0
- package/package.json +1 -1
- package/packages/database/migrations/0070_add_user_memory_activities.sql +35 -0
- package/packages/database/migrations/meta/0070_snapshot.json +10656 -0
- package/packages/database/migrations/meta/_journal.json +8 -1
- package/packages/database/src/schemas/userMemories/index.ts +71 -0
|
@@ -490,7 +490,14 @@
|
|
|
490
490
|
"when": 1768303764632,
|
|
491
491
|
"tag": "0069_add_topic_shares_table",
|
|
492
492
|
"breakpoints": true
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
"idx": 70,
|
|
496
|
+
"version": "7",
|
|
497
|
+
"when": 1768999498635,
|
|
498
|
+
"tag": "0070_add_user_memory_activities",
|
|
499
|
+
"breakpoints": true
|
|
493
500
|
}
|
|
494
501
|
],
|
|
495
502
|
"version": "6"
|
|
496
|
-
}
|
|
503
|
+
}
|
|
@@ -124,6 +124,70 @@ export const userMemoriesPreferences = pgTable(
|
|
|
124
124
|
],
|
|
125
125
|
);
|
|
126
126
|
|
|
127
|
+
export const userMemoriesActivities = pgTable(
|
|
128
|
+
'user_memories_activities',
|
|
129
|
+
{
|
|
130
|
+
id: varchar255('id')
|
|
131
|
+
.$defaultFn(() => idGenerator('memory'))
|
|
132
|
+
.primaryKey(),
|
|
133
|
+
|
|
134
|
+
userId: text('user_id').references(() => users.id, { onDelete: 'cascade' }),
|
|
135
|
+
userMemoryId: varchar255('user_memory_id').references(() => userMemories.id, {
|
|
136
|
+
onDelete: 'cascade',
|
|
137
|
+
}),
|
|
138
|
+
|
|
139
|
+
metadata: jsonb('metadata').$type<Record<string, unknown>>(),
|
|
140
|
+
tags: text('tags').array(),
|
|
141
|
+
|
|
142
|
+
type: varchar255('type').notNull(),
|
|
143
|
+
status: varchar255('status').notNull().default('pending'),
|
|
144
|
+
timezone: varchar255('timezone'),
|
|
145
|
+
startsAt: timestamptz('starts_at'),
|
|
146
|
+
endsAt: timestamptz('ends_at'),
|
|
147
|
+
|
|
148
|
+
associatedObjects: jsonb('associated_objects').$type<{
|
|
149
|
+
extra?: Record<string, unknown>,
|
|
150
|
+
name?: string,
|
|
151
|
+
type?: string
|
|
152
|
+
}[]>(),
|
|
153
|
+
associatedSubjects: jsonb('associated_subjects').$type<{
|
|
154
|
+
extra?: Record<string, unknown>,
|
|
155
|
+
name?: string,
|
|
156
|
+
type?: string
|
|
157
|
+
}[]>(),
|
|
158
|
+
associatedLocations: jsonb('associated_locations').$type<{
|
|
159
|
+
address?: string;
|
|
160
|
+
name?: string;
|
|
161
|
+
tags?: string[];
|
|
162
|
+
type?: string;
|
|
163
|
+
}[]>(),
|
|
164
|
+
|
|
165
|
+
notes: text('notes'),
|
|
166
|
+
narrative: text('narrative'),
|
|
167
|
+
narrativeVector: vector('narrative_vector', { dimensions: 1024 }),
|
|
168
|
+
feedback: text('feedback'),
|
|
169
|
+
feedbackVector: vector('feedback_vector', { dimensions: 1024 }),
|
|
170
|
+
|
|
171
|
+
capturedAt: timestamptz('captured_at').notNull().defaultNow(),
|
|
172
|
+
|
|
173
|
+
...timestamps,
|
|
174
|
+
},
|
|
175
|
+
(table) => [
|
|
176
|
+
index('user_memories_activities_narrative_vector_index').using(
|
|
177
|
+
'hnsw',
|
|
178
|
+
table.narrativeVector.op('vector_cosine_ops'),
|
|
179
|
+
),
|
|
180
|
+
index('user_memories_activities_feedback_vector_index').using(
|
|
181
|
+
'hnsw',
|
|
182
|
+
table.feedbackVector.op('vector_cosine_ops'),
|
|
183
|
+
),
|
|
184
|
+
index('user_memories_activities_type_index').on(table.type),
|
|
185
|
+
index('user_memories_activities_user_id_index').on(table.userId),
|
|
186
|
+
index('user_memories_activities_user_memory_id_index').on(table.userMemoryId),
|
|
187
|
+
index('user_memories_activities_status_index').on(table.status),
|
|
188
|
+
],
|
|
189
|
+
);
|
|
190
|
+
|
|
127
191
|
export const userMemoriesIdentities = pgTable(
|
|
128
192
|
'user_memories_identities',
|
|
129
193
|
{
|
|
@@ -242,3 +306,10 @@ export type UserMemoryExperiencesWithoutVectors = Omit<
|
|
|
242
306
|
'situationVector' | 'actionVector' | 'keyLearningVector'
|
|
243
307
|
>;
|
|
244
308
|
export type NewUserMemoryExperience = typeof userMemoriesExperiences.$inferInsert;
|
|
309
|
+
|
|
310
|
+
export type UserMemoryActivity = typeof userMemoriesActivities.$inferSelect;
|
|
311
|
+
export type UserMemoryActivitiesWithoutVectors = Omit<
|
|
312
|
+
UserMemoryActivity,
|
|
313
|
+
'narrativeVector' | 'feedbackVector'
|
|
314
|
+
>;
|
|
315
|
+
export type NewUserMemoryActivity = typeof userMemoriesActivities.$inferInsert;
|