refactor: gpu setup and status checks, extract functions, and improve error handling

This commit is contained in:
vishalkadam47
2024-11-08 03:32:33 +05:30
parent c765d7d9eb
commit 66c4d8f118
3 changed files with 329 additions and 255 deletions

View File

@@ -665,8 +665,8 @@ export const settingsRouter = createTRPCRouter({
}),
)
.mutation(async ({ input }) => {
if (IS_CLOUD) {
throw new Error("GPU setup is not available in cloud mode");
if (IS_CLOUD && !input.serverId) {
throw new Error("Select a server to enable the GPU Setup");
}
try {
@@ -684,7 +684,7 @@ export const settingsRouter = createTRPCRouter({
}),
)
.query(async ({ input }) => {
if (IS_CLOUD) {
if (IS_CLOUD && !input.serverId) {
return {
driverInstalled: false,
driverVersion: undefined,