diff --git a/apps/expo-example/app.json b/apps/expo-example/app.json index 52acc6bb..4fa48af3 100644 --- a/apps/expo-example/app.json +++ b/apps/expo-example/app.json @@ -17,7 +17,6 @@ "bundleIdentifier": "com.callstack.ai.example" }, "android": { - "forceDarkAllowed": false, "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" diff --git a/apps/expo-example/src/App.tsx b/apps/expo-example/src/App.tsx index 87f35034..c789eee3 100644 --- a/apps/expo-example/src/App.tsx +++ b/apps/expo-example/src/App.tsx @@ -190,7 +190,7 @@ const styles = StyleSheet.create({ }, drawer: { width: 280, - backgroundColor: colors.systemBackground, + backgroundColor: '#fff', }, drawerScroll: { flex: 1, diff --git a/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx b/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx index 8f65f449..dbbf5fd5 100644 --- a/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx +++ b/apps/expo-example/src/components/RecordButton/RecordButtonUIBase.tsx @@ -186,11 +186,13 @@ export function RecordButtonUIBase({ ) } + const uiDisabled = disabled || isProcessing || !transcriptionModel + return ( {isProcessing ? ( @@ -202,9 +204,15 @@ export function RecordButtonUIBase({ } + fallback={ + + } /> )} diff --git a/apps/expo-example/src/components/adapters/appleSetupAdapter.ts b/apps/expo-example/src/components/adapters/appleSetupAdapter.ts index 08b43152..499813cf 100644 --- a/apps/expo-example/src/components/adapters/appleSetupAdapter.ts +++ b/apps/expo-example/src/components/adapters/appleSetupAdapter.ts @@ -8,7 +8,6 @@ export const createAppleLanguageSetupAdapter = ( tools: ToolSet = {} ): SetupAdapter => { const apple = createAppleProvider({ - // @ts-expect-error availableTools: tools, }) const model = apple.languageModel() diff --git a/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts b/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts index a6108653..7352dddc 100644 --- a/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts +++ b/apps/expo-example/src/components/adapters/mlcModelSetupAdapter.ts @@ -1,6 +1,6 @@ import type { LanguageModelV3 } from '@ai-sdk/provider' import { mlc } from '@react-native-ai/mlc' -import RNBlobUtil from 'react-native-blob-util' +import { File, Paths } from 'expo-file-system' import type { Availability, SetupAdapter } from '../../config/providers.common' @@ -18,10 +18,8 @@ export const createMLCLanguageSetupAdapter = ( icon: 'cpu', }, builtIn: false, - async isAvailable(): Promise { - return (await RNBlobUtil.fs.exists( - RNBlobUtil.fs.dirs.SDCardDir + `/${modelId}/tensor-cache.json` - )) + isAvailable(): Availability { + return new File(Paths.document, model.modelId, 'tensor-cache.json').exists ? 'yes' : 'availableForDownload' }, diff --git a/apps/expo-example/src/config/providers.common.ts b/apps/expo-example/src/config/providers.common.ts index 1b564643..cf861b29 100644 --- a/apps/expo-example/src/config/providers.common.ts +++ b/apps/expo-example/src/config/providers.common.ts @@ -25,7 +25,7 @@ export interface SetupAdapter { // Whether the model is built-in (true) or downloadable (false) builtIn: boolean // Check if model is ready, unavailable, or downloadable - isAvailable: () => Availability | Promise + isAvailable: () => Availability // Download the model with progress callback download: (onProgress: (percentage: number) => void) => Promise // Remove the downloaded model from storage diff --git a/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx b/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx index 86242a59..0bb571bc 100644 --- a/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx +++ b/apps/expo-example/src/screens/ChatScreen/ChatInputBar.tsx @@ -31,18 +31,20 @@ export function ChatInputBar({ onSend, isGenerating }: ChatInputBarProps) {