Skip to content

Commit a45bc60

Browse files
Add files via upload
1 parent 8e27d0d commit a45bc60

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,15 @@ class PhotoReasoningViewModel(
408408
"Screenshot aufgenommen"
409409
}
410410

411+
// Convert URI to string for storage in message
412+
val uriString = screenshotUri.toString()
413+
411414
// Add user message to chat history
412415
val userMessage = PhotoReasoningMessage(
413416
text = messageText,
414417
participant = PhotoParticipant.USER,
415418
isPending = false,
416-
image = result // Include the image in the message
419+
imageUris = listOf(uriString)
417420
)
418421
_chatState.addMessage(userMessage)
419422
_chatMessagesFlow.value = chatMessages
@@ -462,8 +465,8 @@ class PhotoReasoningViewModel(
462465
val userMessage = PhotoReasoningMessage(
463466
text = messageText,
464467
participant = PhotoParticipant.USER,
465-
isPending = false,
466-
image = screenshot // Include the image in the message
468+
isPending = false
469+
// No imageUris here as we're using the bitmap directly in currentSelectedImages
467470
)
468471
_chatState.addMessage(userMessage)
469472
_chatMessagesFlow.value = chatMessages
@@ -507,8 +510,8 @@ class PhotoReasoningViewModel(
507510
val userMessage = PhotoReasoningMessage(
508511
text = messageText,
509512
participant = PhotoParticipant.USER,
510-
isPending = false,
511-
image = screenshot // Include the image in the message
513+
isPending = false
514+
// No imageUris here as we're using the bitmap directly in currentSelectedImages
512515
)
513516
_chatState.addMessage(userMessage)
514517
_chatMessagesFlow.value = chatMessages

0 commit comments

Comments
 (0)