Skip to content

Commit 95f2543

Browse files
Add files via upload
1 parent 29bb25e commit 95f2543

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

app/src/main/kotlin/com/google/ai/sample/feature/multimodal/PhotoReasoningViewModel.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ class PhotoReasoningViewModel(
258258
private suspend fun handleQuotaExceededError(e: Exception, inputContent: Content, retryCount: Int) {
259259
// Mark the current API key as failed
260260
val currentKey = MainActivity.getInstance()?.getCurrentApiKey()
261-
if (currentKey != null) {
261+
if (currentKey != null && apiKeyManager != null) {
262262
apiKeyManager.markKeyAsFailed(currentKey)
263263

264264
// Log the specific quota exceeded error
@@ -345,7 +345,7 @@ class PhotoReasoningViewModel(
345345
private suspend fun handle503Error(e: Exception, inputContent: Content, retryCount: Int) {
346346
// Mark the current API key as failed
347347
val currentKey = MainActivity.getInstance()?.getCurrentApiKey()
348-
if (currentKey != null) {
348+
if (currentKey != null && apiKeyManager != null) {
349349
apiKeyManager.markKeyAsFailed(currentKey)
350350

351351
// Check if we have only one key or if all keys are failed
@@ -488,13 +488,13 @@ class PhotoReasoningViewModel(
488488
_detectedCommands.value = currentCommands
489489

490490
// Update status to show commands were detected
491-
val commandDescriptions = commands.map { command ->
492-
"${command.action}: ${command.parameters.joinToString(", ")}"
493-
}.joinToString("; ")
491+
val commandDescriptions = commands.joinToString("; ") { command ->
492+
command.toString()
493+
}
494494
_commandExecutionStatus.value = "Befehle erkannt: $commandDescriptions"
495495

496496
// Execute the commands if the accessibility service is running
497-
val accessibilityService = ScreenOperatorAccessibilityService.getInstance()
497+
val accessibilityService = ScreenOperatorAccessibilityService.getInstanceStatic()
498498
if (accessibilityService != null) {
499499
for (command in commands) {
500500
try {

0 commit comments

Comments
 (0)