1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-24 07:30:19 +01:00
upscayl/electron/commands/get-models-list.ts
2024-10-06 12:45:44 +05:30

28 lines
726 B
TypeScript

import { ELECTRON_COMMANDS } from "../../common/electron-commands";
import { getMainWindow } from "../main-window";
import {
savedCustomModelsPath,
setSavedCustomModelsPath,
} from "../utils/config-variables";
import getModels from "../utils/get-models";
import logit from "../utils/logit";
const getModelsList = async (event, payload) => {
const mainWindow = getMainWindow();
if (!mainWindow) return;
if (payload) {
setSavedCustomModelsPath(payload);
logit("📁 Custom Models Folder Path: ", savedCustomModelsPath);
const models = await getModels(payload);
mainWindow.webContents.send(
ELECTRON_COMMANDS.CUSTOM_MODEL_FILES_LIST,
models,
);
}
};
export default getModelsList;