From 501fdaa4a13801f756754ab05ce1f8ffd9c7aab3 Mon Sep 17 00:00:00 2001 From: informaticker Date: Thu, 24 Oct 2024 22:50:14 +0200 Subject: [PATCH] v1.3 --- src/content.js | 14 ++++++++++++-- src/popup.html | 23 ++++++++++++++--------- src/popup.js | 3 +++ 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/src/content.js b/src/content.js index 29e81fa..a414bc2 100644 --- a/src/content.js +++ b/src/content.js @@ -4,6 +4,7 @@ const DEFAULT_SETTINGS = { apiKey: "sk-TvFhtxHAPXEcmRtyva-ctA", textOpacity: 10, model: "llama3.2-90b", + background: false, }; const MAX_CONTEXT_LENGTH = 6000; @@ -49,7 +50,7 @@ const queryLLM = async (text) => { messages: [ { role: "user", - content: `You are tasked to solve an exam. Exam's page context: ${pageContext}\n\Answer this question of said exam in very short but accurate manner (Utilize context to figure out the exam's topic. ONLY REPLY WITH ANSWER TO THE QUESTION): ${text}`, + content: `You are tasked to solve an exam. It is a website. Exam's page context: ${pageContext}\n\Answer this question of said exam in a very short but accurate manner (Utilize context to figure out the exam's topic. ONLY REPLY WITH ANSWER TO THE QUESTION. If you do not know, reply with "I do not know."): ${text}`, }, ], temperature: 0.1, @@ -80,10 +81,19 @@ const createOverlay = (text) => { padding: 5px; z-index: 2147483647; color: rgba(0, 0, 0, ${settings.textOpacity / 100}); - font-size: 16px; + font-size: 12px; max-width: 600px; white-space: pre-wrap; pointer-events: none; + ${ + settings.background + ? ` + background-color: rgba(255, 255, 255, ${settings.textOpacity / 100}); + border-radius: 8px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); + ` + : "" + } `; document.body.appendChild(overlay); diff --git a/src/popup.html b/src/popup.html index 004edbe..e6f8bfd 100644 --- a/src/popup.html +++ b/src/popup.html @@ -224,7 +224,7 @@
- +
+
+ +
+
- Solve Question + Process Question
- - - U + Ctrl + Space
- Fill Answer + Process to text field
- - - 7 + Ctrl + Shift + Space
diff --git a/src/popup.js b/src/popup.js index 514f62f..f51f868 100644 --- a/src/popup.js +++ b/src/popup.js @@ -3,6 +3,7 @@ const DEFAULT_SETTINGS = { apiKey: "sk-TvFhtxHAPXEcmRtyva-ctA", textOpacity: 10, model: "llama3.2-90b", + background: false, }; // Load settings when the popup opens @@ -17,6 +18,7 @@ document.addEventListener("DOMContentLoaded", async () => { document.getElementById("textOpacity").value = settings.textOpacity; document.getElementById("opacityValue").textContent = `${settings.textOpacity}%`; + document.getElementById("background").checked = settings.background; } catch (error) { console.error("Error loading settings:", error); showStatus("Error loading settings", "error"); @@ -39,6 +41,7 @@ document apiKey: document.getElementById("apiKey").value, model: document.getElementById("model").value, textOpacity: parseInt(document.getElementById("textOpacity").value), + background: document.getElementById("background").checked, }; try {