File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change 415
415
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
416
416
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
417
417
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
418
+ IPHONEOS_DEPLOYMENT_TARGET = 17.0;
418
419
LD_RUNPATH_SEARCH_PATHS = (
419
420
"$(inherited)",
420
421
"@executable_path/Frameworks",
467
468
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
468
469
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
469
470
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
471
+ IPHONEOS_DEPLOYMENT_TARGET = 17.0;
470
472
LD_RUNPATH_SEARCH_PATHS = (
471
473
"$(inherited)",
472
474
"@executable_path/Frameworks",
Original file line number Diff line number Diff line change @@ -87,6 +87,15 @@ final class ChatState: ObservableObject {
87
87
} )
88
88
}
89
89
90
+ // reset the chat if we switch to background
91
+ // during generation to avoid permission issue
92
+ func requestSwitchToBackground( ) {
93
+ if ( getModelChatState ( ) == . generating) {
94
+ self . requestResetChat ( )
95
+ }
96
+ }
97
+
98
+
90
99
func requestTerminateChat( callback: @escaping ( ) -> Void ) {
91
100
assert ( isInterruptible)
92
101
interruptChat ( prologue: {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import GameController
8
8
9
9
struct ChatView : View {
10
10
@EnvironmentObject private var chatState : ChatState
11
-
11
+ @ Environment ( \ . scenePhase ) var scenePhase
12
12
@State private var inputMessage : String = " "
13
13
@FocusState private var inputIsFocused : Bool
14
14
@Environment ( \. dismiss) private var dismiss
@@ -20,7 +20,7 @@ struct ChatView: View {
20
20
@State private var imageConfirmed : Bool = false
21
21
@State private var imageSourceType : UIImagePickerController . SourceType = . photoLibrary
22
22
@State private var image : UIImage ?
23
-
23
+
24
24
var body : some View {
25
25
VStack {
26
26
modelInfoView
@@ -30,6 +30,11 @@ struct ChatView: View {
30
30
}
31
31
. navigationBarTitle ( " MLC Chat: \( chatState. displayName) " , displayMode: . inline)
32
32
. navigationBarBackButtonHidden ( )
33
+ . onChange ( of: scenePhase) { oldPhase, newPhase in
34
+ if newPhase == . background {
35
+ self . chatState. requestSwitchToBackground ( )
36
+ }
37
+ }
33
38
. toolbar {
34
39
ToolbarItem ( placement: . navigationBarLeading) {
35
40
Button {
@@ -50,6 +55,7 @@ struct ChatView: View {
50
55
. disabled ( !chatState. isResettable)
51
56
}
52
57
}
58
+
53
59
}
54
60
}
55
61
Original file line number Diff line number Diff line change 28
28
}
29
29
},
30
30
{
31
- "model" : " HF://mlc-ai/Mistral-7B-Instruct-v0.3-q4f16_1 -MLC" ,
31
+ "model" : " HF://mlc-ai/Mistral-7B-Instruct-v0.3-q3f16_1 -MLC" ,
32
32
"model_id" : " Mistral-7B-Instruct-v0.3-q3f16_1-MLC" ,
33
33
"estimated_vram_bytes" : 3316000000 ,
34
34
"overrides" : {
35
- "prefill_chunk_size" : 128
35
+ "prefill_chunk_size" : 128 ,
36
+ "context_window_size" : 768
36
37
}
37
38
}
38
39
]
You can’t perform that action at this time.
0 commit comments