feat(summary): add auto-summary preference for message previews

- Add new preference option to enable automatic AI summarization
- Update all localization files with new preference text
- Implement preference check in message display script
- Add default preference setting in options configuration
- Include preference toggle in options UI

This adds a user-configurable option to automatically generate and display AI summaries when viewing email messages, with appropriate warnings about data transmission to AI services.
This commit is contained in:
Ronald Klarenbeek 2025-12-26 22:20:13 +01:00
parent 0f08fe883b
commit dc7c16a4e0
14 changed files with 180 additions and 0 deletions

View file

@ -1130,5 +1130,11 @@
}, },
"prefs_OptionText_get_calendar_event_Sparks_wrong_version": { "prefs_OptionText_get_calendar_event_Sparks_wrong_version": {
"message": "Pro používání funkcí událostí v kalendáři a úloh, nainstalujte aktualizovanou verzi doplňku ThunderAI Sparks." "message": "Pro používání funkcí událostí v kalendáři a úloh, nainstalujte aktualizovanou verzi doplňku ThunderAI Sparks."
},
"prefs_OptionText_auto_summary": {
"message": "Povolit automatické AI shrnutí pro náhledy zpráv"
},
"prefs_OptionText_auto_summary_Info": {
"message": "Pokud je zaškrtnuto, ThunderAI automaticky vygeneruje a zobrazí AI shrnutí nad e-mailovými zprávami, když jsou otevřeny. Mějte na paměti, že to znamená, že všechny zprávy, které si prohlížíte, budou okamžitě odeslány do nakonfigurované AI služby."
} }
} }

View file

@ -1303,4 +1303,29 @@
"prefs_anthropic_temperature_Info": { "prefs_anthropic_temperature_Info": {
"message": "Grad der Zufälligkeit in der Antwort. Der Standardwert ist 1,0. Der Bereich liegt zwischen 0,0 und 1,0. Verwenden Sie eine Temperatur näher an 0,0 für analytische Aufgaben oder Multiple-Choice-Fragen und näher an 1,0 für kreative und generative Aufgaben. Beachten Sie, dass die Ergebnisse selbst bei einer Temperatur von 0,0 nicht vollständig deterministisch sind." "message": "Grad der Zufälligkeit in der Antwort. Der Standardwert ist 1,0. Der Bereich liegt zwischen 0,0 und 1,0. Verwenden Sie eine Temperatur näher an 0,0 für analytische Aufgaben oder Multiple-Choice-Fragen und näher an 1,0 für kreative und generative Aufgaben. Beachten Sie, dass die Ergebnisse selbst bei einer Temperatur von 0,0 nicht vollständig deterministisch sind."
} }
},
"customPrompts_export_include_api_settings": {
"message": "Do you want to include the API settings in the export? Be aware that also the API Key will be saved in the file!",
"description": ""
},
"prefs_OptionText_auto_summary": {
"message": "Enable automatic AI summarization for message previews",
"description": ""
},
"prefs_OptionText_auto_summary_Info": {
"message": "If checked, ThunderAI will automatically generate and display AI summaries above email messages when they are opened. Note that this means all messages you preview will immediately be sent to the configured AI service.",
"description": ""
},
"auto_summary_title": {
"message": "AI Summary",
"description": ""
},
"auto_summary_generating": {
"message": "Generating summary...",
"description": ""
},
"auto_summary_failed": {
"message": "Failed to generate summary",
"description": ""
}
} }

View file

@ -1808,5 +1808,25 @@
"customPrompts_export_include_api_settings": { "customPrompts_export_include_api_settings": {
"message": "Do you want to include the API settings in the export? Be aware that also the API Key will be saved in the file!", "message": "Do you want to include the API settings in the export? Be aware that also the API Key will be saved in the file!",
"description": "" "description": ""
},
"prefs_OptionText_auto_summary": {
"message": "Enable automatic AI summarization for message previews",
"description": ""
},
"prefs_OptionText_auto_summary_Info": {
"message": "If checked, ThunderAI will automatically generate and display AI summaries above email messages when they are opened. Note that this means all messages you preview will immediately be sent to the configured AI service.",
"description": ""
},
"auto_summary_title": {
"message": "AI Summary",
"description": ""
},
"auto_summary_generating": {
"message": "Generating summary...",
"description": ""
},
"auto_summary_failed": {
"message": "Failed to generate summary",
"description": ""
} }
} }

View file

@ -1287,4 +1287,29 @@
"reset": { "reset": {
"message": "Reiniciar" "message": "Reiniciar"
} }
},
"customPrompts_export_include_api_settings": {
"message": "Do you want to include the API settings in the export? Be aware that also the API Key will be saved in the file!",
"description": ""
},
"prefs_OptionText_auto_summary": {
"message": "Enable automatic AI summarization for message previews",
"description": ""
},
"prefs_OptionText_auto_summary_Info": {
"message": "If checked, ThunderAI will automatically generate and display AI summaries above email messages when they are opened. Note that this means all messages you preview will immediately be sent to the configured AI service.",
"description": ""
},
"auto_summary_title": {
"message": "AI Summary",
"description": ""
},
"auto_summary_generating": {
"message": "Generating summary...",
"description": ""
},
"auto_summary_failed": {
"message": "Failed to generate summary",
"description": ""
}
} }

View file

@ -1303,4 +1303,29 @@
"reset": { "reset": {
"message": "Réinitialiser" "message": "Réinitialiser"
} }
},
"customPrompts_export_include_api_settings": {
"message": "Do you want to include the API settings in the export? Be aware that also the API Key will be saved in the file!",
"description": ""
},
"prefs_OptionText_auto_summary": {
"message": "Enable automatic AI summarization for message previews",
"description": ""
},
"prefs_OptionText_auto_summary_Info": {
"message": "If checked, ThunderAI will automatically generate and display AI summaries above email messages when they are opened. Note that this means all messages you preview will immediately be sent to the configured AI service.",
"description": ""
},
"auto_summary_title": {
"message": "AI Summary",
"description": ""
},
"auto_summary_generating": {
"message": "Generating summary...",
"description": ""
},
"auto_summary_failed": {
"message": "Failed to generate summary",
"description": ""
}
} }

View file

@ -1303,4 +1303,29 @@
"prefs_anthropic_temperature_Info": { "prefs_anthropic_temperature_Info": {
"message": "Quantità di casualità iniettata nella risposta. Il valore predefinito è 1,0. L'intervallo va da 0,0 a 1,0. Utilizza una temperatura più vicina a 0,0 per compiti analitici o a scelta multipla, e più vicina a 1,0 per compiti creativi e generativi. Nota che, anche con una temperatura di 0,0, i risultati non saranno completamente deterministici." "message": "Quantità di casualità iniettata nella risposta. Il valore predefinito è 1,0. L'intervallo va da 0,0 a 1,0. Utilizza una temperatura più vicina a 0,0 per compiti analitici o a scelta multipla, e più vicina a 1,0 per compiti creativi e generativi. Nota che, anche con una temperatura di 0,0, i risultati non saranno completamente deterministici."
} }
},
"customPrompts_export_include_api_settings": {
"message": "Do you want to include the API settings in the export? Be aware that also the API Key will be saved in the file!",
"description": ""
},
"prefs_OptionText_auto_summary": {
"message": "Enable automatic AI summarization for message previews",
"description": ""
},
"prefs_OptionText_auto_summary_Info": {
"message": "If checked, ThunderAI will automatically generate and display AI summaries above email messages when they are opened. Note that this means all messages you preview will immediately be sent to the configured AI service.",
"description": ""
},
"auto_summary_title": {
"message": "AI Summary",
"description": ""
},
"auto_summary_generating": {
"message": "Generating summary...",
"description": ""
},
"auto_summary_failed": {
"message": "Failed to generate summary",
"description": ""
}
} }

View file

@ -890,5 +890,13 @@
}, },
"placeholder_selected_html": { "placeholder_selected_html": {
"message": "Zaznaczony HTML" "message": "Zaznaczony HTML"
},
"prefs_OptionText_auto_summary": {
"message": "Włącz automatyczne podsumowanie AI dla podglądów wiadomości",
"description": ""
},
"prefs_OptionText_auto_summary_Info": {
"message": "Jeśli zaznaczone, ThunderAI automatycznie wygeneruje i wyświetli podsumowania AI nad wiadomościami e-mail, gdy zostaną otwarte. Pamiętaj, że oznacza to, że wszystkie wiadomości, które przeglądasz, zostaną natychmiast wysłane do skonfigurowanej usługi AI.",
"description": ""
} }
} }

View file

@ -836,5 +836,11 @@
}, },
"SpamFilter_PageTitle": { "SpamFilter_PageTitle": {
"message": "Gerenciar configurações do filtro de spam" "message": "Gerenciar configurações do filtro de spam"
},
"prefs_OptionText_auto_summary": {
"message": "Mostrar resumo automático na visualização de mensagens"
},
"prefs_OptionText_auto_summary_Info": {
"message": "Se marcado, um resumo gerado por IA será exibido automaticamente acima das mensagens na visualização."
} }
} }

View file

@ -172,5 +172,13 @@
}, },
"chatgpt_win_send": { "chatgpt_win_send": {
"message": "Enviar" "message": "Enviar"
},
"prefs_OptionText_auto_summary": {
"message": "Ativar resumo automático de IA para pré-visualizações de mensagens",
"description": ""
},
"prefs_OptionText_auto_summary_Info": {
"message": "Se ativado, o ThunderAI gerará e mostrará automaticamente resumos de IA acima das mensagens de e-mail quando forem abertas. Note que isso significa que todas as mensagens que você visualizar serão enviadas imediatamente para o serviço de IA configurado.",
"description": ""
} }
} }

View file

@ -1205,5 +1205,11 @@
}, },
"OpenAIComp_ClearModelsList_Confirm": { "OpenAIComp_ClearModelsList_Confirm": {
"message": "Вы уверены, что хотите очистить список моделей? Это действие не может быть отменено." "message": "Вы уверены, что хотите очистить список моделей? Это действие не может быть отменено."
},
"prefs_OptionText_auto_summary": {
"message": "Показывать автоматическое резюме в просмотре сообщений"
},
"prefs_OptionText_auto_summary_Info": {
"message": "Если отмечено, резюме, сгенерированное ИИ, будет автоматически отображаться над сообщениями в просмотре."
} }
} }

View file

@ -889,5 +889,11 @@
}, },
"customPrompts_form_label_use_diff_viewer_title": { "customPrompts_form_label_use_diff_viewer_title": {
"message": "当操作设置为“替换文本”时,可以选择差异查看器。" "message": "当操作设置为“替换文本”时,可以选择差异查看器。"
},
"prefs_OptionText_auto_summary": {
"message": "在消息预览中显示自动摘要"
},
"prefs_OptionText_auto_summary_Info": {
"message": "如果选中AI生成的摘要将自动显示在消息预览上方。"
} }
} }

View file

@ -1,4 +1,12 @@
async function showSummaryPane() { async function showSummaryPane() {
// Check if auto-summary is enabled in user preferences
const result = await browser.storage.sync.get('auto_summary_enabled');
// If auto-summary is disabled or not set, don't show anything
if (!result.auto_summary_enabled) {
return;
}
// Create the summary pane element // Create the summary pane element
const summaryPane = document.createElement("div"); const summaryPane = document.createElement("div");
summaryPane.className = "thunderai-summary-pane"; summaryPane.className = "thunderai-summary-pane";

View file

@ -132,5 +132,6 @@ export const prefs_default = {
spamfilter_threshold: 70, spamfilter_threshold: 70,
spamfilter_enabled_accounts: [], spamfilter_enabled_accounts: [],
summarize: false, summarize: false,
auto_summary_enabled: false,
...generated_prefs ...generated_prefs
} }

View file

@ -125,6 +125,17 @@
</label> </label>
</td> </td>
</tr> </tr>
<tr>
<td style="width:20em"><label>
<span class="opt_title">__MSG_prefs_OptionText_auto_summary__</span>
</label></td>
<td>
<label>
<input type="checkbox" id="auto_summary_enabled" name="auto_summary_enabled" class="option-input" />
&nbsp;<span>__MSG_prefs_OptionText_auto_summary_Info__</span>
</label>
</td>
</tr>
<tr class="add_tags_tr"> <tr class="add_tags_tr">
<td><span class="opt_title">__MSG_prefs_OptionText_add_tags__</span> <td><span class="opt_title">__MSG_prefs_OptionText_add_tags__</span>
<br><button id="btnManageTagsInfo" class="btn_small">__MSG_prefs_OptionText_btnManageTagsInfo__</button></td> <br><button id="btnManageTagsInfo" class="btn_small">__MSG_prefs_OptionText_btnManageTagsInfo__</button></td>