feat(frontend): optimizations for slow internet situations
This commit is contained in:
@@ -11,10 +11,6 @@ export const listByChat = query({
|
||||
chatId: v.id('chats'),
|
||||
role: v.union(v.literal('user'), v.literal('assistant')),
|
||||
content: v.string(),
|
||||
imageBase64: v.optional(v.string()),
|
||||
imageMediaType: v.optional(v.string()),
|
||||
imagesBase64: v.optional(v.array(v.string())),
|
||||
imagesMediaTypes: v.optional(v.array(v.string())),
|
||||
followUpOptions: v.optional(v.array(v.string())),
|
||||
source: v.union(v.literal('telegram'), v.literal('web')),
|
||||
createdAt: v.number(),
|
||||
@@ -22,11 +18,23 @@ export const listByChat = query({
|
||||
})
|
||||
),
|
||||
handler: async (ctx, args) => {
|
||||
return await ctx.db
|
||||
const messages = await ctx.db
|
||||
.query('messages')
|
||||
.withIndex('by_chat_id_and_created_at', (q) => q.eq('chatId', args.chatId))
|
||||
.order('asc')
|
||||
.collect();
|
||||
|
||||
return messages.map((m) => ({
|
||||
_id: m._id,
|
||||
_creationTime: m._creationTime,
|
||||
chatId: m.chatId,
|
||||
role: m.role,
|
||||
content: m.content,
|
||||
followUpOptions: m.followUpOptions,
|
||||
source: m.source,
|
||||
createdAt: m.createdAt,
|
||||
isStreaming: m.isStreaming
|
||||
}));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user