diff --git a/README.md b/README.md index 7e4d1b9..ba6cd9c 100644 --- a/README.md +++ b/README.md @@ -19,13 +19,13 @@ The plugin can be configured by clicking the plugin button in the Chrome toolbar These are the tools that are currently available: ### Auto-complete -Select a text and press `Alt+c` to trigger the auto-complete tool. +Select a text and press `Alt+C` to trigger the auto-complete tool. ### Improve -Select a text and press `Alt+i` to trigger the improvement tool. The original text will be commented out and the improved text will be inserted below it. +Select a text and press `Alt+I` to trigger the improvement tool. The original text will be commented out and the improved text will be inserted below it. ### Ask -Select a text and press `Alt+a` to trigger the ask tool. The original text will be deleted and the answer will be inserted in its place. +Select a text and press `Alt+A` to trigger the ask tool. The original text will be deleted and the answer will be inserted in its place. For example: "Create a table 4x3 that the first row is bold face" will be replaced with, e.g.,: ```latex diff --git a/manifest.json b/manifest.json index 68f1f9b..25055c3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "action": { "default_popup": "popup/popup.html", - "default_icon": "popup/icon.png" + "default_icon": "popup/LeafLLM.png" }, "content_scripts": [ { @@ -11,9 +11,9 @@ ], "description": "LLM-based tools for Overleaf", "icons": { - "16": "popup/icon_16.png", - "48": "popup/icon_48.png", - "128": "popup/icon_128.png" + "16": "popup/LeafLLM_16.png", + "48": "popup/LeafLLM_48.png", + "128": "popup/LeafLLM_128.png" }, "commands": { "Complete": { diff --git a/popup/Leaf.png b/popup/Leaf.png new file mode 100644 index 0000000..722a189 Binary files /dev/null and b/popup/Leaf.png differ diff --git a/popup/LeafLLM.xcf b/popup/LeafLLM.xcf new file mode 100644 index 0000000..51fa59f Binary files /dev/null and b/popup/LeafLLM.xcf differ diff --git a/popup/LeafLLM_128.png b/popup/LeafLLM_128.png new file mode 100644 index 0000000..e187876 Binary files /dev/null and b/popup/LeafLLM_128.png differ diff --git a/popup/LeafLLM_16.png b/popup/LeafLLM_16.png new file mode 100644 index 0000000..cf68619 Binary files /dev/null and b/popup/LeafLLM_16.png differ diff --git a/popup/LeafLLM_48.png b/popup/LeafLLM_48.png new file mode 100644 index 0000000..fff3702 Binary files /dev/null and b/popup/LeafLLM_48.png differ diff --git a/popup/icon.png b/popup/icon.png deleted file mode 100644 index c87f8a7..0000000 Binary files a/popup/icon.png and /dev/null differ diff --git a/popup/icon_128.png b/popup/icon_128.png deleted file mode 100644 index d4952ba..0000000 Binary files a/popup/icon_128.png and /dev/null differ diff --git a/popup/icon_16.png b/popup/icon_16.png deleted file mode 100644 index 0fca9a7..0000000 Binary files a/popup/icon_16.png and /dev/null differ diff --git a/popup/icon_48.png b/popup/icon_48.png deleted file mode 100644 index 24cbc0d..0000000 Binary files a/popup/icon_48.png and /dev/null differ diff --git a/scripts/content.js b/scripts/content.js index c789420..b3b2007 100644 --- a/scripts/content.js +++ b/scripts/content.js @@ -90,7 +90,7 @@ function commentText(text) { } async function improveTextHandler(openAI) { - if (!(await settingIsEnabled('textImprovement'))) return + if (!(await settingIsEnabled('textImprovement'))) throw new Error('Text improvement is not enabled.') const selection = window.getSelection() const selectedText = selection.toString() if (!selectedText) return @@ -100,7 +100,7 @@ async function improveTextHandler(openAI) { } async function completeTextHandler(openAI) { - if (!(await settingIsEnabled('textCompletion'))) return + if (!(await settingIsEnabled('textCompletion'))) throw new Error('Text completion is not enabled.') const selection = window.getSelection() const selectedText = selection.toString() if (!selectedText) return @@ -109,7 +109,7 @@ async function completeTextHandler(openAI) { } async function askHandler(openAI) { - if (!(await settingIsEnabled('textAsk'))) return + if (!(await settingIsEnabled('textAsk'))) throw new Error('Text ask is not enabled.') const selection = window.getSelection() const selectedText = selection.toString() if (!selectedText) return @@ -129,21 +129,20 @@ function setAPIKey(key) { currentAPIKey = key if (currentAPIKey) { openAI = new OpenAIAPI(currentAPIKey) - console.log('AI4Overleaf: OpenAI API key set, enabling AI4Overleaf features.') + console.log('LeafLLM: OpenAI API key set, enabling LeafLLM features.') } else { openAI = undefined - console.log('AI4Overleaf: OpenAI API key is not set, AI4Overleaf features are disabled.') + console.log('LeafLLM: OpenAI API key is not set, LeafLLM features are disabled.') } } function handleCommand(command) { - console.log('Handling command') if (command === 'Improve') { - improveTextHandler(openAI) + improveTextHandler(openAI).catch(e => console.error(`Failed to execute the '${command}' command. Error message: ${e}`)) } else if (command === 'Complete') { - completeTextHandler(openAI) + completeTextHandler(openAI).catch(e => console.error(`Failed to execute the '${command}' command. Error message: ${e}`)) } else if (command === 'Ask') { - askHandler(openAI) + askHandler(openAI).catch(e => console.error(`Failed to execute the '${command}' command. Error message: ${e}`)) } }