mzta_specialCommand is now using an object in input

This commit is contained in:
Mic 2025-09-04 22:41:00 +02:00
parent 72f3c49d77
commit 9967e28861
3 changed files with 31 additions and 6 deletions

View file

@ -195,7 +195,11 @@ export class mzta_Menus {
// TODO: use the current API, abort if using chatgpt web
// COMMENTED TO DO TESTS
// tags_current_email = "recipients, TEST, home, work, CAR, light";
let cmd_addTags = new mzta_specialCommand(fullPrompt,prefs_at.connection_type,prefs_at.do_debug);
let cmd_addTags = new mzta_specialCommand({
prompt: fullPrompt,
llm: prefs_at.connection_type,
do_debug: prefs_at.do_debug
});
await cmd_addTags.initWorker();
try{
tags_current_email = taPromptUtils.getTagsFromResponse(await cmd_addTags.sendPrompt());
@ -243,7 +247,11 @@ export class mzta_Menus {
*/
fullPrompt = taPromptUtils.finalizePrompt_get_calendar_event(fullPrompt);
this.logger.log("fullPrompt: " + fullPrompt);
let cmd_GetCalendarEvent = new mzta_specialCommand(fullPrompt,prefs_at.connection_type,true);
let cmd_GetCalendarEvent = new mzta_specialCommand({
prompt: fullPrompt,
llm: prefs_at.connection_type,
do_debug: true
});
await cmd_GetCalendarEvent.initWorker();
try{
calendar_event_data = await cmd_GetCalendarEvent.sendPrompt();
@ -311,7 +319,11 @@ export class mzta_Menus {
* }
*/
this.logger.log("fullPrompt: " + fullPrompt);
let cmd_GetTask = new mzta_specialCommand(fullPrompt,prefs_at.connection_type,true);
let cmd_GetTask = new mzta_specialCommand({
prompt: fullPrompt,
llm: prefs_at.connection_type,
do_debug: true
});
await cmd_GetTask.initWorker();
try{
task_data = await cmd_GetTask.sendPrompt();

View file

@ -30,7 +30,12 @@
logger = null;
do_debug = false;
constructor(prompt, llm, do_debug = false) {
constructor(args = {}) {
let {
prompt = '',
llm = '',
do_debug = false
} = args;
this.prompt = prompt;
this.llm = llm;
this.logger = new taLogger('mzta_specialCommand', do_debug);

View file

@ -1071,7 +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);
let cmd_addTags = new mzta_specialCommand(specialFullPrompt_add_tags, getConnectionType(prefs_aats.connection_type, curr_prompt_add_tags), prefs_init.do_debug);
let cmd_addTags = new mzta_specialCommand({
prompt: specialFullPrompt_add_tags,
llm: getConnectionType(prefs_aats.connection_type, curr_prompt_add_tags),
do_debug: prefs_init.do_debug
});
await cmd_addTags.initWorker();
let tags_current_email = [];
try {
@ -1105,7 +1109,11 @@ async function processEmails(messages, addTagsAuto, spamFilter) {
});
taLog.log("Special prompt: " + specialFullPrompt_spamfilter);
// console.log(">>>>>>>> Special prompt for spamfilter: " + specialFullPrompt_spamfilter);
let cmd_spamfilter = new mzta_specialCommand(specialFullPrompt_spamfilter, getConnectionType(prefs_init.connection_type, curr_prompt_spamfilter), prefs_init.do_debug);
let cmd_spamfilter = new mzta_specialCommand({
prompt: specialFullPrompt_spamfilter,
llm: getConnectionType(prefs_init.connection_type, curr_prompt_spamfilter),
do_debug: prefs_init.do_debug
});
await cmd_spamfilter.initWorker();
let spamfilter_result = '';
taLog.log("Sending the prompt...");