Merge pull request #34 from wagesj45/codex/fix-error-in-add-on-loading
Fix message display context for menu
This commit is contained in:
commit
a154029320
2 changed files with 14 additions and 2 deletions
|
@ -20,7 +20,7 @@ message meets a specified criterion.
|
||||||
- **Advanced parameters** – tune generation settings like temperature, top‑p and more from the options page.
|
- **Advanced parameters** – tune generation settings like temperature, top‑p and more from the options page.
|
||||||
- **Debug logging** – optional colorized logs help troubleshoot interactions with the AI service.
|
- **Debug logging** – optional colorized logs help troubleshoot interactions with the AI service.
|
||||||
- **Automatic rules** – create rules that tag or move new messages based on AI classification.
|
- **Automatic rules** – create rules that tag or move new messages based on AI classification.
|
||||||
- **Context menu** – apply AI rules to selected messages from the message list or display.
|
- **Context menu** – apply AI rules from the message list or the message display action button.
|
||||||
- **Status icons** – toolbar icons indicate when messages are queued or being classified.
|
- **Status icons** – toolbar icons indicate when messages are queued or being classified.
|
||||||
- **Packaging script** – `build-xpi.ps1` builds an XPI ready for installation.
|
- **Packaging script** – `build-xpi.ps1` builds an XPI ready for installation.
|
||||||
|
|
||||||
|
|
|
@ -126,9 +126,21 @@ async function applyAiRules(idsInput) {
|
||||||
browser.menus.create({
|
browser.menus.create({
|
||||||
id: "apply-ai-rules-display",
|
id: "apply-ai-rules-display",
|
||||||
title: "Apply AI Rules",
|
title: "Apply AI Rules",
|
||||||
contexts: ["message_display"],
|
contexts: ["message_display_action"],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (browser.messageDisplayAction) {
|
||||||
|
browser.messageDisplayAction.onClicked.addListener(async (tab) => {
|
||||||
|
try {
|
||||||
|
const msgs = await browser.messageDisplay.getDisplayedMessages(tab.id);
|
||||||
|
const ids = msgs.map(m => m.id);
|
||||||
|
await applyAiRules(ids);
|
||||||
|
} catch (e) {
|
||||||
|
logger.aiLog("failed to apply AI rules from action", { level: 'error' }, e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
browser.menus.onClicked.addListener(async info => {
|
browser.menus.onClicked.addListener(async info => {
|
||||||
if (info.menuItemId === "apply-ai-rules-list" || info.menuItemId === "apply-ai-rules-display") {
|
if (info.menuItemId === "apply-ai-rules-list" || info.menuItemId === "apply-ai-rules-display") {
|
||||||
const ids = info.selectedMessages?.ids || (info.messageId ? [info.messageId] : []);
|
const ids = info.selectedMessages?.ids || (info.messageId ? [info.messageId] : []);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue