Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/src/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ class Package:
categories: list[Category] = field(default_factory=list)
features: list[Feature] = field(default_factory=list)
settings: list[Setting] = field(default_factory=list)
disabled: bool = False
disabled_reason: str | None = None

def add_category(
self,
Expand Down Expand Up @@ -386,6 +388,8 @@ def to_dict(self):
"dependencies": [d.to_dict() for d in self.dependencies],
"features": [f.to_dict() for f in self.features],
"settings": [asdict(x) for x in self.settings],
"disabled": self.disabled,
"disabledReason": self.disabled_reason,
}

@staticmethod
Expand Down
9 changes: 4 additions & 5 deletions backend/src/packages/chaiNNer_tensorrt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
color="#76B900",
)

# Only add category/nodes if NVIDIA GPU is available and not on ARM Mac
if not nvidia.is_available:
package.disabled = True
package.disabled_reason = "TensorRT requires an NVIDIA GPU with CUDA support"

if nvidia.is_available and not is_arm_mac:
tensorrt_category = package.add_category(
name="TensorRT",
Expand All @@ -52,7 +55,3 @@
logger.debug("Loaded package %s", package.name)
else:
tensorrt_category = None # type: ignore
if is_arm_mac:
logger.debug("TensorRT package registered but not available on ARM Mac")
else:
logger.debug("TensorRT package registered but no NVIDIA GPU detected")
2 changes: 2 additions & 0 deletions src/common/common-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ export interface Package {
readonly dependencies: readonly PyPiPackage[];
readonly features: readonly Feature[];
readonly settings: readonly Setting[];
readonly disabled?: boolean;
readonly disabledReason?: string;
}

export interface FeatureState {
Expand Down
46 changes: 29 additions & 17 deletions src/renderer/contexts/DependencyContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,12 @@ const PackageView = memo(
onUpdate: () => void;
}) => {
const { t } = useTranslation();
const isDisabled = p.disabled ?? false;
return (
<AccordionItem cursor="pointer">
<AccordionItem
cursor="pointer"
opacity={isDisabled ? 0.5 : 1}
>
<h2>
<VStack
spacing={0}
Expand Down Expand Up @@ -260,7 +264,7 @@ const PackageView = memo(
{packageInfo.canUpdate && (
<Button
colorScheme="blue"
disabled={isRunningShell}
disabled={isRunningShell || isDisabled}
isLoading={isRunningShell && isInstalling}
leftIcon={<DownloadIcon />}
size="sm"
Expand All @@ -273,7 +277,7 @@ const PackageView = memo(

<Button
colorScheme="red"
isDisabled={isRunningShell}
isDisabled={isRunningShell || isDisabled}
isLoading={isRunningShell && isInstalling}
leftIcon={<DeleteIcon />}
size="sm"
Expand All @@ -284,21 +288,29 @@ const PackageView = memo(
</HStack>
) : (
<HStack py={2}>
<Button
colorScheme="blue"
isDisabled={isRunningShell}
isLoading={isRunningShell && isInstalling}
leftIcon={<DownloadIcon />}
size="sm"
onClick={onInstall}
<Tooltip
hasArrow
borderRadius={8}
isDisabled={!isDisabled}
label={p.disabledReason ?? ''}
openDelay={200}
>
{t('dependencyManager.install', 'Install')} (
{formatSizeEstimate([
...packageInfo.missing,
...packageInfo.outdated,
])}
)
</Button>
<Button
colorScheme="blue"
isDisabled={isRunningShell || isDisabled}
isLoading={isRunningShell && isInstalling}
leftIcon={<DownloadIcon />}
size="sm"
onClick={onInstall}
>
{t('dependencyManager.install', 'Install')} (
{formatSizeEstimate([
...packageInfo.missing,
...packageInfo.outdated,
])}
)
</Button>
</Tooltip>
</HStack>
)}
<AccordionButton
Expand Down