From 50e54da6d0625063fae03b281ec830e4e39ca05b Mon Sep 17 00:00:00 2001 From: mic Date: Tue, 10 Dec 2024 22:04:31 +0100 Subject: [PATCH] working on special menus... see #183 --- js/mzta-menus.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/js/mzta-menus.js b/js/mzta-menus.js index aaf099cc..f1595ea3 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -55,7 +55,7 @@ export class mzta_Menus { this.rootMenu = []; this.shortcutMenu = []; this.menu_listeners = {}; - this.allPrompts = await getPrompts(true); + this.allPrompts = await getPrompts(true,true); this.allPrompts.sort((a, b) => a.name.localeCompare(b.name)); this.allPrompts.forEach((prompt) => { this.addAction(prompt) @@ -179,7 +179,19 @@ export class mzta_Menus { // const tabs = await browser.tabs.query({ active: true, currentWindow: true }); // add custom text if needed //browser.runtime.sendMessage({command: "chatgpt_open", prompt: fullPrompt, action: curr_prompt.action, tabId: tabs[0].id}); - this.openChatGPT(fullPrompt, curr_prompt.action, tabs[0].id, curr_prompt.name, curr_prompt.need_custom_text); + if(curr_prompt.is_special == '1'){ + switch(curr_prompt.id){ + case 'prompt_add_tags': + const tabs_debug = await browser.tabs.query({ active: true, currentWindow: true }); + console.log("[ThunderAI] Add tags for this message: " + tabs_debug[0].url); + break; + default: + console.error("[ThunderAI] Unknown special prompt id: " + curr_prompt.id); + break; + } + }else{ + this.openChatGPT(fullPrompt, curr_prompt.action, tabs[0].id, curr_prompt.name, curr_prompt.need_custom_text); + } }; this.rootMenu.push(curr_menu_entry); };