Merge pull request #109 from wagesj45/codex/find-real-time-updates-for-diff-view

Improve debug tab updates
This commit is contained in:
Jordan Wages 2025-07-19 19:52:14 -05:00 committed by GitHub
commit d1ddfc4ad8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 5 deletions

View file

@ -16,7 +16,7 @@ message meets a specified criterion.
- **Advanced parameters** tune generation settings like temperature, topp and more from the options page. - **Advanced parameters** tune generation settings like temperature, topp and more from the options page.
- **Markdown conversion** optionally convert HTML bodies to Markdown before sending them to the AI service. - **Markdown conversion** optionally convert HTML bodies to Markdown before sending them to the AI service.
- **Debug logging** optional colorized logs help troubleshoot interactions with the AI service. - **Debug logging** optional colorized logs help troubleshoot interactions with the AI service.
- **Debug tab** view the last request payload sent to the AI service. - **Debug tab** view the last request payload and message diff with live updates.
- **Light/Dark themes** automatically match Thunderbird's appearance with optional manual override. - **Light/Dark themes** automatically match Thunderbird's appearance with optional manual override.
- **Automatic rules** create rules that tag, move, copy, forward, reply, delete, archive, mark read/unread or flag/unflag messages based on AI classification. Rules can optionally apply only to unread messages and can ignore messages outside a chosen age range. - **Automatic rules** create rules that tag, move, copy, forward, reply, delete, archive, mark read/unread or flag/unflag messages based on AI classification. Rules can optionally apply only to unread messages and can ignore messages outside a chosen age range.
- **Rule ordering** drag rules to prioritize them and optionally stop processing after a match. - **Rule ordering** drag rules to prioritize them and optionally stop processing after a match.

View file

@ -70,13 +70,18 @@ document.addEventListener('DOMContentLoaded', async () => {
await applyTheme(themeSelect.value); await applyTheme(themeSelect.value);
const payloadDisplay = document.getElementById('payload-display'); const payloadDisplay = document.getElementById('payload-display');
const diffDisplay = document.getElementById('diff-display'); const diffDisplay = document.getElementById('diff-display');
if (defaults.lastPayload) {
payloadDisplay.textContent = JSON.stringify(defaults.lastPayload, null, 2); let lastFullText = defaults.lastFullText || '';
let lastPromptText = defaults.lastPromptText || '';
let lastPayload = defaults.lastPayload ? JSON.stringify(defaults.lastPayload, null, 2) : '';
if (lastPayload) {
payloadDisplay.textContent = lastPayload;
} }
if (defaults.lastFullText && defaults.lastPromptText && diff_match_patch) { if (lastFullText && lastPromptText && diff_match_patch) {
const dmp = new diff_match_patch(); const dmp = new diff_match_patch();
dmp.Diff_EditCost = 4; dmp.Diff_EditCost = 4;
const diffs = dmp.diff_main(defaults.lastFullText, defaults.lastPromptText); const diffs = dmp.diff_main(lastFullText, lastPromptText);
dmp.diff_cleanupEfficiency(diffs); dmp.diff_cleanupEfficiency(diffs);
diffDisplay.innerHTML = dmp.diff_prettyHtml(diffs); diffDisplay.innerHTML = dmp.diff_prettyHtml(diffs);
} }
@ -729,6 +734,30 @@ document.addEventListener('DOMContentLoaded', async () => {
} catch { } catch {
cacheCountEl.textContent = '?'; cacheCountEl.textContent = '?';
} }
try {
if (debugTabToggle.checked) {
const latest = await storage.local.get(['lastPayload', 'lastFullText', 'lastPromptText']);
const payloadStr = latest.lastPayload ? JSON.stringify(latest.lastPayload, null, 2) : '';
if (payloadStr !== lastPayload) {
lastPayload = payloadStr;
payloadDisplay.textContent = payloadStr;
}
if (latest.lastFullText !== lastFullText || latest.lastPromptText !== lastPromptText) {
lastFullText = latest.lastFullText || '';
lastPromptText = latest.lastPromptText || '';
if (lastFullText && lastPromptText && diff_match_patch) {
const dmp = new diff_match_patch();
dmp.Diff_EditCost = 4;
const diffs = dmp.diff_main(lastFullText, lastPromptText);
dmp.diff_cleanupEfficiency(diffs);
diffDisplay.innerHTML = dmp.diff_prettyHtml(diffs);
} else {
diffDisplay.innerHTML = '';
}
}
}
} catch {}
} }
refreshMaintenance(); refreshMaintenance();