showing the current prompt name in the chatgpt window. fixes #20
This commit is contained in:
parent
e899d76f69
commit
dc2f581c7e
7 changed files with 31 additions and 6 deletions
|
|
@ -378,5 +378,9 @@
|
||||||
"importPrompts_invalidPrompts": {
|
"importPrompts_invalidPrompts": {
|
||||||
"message": "Die Datei, die Sie importieren möchten, enthält keine gültigen Prompts.",
|
"message": "Die Datei, die Sie importieren möchten, enthält keine gültigen Prompts.",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"currently_used_prompt": {
|
||||||
|
"message": "Derzeit verwendeter Prompt-Name",
|
||||||
|
"description": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -378,5 +378,9 @@
|
||||||
"importPrompts_invalidPrompts": {
|
"importPrompts_invalidPrompts": {
|
||||||
"message": "The file you're trying to import does not contain any valid prompts.",
|
"message": "The file you're trying to import does not contain any valid prompts.",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"currently_used_prompt": {
|
||||||
|
"message": "Currently used prompt name",
|
||||||
|
"description": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -378,5 +378,9 @@
|
||||||
"importPrompts_invalidPrompts": {
|
"importPrompts_invalidPrompts": {
|
||||||
"message": "Le fichier que vous essayez d'importer ne contient aucune prompt valide.",
|
"message": "Le fichier que vous essayez d'importer ne contient aucune prompt valide.",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"currently_used_prompt": {
|
||||||
|
"message": "Nom du prompt actuellement utilisé",
|
||||||
|
"description": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -378,5 +378,9 @@
|
||||||
"importPrompts_invalidPrompts": {
|
"importPrompts_invalidPrompts": {
|
||||||
"message": "Il file che stai cercando di importare non contiene alcun prompt valido.",
|
"message": "Il file che stai cercando di importare non contiene alcun prompt valido.",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"currently_used_prompt": {
|
||||||
|
"message": "Nome del prompt attualmente utilizzato",
|
||||||
|
"description": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -155,6 +155,7 @@ function addCustomDiv(prompt_action,tabId,mailMessageId) {
|
||||||
style.textContent += "#mzta-custom_loading{height:50px;display:none;}";
|
style.textContent += "#mzta-custom_loading{height:50px;display:none;}";
|
||||||
style.textContent += "#mzta-custom_textarea{color:black;padding:1px;font-size:15px;width:100%;}";
|
style.textContent += "#mzta-custom_textarea{color:black;padding:1px;font-size:15px;width:100%;}";
|
||||||
style.textContent += "#mzta-custom_info{text-align:center;width:100%;padding-bottom:10px;font-size:15px;}";
|
style.textContent += "#mzta-custom_info{text-align:center;width:100%;padding-bottom:10px;font-size:15px;}";
|
||||||
|
style.textContent += "#mzta-prompt-name{font-size:13px;font-style:italic;color:#919191;position:fixed;bottom:75px;;left:0;padding-left:5px;}";
|
||||||
|
|
||||||
// Add <style> to the page's <head>
|
// Add <style> to the page's <head>
|
||||||
document.head.appendChild(style);
|
document.head.appendChild(style);
|
||||||
|
|
@ -180,6 +181,13 @@ function addCustomDiv(prompt_action,tabId,mailMessageId) {
|
||||||
};
|
};
|
||||||
modelWarnDiv.appendChild(btn_gpt35);
|
modelWarnDiv.appendChild(btn_gpt35);
|
||||||
|
|
||||||
|
//prompt name
|
||||||
|
var prompt_name_div = document.createElement('div');
|
||||||
|
prompt_name_div.id = 'mzta-prompt-name';
|
||||||
|
prompt_name_div.title= browser.i18n.getMessage("currently_used_prompt");
|
||||||
|
prompt_name_div.textContent = mztaPromptName;
|
||||||
|
fixedDiv.appendChild(prompt_name_div);
|
||||||
|
|
||||||
//status page
|
//status page
|
||||||
var status_page_div = document.createElement('div');
|
var status_page_div = document.createElement('div');
|
||||||
status_page_div.id = 'mzta-status-page';
|
status_page_div.id = 'mzta-status-page';
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ export class mzta_Menus {
|
||||||
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
const tabs = await browser.tabs.query({ active: true, currentWindow: true });
|
||||||
// add custom text if needed
|
// add custom text if needed
|
||||||
//browser.runtime.sendMessage({command: "chatgpt_open", prompt: fullPrompt, action: curr_prompt.action, tabId: tabs[0].id});
|
//browser.runtime.sendMessage({command: "chatgpt_open", prompt: fullPrompt, action: curr_prompt.action, tabId: tabs[0].id});
|
||||||
this.openChatGPT(fullPrompt, curr_prompt.action, tabs[0].id, curr_prompt.need_custom_text);
|
this.openChatGPT(fullPrompt, curr_prompt.action, tabs[0].id, curr_prompt.name, curr_prompt.need_custom_text);
|
||||||
};
|
};
|
||||||
this.rootMenu.push(curr_menu_entry);
|
this.rootMenu.push(curr_menu_entry);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
import { mzta_script } from './js/mzta-chatgpt.js';
|
import { mzta_script } from './js/mzta-chatgpt.js';
|
||||||
import { prefs_default } from './options/mzta-options-default.js';
|
import { prefs_default } from './options/mzta-options-default.js';
|
||||||
import { mzta_Menus } from './js/mzta-menus.js';
|
import { mzta_Menus } from './js/mzta-menus.js';
|
||||||
import { getCurrentIdentity, getOriginalBody, replaceBody, setBody } from './js/mzta-utils.js';
|
import { getCurrentIdentity, getOriginalBody, replaceBody, setBody, i18nConditionalGet } from './js/mzta-utils.js';
|
||||||
|
|
||||||
var createdWindowID = null;
|
var createdWindowID = null;
|
||||||
var original_html = '';
|
var original_html = '';
|
||||||
|
|
@ -50,9 +50,9 @@ messenger.runtime.onMessage.addListener(async (message, sender, sendResponse) =>
|
||||||
// handler function.
|
// handler function.
|
||||||
if (message && message.hasOwnProperty("command")){
|
if (message && message.hasOwnProperty("command")){
|
||||||
switch (message.command) {
|
switch (message.command) {
|
||||||
case 'chatgpt_open':
|
// case 'chatgpt_open':
|
||||||
openChatGPT(message.prompt,message.action,message.tabId);
|
// openChatGPT(message.prompt,message.action,message.tabId);
|
||||||
return true;
|
// return true;
|
||||||
case 'chatgpt_close':
|
case 'chatgpt_close':
|
||||||
browser.windows.remove(createdWindowID).then(() => {
|
browser.windows.remove(createdWindowID).then(() => {
|
||||||
console.log("[ThunderAI] ChatGPT window closed successfully.");
|
console.log("[ThunderAI] ChatGPT window closed successfully.");
|
||||||
|
|
@ -136,7 +136,7 @@ messenger.runtime.onMessage.addListener(async (message, sender, sendResponse) =>
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
async function openChatGPT(promptText, action, curr_tabId, do_custom_text = 0) {
|
async function openChatGPT(promptText, action, curr_tabId, prompt_name = '', do_custom_text = 0) {
|
||||||
let prefs = await browser.storage.sync.get(prefs_default);
|
let prefs = await browser.storage.sync.get(prefs_default);
|
||||||
prefs = checkScreenDimensions(prefs);
|
prefs = checkScreenDimensions(prefs);
|
||||||
//console.log(">>>>>>>>>>>>>>>> prefs: " + JSON.stringify(prefs));
|
//console.log(">>>>>>>>>>>>>>>> prefs: " + JSON.stringify(prefs));
|
||||||
|
|
@ -181,6 +181,7 @@ async function openChatGPT(promptText, action, curr_tabId, do_custom_text = 0) {
|
||||||
let mztaForceCompletionTitle="`+ browser.i18n.getMessage("chatgpt_force_completion_title") +`";
|
let mztaForceCompletionTitle="`+ browser.i18n.getMessage("chatgpt_force_completion_title") +`";
|
||||||
let mztaDoCustomText=`+ do_custom_text +`;
|
let mztaDoCustomText=`+ do_custom_text +`;
|
||||||
let mztaKeepFormatting=`+ prefs.chatgpt_keep_formatting +`;
|
let mztaKeepFormatting=`+ prefs.chatgpt_keep_formatting +`;
|
||||||
|
let mztaPromptName="[`+ i18nConditionalGet(prompt_name) +`]";
|
||||||
`;
|
`;
|
||||||
|
|
||||||
browser.tabs.executeScript(createdTab.id, { code: pre_script + mzta_script, matchAboutBlank: false })
|
browser.tabs.executeScript(createdTab.id, { code: pre_script + mzta_script, matchAboutBlank: false })
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue