diff --git a/apps/expo-example/src/components/adapters/llamaModelSetupAdapter.ts b/apps/expo-example/src/components/adapters/llamaModelSetupAdapter.ts index b3079992..6900f090 100644 --- a/apps/expo-example/src/components/adapters/llamaModelSetupAdapter.ts +++ b/apps/expo-example/src/components/adapters/llamaModelSetupAdapter.ts @@ -8,7 +8,7 @@ import { removeModel, } from '../../../../../packages/llama/src/storage' import type { Availability, SetupAdapter } from '../../config/providers.common' -import { isModelDownloaded } from '../../utils/storage' +import { isLlamaModelDownloaded } from '../../utils/llamaStorageUtils' export const createLlamaLanguageSetupAdapter = ( hfModelId: string, @@ -34,7 +34,7 @@ export const createLlamaLanguageSetupAdapter = ( }, builtIn: false, isAvailable(): Availability { - const downloaded = isModelDownloaded(hfModelId) + const downloaded = isLlamaModelDownloaded(hfModelId) return downloaded ? 'yes' : 'availableForDownload' }, async download(onProgress) { diff --git a/apps/expo-example/src/components/adapters/llamaSpeechSetupAdapter.ts b/apps/expo-example/src/components/adapters/llamaSpeechSetupAdapter.ts index 50e5e33a..d44a506f 100644 --- a/apps/expo-example/src/components/adapters/llamaSpeechSetupAdapter.ts +++ b/apps/expo-example/src/components/adapters/llamaSpeechSetupAdapter.ts @@ -7,7 +7,7 @@ import { } from '@react-native-ai/llama' import type { Availability, SetupAdapter } from '../../config/providers.common' -import { isModelDownloaded } from '../../utils/storage' +import { isLlamaModelDownloaded } from '../../utils/llamaStorageUtils' interface LlamaSpeechSetupOptions { modelId: string @@ -42,15 +42,15 @@ export const createLlamaSpeechSetupAdapter = ({ builtIn: false, isAvailable(): Availability { const [modelReady, vocoderReady] = [ - isModelDownloaded(hfModelId), - isModelDownloaded(vocoderId), + isLlamaModelDownloaded(hfModelId), + isLlamaModelDownloaded(vocoderId), ] return modelReady && vocoderReady ? 'yes' : 'availableForDownload' }, async download(onProgress) { const [modelReady, vocoderReady] = [ - isModelDownloaded(hfModelId), - isModelDownloaded(vocoderId), + isLlamaModelDownloaded(hfModelId), + isLlamaModelDownloaded(vocoderId), ] if (!modelReady || !vocoderReady) { await downloadModel(hfModelId, (progress) => { diff --git a/apps/expo-example/src/utils/storage.ts b/apps/expo-example/src/utils/llamaStorageUtils.ts similarity index 82% rename from apps/expo-example/src/utils/storage.ts rename to apps/expo-example/src/utils/llamaStorageUtils.ts index c6fc16f0..ca97ecb9 100644 --- a/apps/expo-example/src/utils/storage.ts +++ b/apps/expo-example/src/utils/llamaStorageUtils.ts @@ -1,7 +1,7 @@ import { getModelPath } from '@react-native-ai/llama/src/storage' import { File } from 'expo-file-system' -export function isModelDownloaded(modelId: string): boolean { +export function isLlamaModelDownloaded(modelId: string): boolean { let path = getModelPath(modelId) // expo-file-system requires that this URI starts with the file:// protocol