From 8692a40217e8483f64458b3aac53bc90feb267b0 Mon Sep 17 00:00:00 2001 From: mic Date: Fri, 10 Jan 2025 22:53:49 +0100 Subject: [PATCH 01/38] prompt_get_calitem special prompt added --- _locales/en/messages.json | 8 ++++++++ js/mzta-prompts.js | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index da85f92e..e99fed29 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -954,5 +954,13 @@ "placeholder_mail_typed_text": { "message": "Typed text before the quoted mail body", "description": "" + }, + "prompt_get_calitem": { + "message": "Add a new calendar event", + "description": "" + }, + "prompt_get_calitem_full_text": { + "message": "Extract all relevant details required to generate an iCalendar (iCal) file from the following text. The extracted information should include:\n- Event Title\n- Start Date and Time (including timezone, if specified)\n- End Date and Time (including timezone, if specified)\n- Location (if available)\n- Description or Additional Notes (if available)\n- Organizer's Name and Contact Details (if available)\n- Recurrence Rules (if mentioned)\nEnsure the data is formatted clearly and consistently so that it can be directly used for creating an iCal file. Highlight any missing or ambiguous details that might require clarification. Here's the text:\"{%selected_text%}\"", + "description": "" } } \ No newline at end of file diff --git a/js/mzta-prompts.js b/js/mzta-prompts.js index 636efdf9..9481d964 100644 --- a/js/mzta-prompts.js +++ b/js/mzta-prompts.js @@ -182,6 +182,19 @@ const specialPrompts = [ is_default: "1", is_special: "1", }, + { + id: 'prompt_get_calitem', + name: "__MSG_prompt_get_calitem__", + text: "prompt_get_calitem_full_text", + type: "1", + action: "0", + need_selected: "1", + need_signature: "0", + need_custom_text: "0", + define_response_lang: "0", + is_default: "1", + is_special: "1", + }, ]; From 5a412dc7c52b46b115c3008a0d7bad0a088311f0 Mon Sep 17 00:00:00 2001 From: mic Date: Fri, 10 Jan 2025 23:02:11 +0100 Subject: [PATCH 02/38] correctly hiding tags rows when using chatgpt web --- options/mzta-options.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/options/mzta-options.js b/options/mzta-options.js index 21f6a50c..0b58f657 100644 --- a/options/mzta-options.js +++ b/options/mzta-options.js @@ -252,6 +252,8 @@ function disable_MaxPromptLength(){ function disable_AddTags(){ let add_tags = document.getElementById('add_tags'); + let conntype_select = document.getElementById("connection_type"); + add_tags.disabled = (conntype_select.value === "chatgpt_web"); let add_tags_tr_elements = document.querySelectorAll('.add_tags_tr'); add_tags_tr_elements.forEach(add_tags_tr => { add_tags_tr.style.display = (add_tags.disabled) ? 'none' : 'table-row'; @@ -332,6 +334,7 @@ document.addEventListener('DOMContentLoaded', async () => { conntype_select.addEventListener("change", warn_Ollama_HostEmpty); conntype_select.addEventListener("change", warn_OpenAIComp_HostEmpty); conntype_select.addEventListener("change", warn_GoogleGemini_APIKeyEmpty); + conntype_select.addEventListener("change", disable_AddTags); document.getElementById("chatgpt_api_key").addEventListener("change", warn_ChatGPT_APIKeyEmpty); document.getElementById("ollama_host").addEventListener("change", warn_Ollama_HostEmpty); document.getElementById("openai_comp_host").addEventListener("change", warn_OpenAIComp_HostEmpty); From 1af7a18a84ec5487e2858e65fcaefe72898f6793 Mon Sep 17 00:00:00 2001 From: mic Date: Fri, 10 Jan 2025 23:12:57 +0100 Subject: [PATCH 03/38] get calendar event special prompt renamed --- js/mzta-prompts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/mzta-prompts.js b/js/mzta-prompts.js index 9481d964..16d5fd26 100644 --- a/js/mzta-prompts.js +++ b/js/mzta-prompts.js @@ -183,9 +183,9 @@ const specialPrompts = [ is_special: "1", }, { - id: 'prompt_get_calitem', - name: "__MSG_prompt_get_calitem__", - text: "prompt_get_calitem_full_text", + id: 'prompt_get_calendar_event', + name: "__MSG_prompt_get_calendar_event__", + text: "prompt_get_calendar_event_full_text", type: "1", action: "0", need_selected: "1", From a03c11794a1e7973fa087bf0e1efa648a9c33e9d Mon Sep 17 00:00:00 2001 From: mic Date: Fri, 10 Jan 2025 23:13:54 +0100 Subject: [PATCH 04/38] get_calendar_event added in the options page. see micz/ThunderAI/#182 --- _locales/en/messages.json | 16 ++++++++++++++-- options/mzta-options-default.js | 1 + options/mzta-options.html | 11 +++++++++++ options/mzta-options.js | 20 ++++++++++++++++++++ popup/mzta-popup.css | 4 ++-- 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index e99fed29..a7dd77f1 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -955,12 +955,24 @@ "message": "Typed text before the quoted mail body", "description": "" }, - "prompt_get_calitem": { + "prompt_get_calendar_event": { "message": "Add a new calendar event", "description": "" }, - "prompt_get_calitem_full_text": { + "prompt_get_calendar_event_full_text": { "message": "Extract all relevant details required to generate an iCalendar (iCal) file from the following text. The extracted information should include:\n- Event Title\n- Start Date and Time (including timezone, if specified)\n- End Date and Time (including timezone, if specified)\n- Location (if available)\n- Description or Additional Notes (if available)\n- Organizer's Name and Contact Details (if available)\n- Recurrence Rules (if mentioned)\nEnsure the data is formatted clearly and consistently so that it can be directly used for creating an iCal file. Highlight any missing or ambiguous details that might require clarification. Here's the text:\"{%selected_text%}\"", "description": "" + }, + "prefs_OptionText_get_calendar_event": { + "message": "Add a new calendar event from selected text", + "description": "" + }, + "prefs_OptionText_get_calendar_event_Info": { + "message": "If checked, an item will be included in the menu to get a calendar event information from selected text.", + "description": "" + }, + "prefs_OptionText_btnManageCalendarEventInfo": { + "message": "Manage calendar event settings", + "description": "" } } \ No newline at end of file diff --git a/options/mzta-options-default.js b/options/mzta-options-default.js index 36f70640..10e08fe6 100644 --- a/options/mzta-options-default.js +++ b/options/mzta-options-default.js @@ -46,4 +46,5 @@ export const prefs_default = { add_tags_hide_exclusions: false, add_tags_first_uppercase: true, add_tags_force_lang: true, + get_calendar_event: true, } \ No newline at end of file diff --git a/options/mzta-options.html b/options/mzta-options.html index 76e99676..709ad7eb 100644 --- a/options/mzta-options.html +++ b/options/mzta-options.html @@ -334,6 +334,17 @@ + + + __MSG_prefs_OptionText_get_calendar_event__ +
+ + + + - __MSG_prefs_OptionText_get_calendar_event__
From decb529cb0a74779282fc09550b2a7ad291eecb3 Mon Sep 17 00:00:00 2001 From: mic Date: Sat, 11 Jan 2025 23:09:48 +0100 Subject: [PATCH 18/38] showing a warning message if sparks is not present. see #182 --- _locales/en/messages.json | 8 ++++++++ options/mzta-options.css | 9 +++++++++ options/mzta-options.html | 6 ++++++ options/mzta-options.js | 9 ++++++--- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index fab877f8..bc62e80a 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -990,5 +990,13 @@ "prefs_OptionText_GetCalendarEvent_infoline2": { "message": "You can change the prompt as you wish, but the response received from the AI must be in JSON format as specified in the default prompt!", "description": "" + }, + "prefs_OptionText_get_calendar_event_Sparks_not_present": { + "message": "To use the calendar event feature, please install the ThunderAI Sparks addon.", + "description": "" + }, + "prefs_OptionText_download_now": { + "message": "Download ThunderAI Sparks now!", + "description": "" } } \ No newline at end of file diff --git a/options/mzta-options.css b/options/mzta-options.css index e3680a08..a34037e3 100644 --- a/options/mzta-options.css +++ b/options/mzta-options.css @@ -118,6 +118,12 @@ tr.conntype_google_gemini_api, tr.conntype_google_gemini_api2{ font-style: italic; } +#no_sparks td{ + text-align: center; + padding: 1em !important; + background: #bbf7f1; +} + textarea.option-textarea{ width: -moz-available; height: 10em; @@ -244,4 +250,7 @@ input.option-input[type="text"]{ background-color: rgb(2, 0, 100); } + #no_sparks td{ + background: #3b514f; + } } \ No newline at end of file diff --git a/options/mzta-options.html b/options/mzta-options.html index 1214b676..8cd6443e 100644 --- a/options/mzta-options.html +++ b/options/mzta-options.html @@ -344,6 +344,12 @@ + + + __MSG_prefs_OptionText_get_calendar_event_Sparks_not_present__ +
__MSG_prefs_OptionText_download_now__ + +