Skip to content

Commit 34094c8

Browse files
hsubox76dlarocque
andauthored
Apply suggestions from code review
Co-authored-by: Daniel La Rocque <[email protected]>
1 parent 8c9c1c2 commit 34094c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/ai/src/requests/hybrid-helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function callCloudOrDevice<Response>(
5959
}
6060
throw new AIError(
6161
AIErrorCode.UNSUPPORTED,
62-
'On-device model is not available.'
62+
'Inference mode is ONLY_ON_DEVICE, but an on-device model is not available.'
6363
);
6464
case InferenceMode.ONLY_IN_CLOUD:
6565
return inCloudCall();
@@ -72,10 +72,12 @@ export async function callCloudOrDevice<Response>(
7272
}
7373
throw e;
7474
}
75-
default: // PREFER_ON_DEVICE
75+
case InferenceMode.PREFER_ON_DEVICE:
7676
if (await chromeAdapter.isAvailable(request)) {
7777
return onDeviceCall();
7878
}
7979
return inCloudCall();
80+
default:
81+
throw new AIError(AIErrorCode.Error, `Unexpected infererence mode: ${(chromeAdapter as ChromeAdapterImpl).mode}`);
8082
}
8183
}

0 commit comments

Comments
 (0)