work in progress, saving a point before working on generalizing the connetiontype html code. see #438

This commit is contained in:
Mic 2025-09-02 22:45:00 +02:00
parent d404897911
commit e551974a56
6 changed files with 43 additions and 4 deletions

View file

@ -1151,6 +1151,14 @@
"message": "If checked, the AI will only add tags to emails received in the inbox folder.",
"description": ""
},
"prefs_OptionText_add_tags_use_specific_integration": {
"message": "Use specific Model and API",
"description": ""
},
"prefs_OptionText_add_tags_use_specific_integration_Info": {
"message": "If checked, the Model and API specified below will be used for adding tags to emails, regardless the one choosen in the ThunderAI options page.",
"description": ""
},
"placeholder_thunderai_def_sign": {
"message": "Default signature as defined in ThunderAI options.",
"description": ""

View file

@ -364,7 +364,7 @@ export function generateCallID(length = 10) {
return result;
}
export function populateConnectionTypeOptions(selectId) {
export function populateConnectionTypeOptions(selectId, no_chatgpt_web = false) {
const selectEl = document.getElementById(selectId);
if (!selectEl) return;
@ -381,7 +381,7 @@ export function populateConnectionTypeOptions(selectId) {
selectEl.innerHTML = '';
for (const opt of options) {
for (const opt of options.filter(o => !(no_chatgpt_web && o.value === 'chatgpt_web'))) {
const optionEl = document.createElement('option');
optionEl.value = opt.value;
optionEl.textContent = browser.i18n.getMessage(opt.msgKey) || opt.msgKey;

View file

@ -66,6 +66,8 @@ export const prefs_default = {
add_tags_auto_uselist_list: '',
add_tags_context_menu: true,
add_tags_enabled_accounts: [],
add_tags_use_specific_integration: false,
add_tags_connection_type: '',
get_calendar_event: true,
get_task: true,
calendar_enforce_timezone: false,

View file

@ -43,7 +43,12 @@
background-color: #e9ffdf;
}
tr.add_tags_auto_sub td{
.specific_integration{
background-color: #dfeaff;
}
tr.add_tags_auto_sub td,
tr.specific_integration_sub td{
padding-left: 0.8em !important;
}
@ -159,4 +164,8 @@ table#miczPrefs tr:last-child td {
.add_tags_auto{
background-color: #415c35;
}
.specific_integration{
background-color: #2E3A4F;
}
}

View file

@ -13,6 +13,25 @@
</div>
<div class="addtags_table_title section_title">__MSG_AddTags_prompt_prefs_title__</div>
<table id="miczPrefs">
<tr class="add_tags_tr specific_integration">
<td><span>__MSG_prefs_OptionText_add_tags_use_specific_integration__</span>
</td>
<td>
<label>
<input type="checkbox" id="add_tags_use_specific_integration" name="add_tags_use_specific_integration" class="option-input" />
__MSG_prefs_OptionText_add_tags_use_specific_integration_Info__
</label>
</td>
</tr>
<tr class="add_tags_tr specific_integration specific_integration_sub">
<td><span>__MSG_prefs_Connection_type__</span>
</td>
<td>
<label>
<select id="add_tags_connection_type" name="add_tags_connection_type" class="option-input"></select>
</label>
</td>
</tr>
<tr class="add_tags_tr">
<td><span>__MSG_prefs_OptionText_add_tags_maxnum__</span></td>
<td>

View file

@ -22,7 +22,7 @@ import { getSpecialPrompts, setSpecialPrompts } from "../../js/mzta-prompts.js";
import { getPlaceholders } from "../../js/mzta-placeholders.js";
import { textareaAutocomplete } from "../../js/mzta-placeholders-autocomplete.js";
import { addTags_getExclusionList, addTags_setExclusionList } from "../../js/mzta-addatags-exclusion-list.js";
import { getAccountsList, normalizeStringList } from "../../js/mzta-utils.js";
import { getAccountsList, normalizeStringList, populateConnectionTypeOptions } from "../../js/mzta-utils.js";
let autocompleteSuggestions = [];
let taLog = new taLogger("mzta-addtags-page",true);
@ -30,6 +30,7 @@ let taLog = new taLogger("mzta-addtags-page",true);
document.addEventListener('DOMContentLoaded', async () => {
i18n.updateDocument();
populateConnectionTypeOptions('add_tags_connection_type', true);
await restoreOptions();
document.querySelectorAll(".option-input").forEach(element => {