1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-12-15 00:51:16 +01:00
upscayl/electron/commands/get-models-list.ts

25 lines
678 B
TypeScript
Raw Normal View History

2023-09-10 11:14:04 +02:00
import COMMAND from "../constants/commands";
2023-09-10 19:42:18 +02:00
import { getMainWindow } from "../main-window";
2023-09-10 11:14:04 +02:00
import {
2023-09-10 19:42:18 +02:00
customModelsFolderPath,
2023-09-10 11:14:04 +02:00
setCustomModelsFolderPath,
} from "../utils/config-variables";
import getModels from "../utils/get-models";
import logit from "../utils/logit";
const getModelsList = async (event, payload) => {
2023-09-10 19:54:08 +02:00
const mainWindow = getMainWindow();
2023-09-10 11:14:04 +02:00
if (!mainWindow) return;
if (payload) {
setCustomModelsFolderPath(payload);
2023-09-10 19:42:18 +02:00
logit("📁 Custom Models Folder Path: ", customModelsFolderPath);
2023-11-10 12:41:35 +01:00
const models = await getModels(payload);
2023-09-10 11:14:04 +02:00
2023-11-10 12:41:35 +01:00
mainWindow.webContents.send(COMMAND.CUSTOM_MODEL_FILES_LIST, models);
2023-09-10 11:14:04 +02:00
}
};
export default getModelsList;