1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-02-14 18:02:38 +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; gpuInfo = null;
} }
return { const deviceSpecs = {
platform: getPlatform(), platform: getPlatform(),
release: os.release(), release: os.release(),
arch: getArch(), arch: getArch(),
@ -60,4 +60,6 @@ export const getDeviceSpecs = async () => {
cpuCount: os.cpus().length, cpuCount: os.cpus().length,
...(gpuInfo && { gpu: gpuInfo.gpuDevice[0] }), ...(gpuInfo && { gpu: gpuInfo.gpuDevice[0] }),
}; };
return deviceSpecs;
}; };

View File

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

View File

@ -48,9 +48,11 @@ const SelectModelDialog = () => {
<DialogTrigger asChild> <DialogTrigger asChild>
<button className="btn btn-primary justify-start border-border"> <button className="btn btn-primary justify-start border-border">
<SwatchBookIcon className="mr-2 h-5 w-5" /> <SwatchBookIcon className="mr-2 h-5 w-5" />
{t( {selectedModelId in MODELS
`APP.MODEL_SELECTION.MODELS.${MODELS[selectedModelId].id || selectedModelId}.NAME` as any, ? t(
) || selectedModelId} `APP.MODEL_SELECTION.MODELS.${MODELS[selectedModelId]?.id}.NAME` as any,
)
: selectedModelId}
</button> </button>
</DialogTrigger> </DialogTrigger>
<DialogContent className="z-50 sm:max-w-lg"> <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 { ImageFormat, VALID_IMAGE_FORMATS } from "@/lib/valid-formats";
import { initCustomModels } from "@/components/hooks/use-custom-models"; import { initCustomModels } from "@/components/hooks/use-custom-models";
import { OnboardingDialog } from "@/components/main-content/onboarding-dialog"; import { OnboardingDialog } from "@/components/main-content/onboarding-dialog";
import useSystemInfo from "@/components/hooks/use-system-info";
const Home = () => { const Home = () => {
const t = useAtomValue(translationAtom); const t = useAtomValue(translationAtom);
const logit = useLogger(); const logit = useLogger();
const { toast } = useToast(); const { toast } = useToast();
const { systemInfo } = useSystemInfo();
initCustomModels(); initCustomModels();
@ -290,6 +292,11 @@ const Home = () => {
setIsLoading(false); setIsLoading(false);
}, []); }, []);
// SYSTEM INFO
useEffect(() => {
if (systemInfo) logit("💻 System Info:", JSON.stringify(systemInfo));
}, [systemInfo]);
// HANDLERS // HANDLERS
const resetImagePaths = () => { const resetImagePaths = () => {
logit("🔄 Resetting image paths"); logit("🔄 Resetting image paths");