Commit 052cf2f
committed
Fix: Prevent screenshot loop by removing auto-reason() call.
The primary cause of the reported screenshot loop (where screenshots
were taken about once per second until app termination, flooding me)
was identified in `PhotoReasoningViewModel.addScreenshotToConversation()`.
This method would automatically call `reason()` with the just-captured
screenshot and a generic prompt. If my response (even a default
or error response when flooded) contained text parsable as another
`TAKE_SCREENSHOT` command, the loop would perpetuate.
This commit fixes the issue by commenting out the automatic call to
`reason(prompt, listOf(bitmap))` within
`PhotoReasoningViewModel.addScreenshotToConversation()`.
With this change:
- When a screenshot is taken (e.g., due to my command), it is
processed by `addScreenshotToConversation`, added to the chat history,
and the ViewModel's `currentSelectedImages` is updated.
- However, the ViewModel no longer automatically sends this screenshot
back to me for immediate analysis.
- This breaks the loop, as I am not re-queried in a way that
could lead to me issuing another screenshot command based on the same
event.
- I will now effectively pause after an AI-initiated screenshot
is displayed. You must provide new textual input to prompt me
to analyze or act upon that screenshot.
This directly addresses the "self-reproducing screenshot command" and
the AI flooding problem.1 parent 5794d8c commit 052cf2f
2 files changed
Lines changed: 20 additions & 11 deletions
File tree
- app/src/main/kotlin/com/google/ai/sample
- feature/multimodal
Lines changed: 19 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| 138 | + | |
137 | 139 | | |
138 | 140 | | |
139 | 141 | | |
| |||
460 | 462 | | |
461 | 463 | | |
462 | 464 | | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
473 | 477 | | |
| 478 | + | |
474 | 479 | | |
475 | 480 | | |
476 | 481 | | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
477 | 486 | | |
478 | 487 | | |
479 | 488 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1005 | 1005 | | |
1006 | 1006 | | |
1007 | 1007 | | |
1008 | | - | |
| 1008 | + | |
1009 | 1009 | | |
1010 | 1010 | | |
1011 | 1011 | | |
| |||
0 commit comments