implement model methods for backup

This commit is contained in:
marlon-erler
2026-08-29 02:10:26 +02:00
parent 2c8b078b80
commit 2245fb5885
20 changed files with 11999 additions and 8945 deletions
+14 -5
View File
@@ -29,13 +29,15 @@ export default class FileModel {
StorageModelSubPaths.Chat,
filePaths.chat.files(this.chatModel.id),
);
};
}
readonly getFileContainerPath = (): string[] => {
return [...this.basePath, FileModelSubPath.Data];
};
readonly getModelContainerPath = (modelName: FileModelSubPath): string[] => {
readonly getModelContainerPath = (
modelName: FileModelSubPath,
): string[] => {
return [...this.basePath, FileModelSubPath.Model, modelName];
};
@@ -43,13 +45,18 @@ export default class FileModel {
return [...this.getFileContainerPath(), fileId];
};
readonly getFileContentPath = (fileId: string, fileContentId: string): string[] => {
readonly getFileContentPath = (
fileId: string,
fileContentId: string,
): string[] => {
const filePath: string[] = this.getFilePath(fileId);
return [...filePath, fileContentId];
};
// handlers
readonly handleStringifiedFileContent = (stringifiedFileContent: string): void => {
readonly handleStringifiedFileContent = (
stringifiedFileContent: string,
): void => {
const fileContent: FileContent<string> | null = parseValidObject(
stringifiedFileContent,
FileContentReference,
@@ -68,7 +75,9 @@ export default class FileModel {
};
// methods
readonly addFileContentAndSend = (fileContent: FileContent<string>): void => {
readonly addFileContentAndSend = (
fileContent: FileContent<string>,
): void => {
this.handleFileContent(fileContent);
this.chatModel.sendMessage("", undefined, fileContent);
};