feat(*): first mvp
This commit is contained in:
42
frontend/src/lib/convex/schema.ts
Normal file
42
frontend/src/lib/convex/schema.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { defineSchema, defineTable } from 'convex/server';
|
||||
import { v } from 'convex/values';
|
||||
|
||||
export default defineSchema({
|
||||
users: defineTable({
|
||||
telegramId: v.int64(),
|
||||
telegramChatId: v.optional(v.int64()),
|
||||
geminiApiKey: v.optional(v.string()),
|
||||
systemPrompt: v.optional(v.string()),
|
||||
followUpPrompt: v.optional(v.string()),
|
||||
model: v.string(),
|
||||
followUpModel: v.optional(v.string()),
|
||||
activeChatId: v.optional(v.id('chats'))
|
||||
}).index('by_telegram_id', ['telegramId']),
|
||||
|
||||
chats: defineTable({
|
||||
userId: v.id('users'),
|
||||
mnemonic: v.string(),
|
||||
createdAt: v.number()
|
||||
}).index('by_mnemonic', ['mnemonic']),
|
||||
|
||||
messages: defineTable({
|
||||
chatId: v.id('chats'),
|
||||
role: v.union(v.literal('user'), v.literal('assistant')),
|
||||
content: v.string(),
|
||||
imageStorageId: v.optional(v.id('_storage')),
|
||||
imageMediaType: v.optional(v.string()),
|
||||
followUpOptions: v.optional(v.array(v.string())),
|
||||
source: v.union(v.literal('telegram'), v.literal('web')),
|
||||
createdAt: v.number(),
|
||||
isStreaming: v.optional(v.boolean())
|
||||
})
|
||||
.index('by_chat_id', ['chatId'])
|
||||
.index('by_chat_id_and_created_at', ['chatId', 'createdAt']),
|
||||
|
||||
pendingGenerations: defineTable({
|
||||
userId: v.id('users'),
|
||||
chatId: v.id('chats'),
|
||||
userMessage: v.string(),
|
||||
createdAt: v.number()
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user