mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
refactor: use mem0 as long-memory maneger
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { pgTable, timestamp, uuid, jsonb, text } from 'drizzle-orm/pg-core'
|
||||
|
||||
export const history = pgTable(
|
||||
'history',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
messages: jsonb('messages').notNull(),
|
||||
timestamp: timestamp('timestamp').notNull(),
|
||||
user: text('user').notNull(),
|
||||
}
|
||||
)
|
||||
+12
-15
@@ -1,16 +1,13 @@
|
||||
import { pgTable, timestamp, uuid, jsonb, text, vector, index } from 'drizzle-orm/pg-core'
|
||||
import { pgTable, text, timestamp, integer } from 'drizzle-orm/pg-core'
|
||||
import { sql } from 'drizzle-orm'
|
||||
|
||||
export const memory = pgTable(
|
||||
'memory',
|
||||
{
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
messages: jsonb('messages').notNull(),
|
||||
timestamp: timestamp('timestamp').notNull(),
|
||||
user: text('user').notNull(),
|
||||
rawContent: text('raw_content').notNull(),
|
||||
embedding: vector('embedding', { dimensions: 1536 }).notNull(),
|
||||
},
|
||||
(table) => [
|
||||
index('embedding_index').using('hnsw', table.embedding.op('vector_cosine_ops')),
|
||||
]
|
||||
)
|
||||
export const memory = pgTable('memory', {
|
||||
id: text('id').primaryKey(),
|
||||
memoryId: text('memory_id').notNull(),
|
||||
previousValue: text('previous_value'),
|
||||
newValue: text('new_value'),
|
||||
action: text('action').notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).default(sql`timezone('utc', now())`),
|
||||
updatedAt: timestamp('updated_at', { withTimezone: true }),
|
||||
isDeleted: integer('is_deleted').default(0),
|
||||
})
|
||||
@@ -1 +1,2 @@
|
||||
export * from './history'
|
||||
export * from './memory'
|
||||
Reference in New Issue
Block a user