Skip to content

Commit 274e5e8

Browse files
committed
Merge branch 'feat/prefer-in-cloud' of https://github.com/firebase/firebase-js-sdk into feat/prefer-in-cloud
2 parents 7c4f837 + 34094c8 commit 274e5e8

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)