mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-20 16:58:30 +00:00
feat(app): add file uploads
This commit is contained in:
@ -13,6 +13,7 @@ import db from '../db';
|
||||
import { chats, messages as messagesSchema } from '../db/schema';
|
||||
import { eq, asc, gt } from 'drizzle-orm';
|
||||
import crypto from 'crypto';
|
||||
import { getFileDetails } from '../utils/files';
|
||||
|
||||
type Message = {
|
||||
messageId: string;
|
||||
@ -26,6 +27,7 @@ type WSMessage = {
|
||||
type: string;
|
||||
focusMode: string;
|
||||
history: Array<[string, string]>;
|
||||
files: Array<string>;
|
||||
};
|
||||
|
||||
export const searchHandlers = {
|
||||
@ -141,6 +143,7 @@ export const handleMessage = async (
|
||||
llm,
|
||||
embeddings,
|
||||
parsedWSMessage.optimizationMode,
|
||||
parsedWSMessage.files,
|
||||
);
|
||||
|
||||
handleEmitterEvents(emitter, ws, aiMessageId, parsedMessage.chatId);
|
||||
@ -157,6 +160,7 @@ export const handleMessage = async (
|
||||
title: parsedMessage.content,
|
||||
createdAt: new Date().toString(),
|
||||
focusMode: parsedWSMessage.focusMode,
|
||||
files: parsedWSMessage.files.map(getFileDetails),
|
||||
})
|
||||
.execute();
|
||||
}
|
||||
|
Reference in New Issue
Block a user