File tree Expand file tree Collapse file tree 5 files changed +2
-60
lines changed
Expand file tree Collapse file tree 5 files changed +2
-60
lines changed Original file line number Diff line number Diff line change 11import { Drawer } from 'expo-router/drawer' ;
22import ColorPalette from '../colors' ;
33import React from 'react' ;
4- import { LlmProvider , useLlmContext } from '../contexts/LlmContext' ;
54
65function DrawerWithScreens ( ) {
7- const { isGenerating } = useLlmContext ( ) ;
86 return (
97 < Drawer
108 screenOptions = { {
119 drawerActiveTintColor : ColorPalette . primary ,
1210 drawerInactiveTintColor : '#888' ,
1311 headerTintColor : ColorPalette . primary ,
1412 headerTitleStyle : { color : ColorPalette . primary } ,
15- swipeEnabled : ! isGenerating ,
1613 } }
1714 >
1815 < Drawer . Screen
@@ -52,9 +49,5 @@ function DrawerWithScreens() {
5249}
5350
5451export default function _layout ( ) {
55- return (
56- < LlmProvider >
57- < DrawerWithScreens />
58- </ LlmProvider >
59- ) ;
52+ return < DrawerWithScreens /> ;
6053}
Original file line number Diff line number Diff line change @@ -21,10 +21,8 @@ import {
2121import PauseIcon from '../../assets/icons/pause_icon.svg' ;
2222import ColorPalette from '../../colors' ;
2323import Messages from '../../components/Messages' ;
24- import { useLlmContext } from '../../contexts/LlmContext' ;
2524
2625export default function LLMScreen ( ) {
27- const { setIsGenerating } = useLlmContext ( ) ;
2826 const [ isTextInputFocused , setIsTextInputFocused ] = useState ( false ) ;
2927 const [ userInput , setUserInput ] = useState ( '' ) ;
3028 const textInputRef = useRef < TextInput > ( null ) ;
@@ -35,10 +33,6 @@ export default function LLMScreen() {
3533 tokenizerConfigSource : LLAMA3_2_TOKENIZER_CONFIG ,
3634 } ) ;
3735
38- useEffect ( ( ) => {
39- setIsGenerating ( llm . isGenerating ) ;
40- } , [ llm . isGenerating , setIsGenerating ] ) ;
41-
4236 useEffect ( ( ) => {
4337 if ( llm . error ) {
4438 console . log ( 'LLM error:' , llm . error ) ;
Original file line number Diff line number Diff line change @@ -26,10 +26,8 @@ import Messages from '../../components/Messages';
2626import * as Brightness from 'expo-brightness' ;
2727import * as Calendar from 'expo-calendar' ;
2828import { executeTool , TOOL_DEFINITIONS_PHONE } from '../../utils/tools' ;
29- import { useLlmContext } from '../../contexts/LlmContext' ;
3029
3130export default function LLMToolCallingScreen ( ) {
32- const { setIsGenerating } = useLlmContext ( ) ;
3331 const [ isTextInputFocused , setIsTextInputFocused ] = useState ( false ) ;
3432 const [ userInput , setUserInput ] = useState ( '' ) ;
3533 const textInputRef = useRef < TextInput > ( null ) ;
@@ -40,10 +38,6 @@ export default function LLMToolCallingScreen() {
4038 tokenizerConfigSource : HAMMER2_1_TOKENIZER_CONFIG ,
4139 } ) ;
4240
43- useEffect ( ( ) => {
44- setIsGenerating ( llm . isGenerating ) ;
45- } , [ llm . isGenerating , setIsGenerating ] ) ;
46-
4741 const { configure } = llm ;
4842 useEffect ( ( ) => {
4943 configure ( {
Original file line number Diff line number Diff line change 1- import { useRef , useState , useEffect } from 'react' ;
1+ import { useRef , useState } from 'react' ;
22import {
33 Keyboard ,
44 KeyboardAvoidingView ,
@@ -27,7 +27,6 @@ import Messages from '../../components/Messages';
2727import LiveAudioStream from 'react-native-live-audio-stream' ;
2828import DeviceInfo from 'react-native-device-info' ;
2929import { Buffer } from 'buffer' ;
30- import { useLlmContext } from '../../contexts/LlmContext' ;
3130const audioStreamOptions = {
3231 sampleRate : 16000 ,
3332 channels : 1 ,
@@ -57,7 +56,6 @@ const float32ArrayFromPCMBinaryBuffer = (b64EncodedBuffer: string) => {
5756} ;
5857
5958export default function VoiceChatScreen ( ) {
60- const { setIsGenerating } = useLlmContext ( ) ;
6159 const [ isRecording , setIsRecording ] = useState ( false ) ;
6260 const messageRecorded = useRef < boolean > ( false ) ;
6361
@@ -72,10 +70,6 @@ export default function VoiceChatScreen() {
7270 overlapSeconds : 1.2 ,
7371 } ) ;
7472
75- useEffect ( ( ) => {
76- setIsGenerating ( llm . isGenerating || speechToText . isGenerating ) ;
77- } , [ llm . isGenerating , speechToText . isGenerating , setIsGenerating ] ) ;
78-
7973 const onChunk = ( data : string ) => {
8074 const float32Chunk = float32ArrayFromPCMBinaryBuffer ( data ) ;
8175 speechToText . streamingTranscribe (
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments