Skip to content

Commit

Permalink
fix: mac users should not see GPU settings (janhq#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Dec 29, 2023
1 parent a9579a3 commit 54750ed
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion web/containers/Providers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Providers = (props: PropsWithChildren) => {
<FeatureToggleWrapper>
<EventListenerWrapper>
<TooltipProvider delayDuration={0}>{children}</TooltipProvider>
<GPUDriverPrompt />
{!isMac && <GPUDriverPrompt />}
</EventListenerWrapper>
<Toaster position="top-right" />
</FeatureToggleWrapper>
Expand Down
51 changes: 26 additions & 25 deletions web/screens/Settings/Advanced/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,34 @@ const Advanced = () => {
return (
<div className="block w-full">
{/* CPU / GPU switching */}

<div className="flex w-full items-start justify-between border-b border-border py-4 first:pt-0 last:border-none">
<div className="w-4/5 flex-shrink-0 space-y-1.5">
<div className="flex gap-x-2">
<h6 className="text-sm font-semibold capitalize">NVidia GPU</h6>
{!isMac && (
<div className="flex w-full items-start justify-between border-b border-border py-4 first:pt-0 last:border-none">
<div className="w-4/5 flex-shrink-0 space-y-1.5">
<div className="flex gap-x-2">
<h6 className="text-sm font-semibold capitalize">NVidia GPU</h6>
</div>
<p className="whitespace-pre-wrap leading-relaxed">
Enable GPU acceleration for NVidia GPUs.
</p>
</div>
<p className="whitespace-pre-wrap leading-relaxed">
Enable GPU acceleration for NVidia GPUs.
</p>
<Switch
checked={gpuEnabled}
onCheckedChange={(e: boolean) => {
if (e === true) {
saveSettings({ runMode: 'gpu' })
setGpuEnabled(true)
setShowNotification(false)
setTimeout(() => {
validateSettings()
}, 300)
} else {
saveSettings({ runMode: 'cpu' })
setGpuEnabled(false)
}
}}
/>
</div>
<Switch
checked={gpuEnabled}
onCheckedChange={(e: boolean) => {
if (e === true) {
saveSettings({ runMode: 'gpu' })
setGpuEnabled(true)
setShowNotification(false)
setTimeout(() => {
validateSettings()
}, 300)
} else {
saveSettings({ runMode: 'cpu' })
setGpuEnabled(false)
}
}}
/>
</div>
)}
{/* Experimental */}
<div className="flex w-full items-start justify-between border-b border-border py-4 first:pt-0 last:border-none">
<div className="w-4/5 flex-shrink-0 space-y-1.5">
Expand Down

0 comments on commit 54750ed

Please sign in to comment.