File tree Expand file tree Collapse file tree
app/src/main/kotlin/com/google/ai/sample/feature/multimodal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2265,7 +2265,13 @@ private fun processCommands(text: String) {
22652265 val commandBatch = PhotoReasoningCommandProcessing .parseForFinalExecution(text)
22662266 val commands = commandBatch.commands
22672267 val hasTakeScreenshotCommand = commandBatch.hasTakeScreenshotCommand
2268- val commandsToExecute = commands.filterNot { it is Command .Retrieve }
2268+ val commandsToExecute = commands.mapIndexedNotNull { index, command ->
2269+ when {
2270+ command is Command .Retrieve -> null
2271+ index < incrementalCommandCount && command !is Command .TakeScreenshot -> null
2272+ else -> command
2273+ }
2274+ }
22692275
22702276 if (hasTakeScreenshotCommand) {
22712277 pendingRetrievedInfoForNextScreenshot = buildRetrievedInfoForNextScreenshot(commands)
You can’t perform that action at this time.
0 commit comments