File tree Expand file tree Collapse file tree
app/src/main/kotlin/com/google/ai/sample Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1163,7 +1163,7 @@ class PhotoReasoningViewModel(
11631163 screenInfoForPrompt : String? ,
11641164 imageUrisForChat : List <String >?
11651165 ) {
1166- val apiKey = mainActivity ?.getCurrentApiKey(ApiProvider .PUTER ) ? : " "
1166+ val apiKey = com.google.ai.sample. MainActivity .getInstance() ?.getCurrentApiKey(ApiProvider .PUTER ) ? : " "
11671167 if (apiKey.isEmpty()) {
11681168 _uiState .value = PhotoReasoningUiState .Error (" Puter Authentication Token (API Key) is missing" )
11691169 return
@@ -1551,7 +1551,7 @@ class PhotoReasoningViewModel(
15511551 putExtra(ScreenCaptureService .EXTRA_AI_MODEL_NAME , generativeModel.modelName) // Pass model name
15521552 val mainActivity = MainActivity .getInstance()
15531553 val currentModel = com.google.ai.sample.GenerativeAiViewModelFactory .getCurrentModel()
1554- val apiKey = mainActivity ?.getCurrentApiKey(currentModel.apiProvider) ? : " "
1554+ val apiKey = com.google.ai.sample. MainActivity .getInstance() ?.getCurrentApiKey(currentModel.apiProvider) ? : " "
15551555 putExtra(ScreenCaptureService .EXTRA_AI_API_KEY , apiKey)
15561556 // Add the new extra for file paths
15571557 putStringArrayListExtra(ScreenCaptureService .EXTRA_TEMP_FILE_PATHS , tempFilePaths)
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import android.graphics.Bitmap
44import android.util.Base64
55import kotlinx.serialization.*
66import kotlinx.serialization.json.Json
7+ import kotlinx.serialization.json.JsonClassDiscriminator
78import okhttp3.MediaType.Companion.toMediaType
89import okhttp3.OkHttpClient
910import okhttp3.Request
You can’t perform that action at this time.
0 commit comments