1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-24 23:13:45 +01:00
upscayl/electron/commands/get-models-list.ts

25 lines
674 B
TypeScript
Raw Normal View History

import COMMAND from "../../common/commands";
2023-09-10 23:12:18 +05:30
import { getMainWindow } from "../main-window";
2023-09-10 14:44:04 +05:30
import {
2024-04-09 23:41:24 +05:30
savedCustomModelsPath,
setSavedCustomModelsPath,
2023-09-10 14:44:04 +05:30
} from "../utils/config-variables";
import getModels from "../utils/get-models";
import logit from "../utils/logit";
const getModelsList = async (event, payload) => {
2023-09-10 23:24:08 +05:30
const mainWindow = getMainWindow();
2023-09-10 14:44:04 +05:30
if (!mainWindow) return;
if (payload) {
2024-04-09 23:41:24 +05:30
setSavedCustomModelsPath(payload);
2023-09-10 14:44:04 +05:30
2024-04-09 23:41:24 +05:30
logit("📁 Custom Models Folder Path: ", savedCustomModelsPath);
2023-11-10 17:11:35 +05:30
const models = await getModels(payload);
2023-09-10 14:44:04 +05:30
2023-11-10 17:11:35 +05:30
mainWindow.webContents.send(COMMAND.CUSTOM_MODEL_FILES_LIST, models);
2023-09-10 14:44:04 +05:30
}
};
export default getModelsList;