use prompt api and model when assigning tags. see #438

This commit is contained in:
Mic 2025-09-04 22:51:00 +02:00
parent 14b6c97c9d
commit ee7a033e74
3 changed files with 5 additions and 1 deletions

View file

@ -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({

View file

@ -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);

View file

@ -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();