From ee7a033e74647c60ba8408248bd8b6b8322522ce Mon Sep 17 00:00:00 2001 From: Mic Date: Thu, 4 Sep 2025 22:51:00 +0200 Subject: [PATCH] use prompt api and model when assigning tags. see #438 --- js/mzta-special-commands.js | 1 + js/workers/model-worker-anthropic.js | 1 + mzta-background.js | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/js/mzta-special-commands.js b/js/mzta-special-commands.js index 66befc7c..bb9f58c5 100644 --- a/js/mzta-special-commands.js +++ b/js/mzta-special-commands.js @@ -66,6 +66,7 @@ } async initWorker() { + // console.log((">>>>>>>>>>>> this.custom_model: " + this.custom_model)); switch (this.llm) { case "chatgpt_api": { let prefs_api = await browser.storage.sync.get({ diff --git a/js/workers/model-worker-anthropic.js b/js/workers/model-worker-anthropic.js index a16578c9..3636b5d4 100644 --- a/js/workers/model-worker-anthropic.js +++ b/js/workers/model-worker-anthropic.js @@ -36,6 +36,7 @@ let assistantResponseAccumulator = ''; self.onmessage = async function(event) { if (event.data.type === 'init') { + // console.log(">>>>>>>>>>>>>> event.data: " + JSON.stringify(event.data)); anthropic_api_key = event.data.anthropic_api_key; anthropic_model = event.data.anthropic_model; anthropic = new Anthropic(anthropic_api_key, event.data.anthropic_version, anthropic_model, event.data.anthropic_max_tokens, true); diff --git a/mzta-background.js b/mzta-background.js index 68dda652..faf2dc61 100644 --- a/mzta-background.js +++ b/mzta-background.js @@ -1058,7 +1058,7 @@ async function processEmails(messages, addTagsAuto, spamFilter) { let specialFullPrompt_add_tags = ''; let curr_prompt_add_tags = menus.allPrompts.find(p => p.id === 'prompt_add_tags'); let tags_full_list = await getTagsList(); - // console.log(">>>>>>>>>>>>> curr_prompt_add_tags: " + curr_prompt_add_tags); + // console.log(">>>>>>>>>>>>> curr_prompt_add_tags: " + JSON.stringify(curr_prompt_add_tags)); let chatgpt_lang = await taPromptUtils.getDefaultLang(curr_prompt_add_tags); specialFullPrompt_add_tags = await taPromptUtils.preparePrompt({ curr_prompt: curr_prompt_add_tags, @@ -1071,9 +1071,11 @@ async function processEmails(messages, addTagsAuto, spamFilter) { }); specialFullPrompt_add_tags = taPromptUtils.finalizePrompt_add_tags(specialFullPrompt_add_tags, prefs_aats.add_tags_maxnum, prefs_aats.add_tags_force_lang, prefs_aats.default_chatgpt_lang, prefs_aats.add_tags_auto_uselist, prefs_aats.add_tags_auto_uselist_list); taLog.log("Special prompt: " + specialFullPrompt_add_tags); + // console.log(">>>>>>>>>> curr_prompt_add_tags.model: " + curr_prompt_add_tags.model); let cmd_addTags = new mzta_specialCommand({ prompt: specialFullPrompt_add_tags, llm: getConnectionType(prefs_aats.connection_type, curr_prompt_add_tags), + custom_model: curr_prompt_add_tags.model ? curr_prompt_add_tags.model : '', do_debug: prefs_init.do_debug }); await cmd_addTags.initWorker();