@@ -78,11 +78,44 @@ val GenerativeViewModelFactory = object : ViewModelProvider.Factory {
7878
7979// Add companion object with static methods for easier access
8080object GenerativeAiViewModelFactory {
81+ // Current selected model name - duplicated from GenerativeViewModelFactory
82+ private var currentModelName = " gemini-2.0-flash-lite"
83+
84+ /* *
85+ * Set the model to high reasoning capability (gemini-2.5-pro-preview-03-25)
86+ */
8187 fun highReasoningModel () {
82- GenerativeViewModelFactory .highReasoningModel()
88+ currentModelName = " gemini-2.5-pro-preview-03-25"
89+ // Also update the original factory to keep them in sync
90+ (GenerativeViewModelFactory as ViewModelProvider .Factory ).apply {
91+ if (this is ViewModelProvider .Factory ) {
92+ try {
93+ val field = this .javaClass.getDeclaredField(" currentModelName" )
94+ field.isAccessible = true
95+ field.set(this , currentModelName)
96+ } catch (e: Exception ) {
97+ // Fallback if reflection fails
98+ }
99+ }
100+ }
83101 }
84102
103+ /* *
104+ * Set the model to low reasoning capability (gemini-2.0-flash-lite)
105+ */
85106 fun lowReasoningModel () {
86- GenerativeViewModelFactory .lowReasoningModel()
107+ currentModelName = " gemini-2.0-flash-lite"
108+ // Also update the original factory to keep them in sync
109+ (GenerativeViewModelFactory as ViewModelProvider .Factory ).apply {
110+ if (this is ViewModelProvider .Factory ) {
111+ try {
112+ val field = this .javaClass.getDeclaredField(" currentModelName" )
113+ field.isAccessible = true
114+ field.set(this , currentModelName)
115+ } catch (e: Exception ) {
116+ // Fallback if reflection fails
117+ }
118+ }
119+ }
87120 }
88121}
0 commit comments