2024-10-06 09:15:44 +02:00
|
|
|
import { ELECTRON_COMMANDS } from "../../common/electron-commands";
|
2023-09-10 19:42:18 +02:00
|
|
|
import { getMainWindow } from "../main-window";
|
2023-09-10 11:14:04 +02:00
|
|
|
import {
|
2024-04-09 20:11:24 +02:00
|
|
|
savedCustomModelsPath,
|
|
|
|
setSavedCustomModelsPath,
|
2023-09-10 11:14:04 +02:00
|
|
|
} 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) {
|
2024-04-09 20:11:24 +02:00
|
|
|
setSavedCustomModelsPath(payload);
|
2023-09-10 11:14:04 +02:00
|
|
|
|
2024-04-09 20:11:24 +02:00
|
|
|
logit("📁 Custom Models Folder Path: ", savedCustomModelsPath);
|
2023-11-10 12:41:35 +01:00
|
|
|
const models = await getModels(payload);
|
2023-09-10 11:14:04 +02:00
|
|
|
|
2024-10-04 11:15:54 +02:00
|
|
|
mainWindow.webContents.send(
|
|
|
|
ELECTRON_COMMANDS.CUSTOM_MODEL_FILES_LIST,
|
|
|
|
models,
|
|
|
|
);
|
2023-09-10 11:14:04 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default getModelsList;
|