cleanup, add handleStringifiedFile and addFile

This commit is contained in:
marlon-erler
2024-07-21 22:42:32 +02:00
parent da757d10d1
commit 5443d045db
4 changed files with 145 additions and 57 deletions
+14 -1
View File
@@ -1,10 +1,23 @@
// this file is responsible for managing files within chats.
import ChatModel from "./chatModel";
import ChatModel, { ChatMessage } from "./chatModel";
import { parseValidObject } from "./Utility/utility";
export default class FileModel {
chatModel: ChatModel;
// handler
handleStringifiedFile = (stringifiedFile: string): void => {
const file: File | null = parseValidObject<File>(stringifiedFile);
if (file == null) return;
};
// methods
addFile = (file: File): void => {
this.chatModel.sendMessage("", file);
};
// init
constructor(chatModel: ChatModel) {
this.chatModel = chatModel;