cleanup, add handleStringifiedFile and addFile
This commit is contained in:
+14
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user