Skip to content

Commit ffc3ccc

Browse files
Revert "Merge pull request #134 from Android-PowerUser/behebe-webview-probleme-mit-ki-antworten"
This reverts commit 32adad6, reversing changes made to 248c8d9.
1 parent 391be32 commit ffc3ccc

2 files changed

Lines changed: 11 additions & 34 deletions

File tree

.git-revert-marker

Lines changed: 0 additions & 1 deletion
This file was deleted.

index.html

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,11 +1181,10 @@
11811181
// This caused the selector to always return null, so a brand-new model bubble-wrap
11821182
// was appended on every single onAiMessage call instead of updating the pending one —
11831183
// flooding the chat with stray bubbles and pushing the user bubble out of view.
1184-
const lastWrap = msgs.lastElementChild;
1185-
const last = lastWrap && lastWrap.classList.contains('bubble-wrap')
1186-
const last = (lastWrap && lastWrap.classList.contains('bubble-wrap'))
1187-
? (lastWrap.querySelector('.bubble.model'))
1188-
if (last && last.querySelector('.model-icon.loading')) {
1184+
const allModelBubbles = [...msgs.querySelectorAll('.bubble.model')];
1185+
const last = allModelBubbles.length ? allModelBubbles[allModelBubbles.length - 1] : null;
1186+
const parentWrap = last && last.closest('.bubble-wrap');
1187+
if (parentWrap && last.querySelector('.model-icon.loading')) {
11891188
const textSpan = last.querySelector('.model-text') || last;
11901189
textSpan.textContent = text;
11911190
if (!isPending) {
@@ -1575,31 +1574,14 @@
15751574
*/
15761575
function _truncateCommands(commands) {
15771576
const limit = _executionPolicy.maxCommandsPerMessage;
1578-
if (limit <= 0) {
1577+
if (limit <= 0 || commands.length <= limit) {
15791578
return { commandsToExecute: commands, wasTruncated: false, totalCount: commands.length, executedCount: commands.length };
15801579
}
1581-
1582-
const countedCommands = commands.filter(c => c.type !== 'COMPLETED');
1583-
const wasTruncated = countedCommands.length > limit;
1584-
if (!wasTruncated) {
1585-
return { commandsToExecute: commands, wasTruncated: false, totalCount: countedCommands.length, executedCount: countedCommands.length };
1586-
}
1587-
1588-
let executedCount = 0;
1589-
const commandsToExecute = [];
1590-
for (const command of commands) {
1591-
if (command.type === 'COMPLETED') continue;
1592-
if (executedCount >= limit) continue;
1593-
commandsToExecute.push(command);
1594-
executedCount++;
1595-
}
1596-
15971580
return {
1598-
commandsToExecute,
1581+
commandsToExecute: commands.slice(0, limit),
15991582
wasTruncated: true,
1600-
totalCount: countedCommands.length,
1601-
executedCount,
1602-
hadCompleted: commands.some(c => c.type === 'COMPLETED'),
1583+
totalCount: commands.length,
1584+
executedCount: limit,
16031585
};
16041586
}
16051587

@@ -3242,21 +3224,17 @@
32423224
const parsedCommands = parseCommandsFromText(text);
32433225
if (!parsedCommands.length) return;
32443226

3245-
// Apply ExecutionPolicyConfig cap (maxCommandsPerMessage). completed() is a terminal
3246-
// marker, not an action command, so it does not consume one of the two action slots.
3227+
// Apply ExecutionPolicyConfig cap (maxCommandsPerMessage) - mirrors CommandExecutionLimiter.
32473228
const trunc = _truncateCommands(parsedCommands);
32483229
const commands = trunc.commandsToExecute;
32493230

32503231
if (trunc.wasTruncated) {
32513232
_pendingTruncationWarning = 'Only two commands may be executed at a time. The first two commands were executed, and the rest were ignored.';
32523233
}
32533234

3254-
// Determine if we have a screenshot or completed command. A truncated response that
3255-
// also contained completed() must not auto-request screen/Termux feedback; the only
3256-
// feedback for that turn is the truncation warning.
3235+
// Determine if we have a screenshot or completed command
32573236
const hasScreenshot = commands.some(c => c.type === 'SCREENSHOT');
32583237
const hasCompleted = commands.some(c => c.type === 'COMPLETED');
3259-
const suppressAutoFeedback = !!(trunc.wasTruncated && trunc.hadCompleted);
32603238

32613239
// Show detected commands in status area
32623240
const cmdStr = commands.map(_cmdToString).join(', ');
@@ -3265,7 +3243,7 @@
32653243
// If no screenshot and no completed: auto-append a screenshot at the end
32663244
// so the AI always gets screen feedback (matches Kotlin behavior).
32673245
const cmdList = [...commands];
3268-
if (!hasScreenshot && !hasCompleted && !suppressAutoFeedback) {
3246+
if (!hasScreenshot && !hasCompleted) {
32693247
cmdList.push({ type: 'SCREENSHOT' });
32703248
}
32713249

0 commit comments

Comments
 (0)