1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-07 15:01:24 +01:00

Refactor device specs retrieval and enhance logging; improve model selection rendering

This commit is contained in:
Nayam Amarshe 2024-12-21 15:43:09 +05:30
parent e627bc4321
commit 514cc5e3c7
4 changed files with 18 additions and 7 deletions

View File

@ -52,7 +52,7 @@ export const getDeviceSpecs = async () => {
gpuInfo = null;
}
return {
const deviceSpecs = {
platform: getPlatform(),
release: os.release(),
arch: getArch(),
@ -60,4 +60,6 @@ export const getDeviceSpecs = async () => {
cpuCount: os.cpus().length,
...(gpuInfo && { gpu: gpuInfo.gpuDevice[0] }),
};
return deviceSpecs;
};

View File

@ -6,9 +6,9 @@ const logit = (...args: any) => {
const mainWindow = getMainWindow();
if (!mainWindow) return;
log.log(...args);
if (process.env.NODE_ENV === "development") {
return;
}
// if (process.env.NODE_ENV === "development") {
// return;
// }
mainWindow.webContents.send(ELECTRON_COMMANDS.LOG, args.join(" "));
};

View File

@ -48,9 +48,11 @@ const SelectModelDialog = () => {
<DialogTrigger asChild>
<button className="btn btn-primary justify-start border-border">
<SwatchBookIcon className="mr-2 h-5 w-5" />
{t(
`APP.MODEL_SELECTION.MODELS.${MODELS[selectedModelId].id || selectedModelId}.NAME` as any,
) || selectedModelId}
{selectedModelId in MODELS
? t(
`APP.MODEL_SELECTION.MODELS.${MODELS[selectedModelId]?.id}.NAME` as any,
)
: selectedModelId}
</button>
</DialogTrigger>
<DialogContent className="z-50 sm:max-w-lg">

View File

@ -22,11 +22,13 @@ import { FEATURE_FLAGS } from "@common/feature-flags";
import { ImageFormat, VALID_IMAGE_FORMATS } from "@/lib/valid-formats";
import { initCustomModels } from "@/components/hooks/use-custom-models";
import { OnboardingDialog } from "@/components/main-content/onboarding-dialog";
import useSystemInfo from "@/components/hooks/use-system-info";
const Home = () => {
const t = useAtomValue(translationAtom);
const logit = useLogger();
const { toast } = useToast();
const { systemInfo } = useSystemInfo();
initCustomModels();
@ -290,6 +292,11 @@ const Home = () => {
setIsLoading(false);
}, []);
// SYSTEM INFO
useEffect(() => {
if (systemInfo) logit("💻 System Info:", JSON.stringify(systemInfo));
}, [systemInfo]);
// HANDLERS
const resetImagePaths = () => {
logit("🔄 Resetting image paths");