feat(*): add RAG support

This commit is contained in:
h
2026-01-25 16:44:59 +01:00
parent 5b1f50a6f6
commit a992e3f0c2
20 changed files with 1412 additions and 17 deletions

View File

@@ -10,7 +10,13 @@ export default defineSchema({
followUpPrompt: v.optional(v.string()),
model: v.string(),
followUpModel: v.optional(v.string()),
activeChatId: v.optional(v.id('chats'))
activeChatId: v.optional(v.id('chats')),
ragCollectionMode: v.optional(
v.object({
ragDatabaseId: v.id('ragDatabases'),
activeSince: v.number()
})
)
}).index('by_telegram_id', ['telegramId']),
chats: defineTable({
@@ -98,5 +104,23 @@ export default defineSchema({
base64: v.string(),
mediaType: v.string(),
createdAt: v.number()
}).index('by_chat_id_and_device_id', ['chatId', 'deviceId'])
}).index('by_chat_id_and_device_id', ['chatId', 'deviceId']),
ragDatabases: defineTable({
userId: v.id('users'),
name: v.string(),
createdAt: v.number()
})
.index('by_user_id', ['userId'])
.index('by_user_id_and_name', ['userId', 'name']),
ragConnections: defineTable({
userId: v.id('users'),
ragDatabaseId: v.id('ragDatabases'),
isGlobal: v.boolean(),
createdAt: v.number()
})
.index('by_user_id', ['userId'])
.index('by_user_id_and_rag_database_id', ['userId', 'ragDatabaseId'])
.index('by_rag_database_id', ['ragDatabaseId'])
});