{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":796369390,"defaultBranch":"main","name":"IsraReplyGPT","ownerLogin":"TheSnowGuru","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2024-05-05T18:28:25.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/5313475?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1715175755.0","currentOid":""},"activityList":{"items":[{"before":"0e07524dd9ef2f65771debd8bbbfce5234484b38","after":"352c71e9a23ad361d1a4820aa2f628c8099bd61a","ref":"refs/heads/main","pushedAt":"2024-05-09T14:58:18.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"update img","shortMessageHtmlLink":"update img"}},{"before":"98dc1e956dc065dab8941f4234dae01086f49e3e","after":"0e07524dd9ef2f65771debd8bbbfce5234484b38","ref":"refs/heads/main","pushedAt":"2024-05-09T14:55:57.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"update readme","shortMessageHtmlLink":"update readme"}},{"before":"e7dfbea4b4c4237d5eb75467ca780e3e1cd740a8","after":"98dc1e956dc065dab8941f4234dae01086f49e3e","ref":"refs/heads/main","pushedAt":"2024-05-09T14:26:36.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"add images","shortMessageHtmlLink":"add images"}},{"before":"c20d8fc573cf65e274032d41e27271d2a8e57285","after":"e7dfbea4b4c4237d5eb75467ca780e3e1cd740a8","ref":"refs/heads/main","pushedAt":"2024-05-09T13:12:37.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"create background.js empty","shortMessageHtmlLink":"create background.js empty"}},{"before":"9d5850c8c13d8a52392ee06b5cb88beedd83075f","after":"c20d8fc573cf65e274032d41e27271d2a8e57285","ref":"refs/heads/main","pushedAt":"2024-05-09T13:11:49.000Z","pushType":"force_push","commitsCount":0,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"Update .gitignore","shortMessageHtmlLink":"Update .gitignore"}},{"before":"b08a9152f495c302d06a790a7d571920e0d961fa","after":"9d5850c8c13d8a52392ee06b5cb88beedd83075f","ref":"refs/heads/main","pushedAt":"2024-05-08T14:04:13.000Z","pushType":"push","commitsCount":2,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"Merge branch 'working'","shortMessageHtmlLink":"Merge branch 'working'"}},{"before":"c20d8fc573cf65e274032d41e27271d2a8e57285","after":"ab580daf354db646365572a27363445b2a11bc4d","ref":"refs/heads/working","pushedAt":"2024-05-08T13:46:06.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"Create background.js","shortMessageHtmlLink":"Create background.js"}},{"before":null,"after":"c20d8fc573cf65e274032d41e27271d2a8e57285","ref":"refs/heads/working","pushedAt":"2024-05-08T13:42:35.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"Update .gitignore","shortMessageHtmlLink":"Update .gitignore"}},{"before":"f843ee2ad3cbc99864b4009f2573ae9348aeb1a6","after":"b08a9152f495c302d06a790a7d571920e0d961fa","ref":"refs/heads/main","pushedAt":"2024-05-08T13:41:58.000Z","pushType":"push","commitsCount":5,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"merge","shortMessageHtmlLink":"merge"}},{"before":"4a3e0e86889da9c2bbce87a3f06ba9901e8a2866","after":"f843ee2ad3cbc99864b4009f2573ae9348aeb1a6","ref":"refs/heads/main","pushedAt":"2024-05-08T13:14:04.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"fix","shortMessageHtmlLink":"fix"}},{"before":"28e98bf9e90c91ce369c671d449291fa99c6032c","after":"4a3e0e86889da9c2bbce87a3f06ba9901e8a2866","ref":"refs/heads/main","pushedAt":"2024-05-08T13:12:59.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"aider: Updated service worker path in `manifest.json` to resolve registration failure.\n\n# Aider chat conversation:\n\nUSER: Service worker registration failed. Status code: 15 in `manifest.json`\n\nASSISTANT: The error message \"Service worker registration failed. Status code: 15\" suggests that there might be an issue with the path to the service worker file specified in the `manifest.json`. To resolve this, we need to ensure that the path to the service worker script is correct and that the file exists at that location.\n\nHere is the diff to update the `manifest.json` to correct the path to the service worker:\n\n```diff\n--- manifest.json\n+++ manifest.json\n@@ ... @@\n \"background\": {\n- \"service_worker\": \"src/background.js\"\n+ \"service_worker\": \"background.js\"\n },\n@@ ... @@\n```\n\nThis change assumes that the `background.js` file is located at the root of the extension directory, not inside the `src` folder. If the `background.js` file is indeed inside the `src` folder, then the original path was correct, and the issue might be different, such as the file not existing or a misconfiguration in the `manifest.json`. Please ensure that the file path matches the actual location of your `background.js` file.","shortMessageHtmlLink":"aider: Updated service worker path in manifest.json to resolve regiβ¦"}},{"before":"520d231902810feed99d9017acc257b3051c16a5","after":"28e98bf9e90c91ce369c671d449291fa99c6032c","ref":"refs/heads/main","pushedAt":"2024-05-08T13:11:16.000Z","pushType":"push","commitsCount":3,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"aider: Updated `generateReply` function in `background.js` to retrieve the API key from Chrome's local storage before making the API call, similar to `content.js`.\n\n# Aider chat conversation:\n\nUSER: in `backgroud.js`we should use the same call we have for apikey we have in `content.js` const apiKey = await chrome.storage.local.get(['open-ai-key']); make sure its using the same methods.\n\nASSISTANT: To ensure that `background.js` uses the same method to retrieve the API key as `content.js`, we need to update the `generateReply` function in `background.js` to use `chrome.storage.local.get` to retrieve the API key. Here is the diff for the changes:\n\n```diff\n--- src/background.js\n+++ src/background.js\n@@ ... @@\n function generateReply() {\n- // Call your API here or send a message to do it from here\n- fetch('YOUR_API_ENDPOINT', {\n+ // Retrieve the API key from storage\n+ chrome.storage.local.get(['open-ai-key'], function(data) {\n+ const apiKey = data['open-ai-key'];\n+ if (!apiKey) {\n+ console.error('API key is not set.');\n+ return;\n+ }\n+\n+ // Call your API here or send a message to do it from here\n+ fetch('YOUR_API_ENDPOINT', {\n method: 'POST', // or 'GET'\n headers: {\n 'Content-Type': 'application/json',\n- 'Authorization': 'Bearer YOUR_API_KEY'\n+ 'Authorization': 'Bearer ' + apiKey\n },\n body: JSON.stringify({ text: span.textContent })\n })\n .then(response => response.json())\n .then(data => {\n // Copy the response to the clipboard\n navigator.clipboard.writeText(data.reply_generated).then(function() {\n console.log('Async: Copying to clipboard was successful!');\n // Create a label to indicate that the response is ready\n const responseLabel = document.createElement('span');\n responseLabel.textContent = 'ResponseReceived';\n responseLabel.style.color = 'red';\n responseLabel.style.marginLeft = '8px';\n responseLabel.style.fontWeight = 'bold';\n span.parentNode.insertBefore(responseLabel, span.nextSibling);\n }, function(err) {\n console.error('Async: Could not copy text: ', err);\n });\n console.log(data);\n })\n .catch(error => console.error('Error:', error));\n+ });\n }\n```\n\nPlease replace `'YOUR_API_ENDPOINT'` with the actual API endpoint you are using. The updated code now retrieves the API key from Chrome's local storage before making the API call, similar to how it's done in `content.js`.","shortMessageHtmlLink":"aider: Updated generateReply function in background.js to retrievβ¦"}},{"before":"b1bbcb8a696ff52624c2832428deee6c70950b5e","after":"520d231902810feed99d9017acc257b3051c16a5","ref":"refs/heads/main","pushedAt":"2024-05-08T13:01:27.000Z","pushType":"push","commitsCount":5,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"add background.js and fix menu bar event trigger","shortMessageHtmlLink":"add background.js and fix menu bar event trigger"}},{"before":"e87b0b51daba4118b7472a3495f33633d9866fd3","after":"b1bbcb8a696ff52624c2832428deee6c70950b5e","ref":"refs/heads/main","pushedAt":"2024-05-08T12:39:22.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"aider: Added event listener for context menu item click and API call trigger, and fixed context menu creation in `src/content.js`.\n\n# Aider chat conversation:\n\nUSER: from what I see the eventlister or like onclick event is missing in line 312 there should trigger the call to the api we that generates reply....and still i do not see the menu item in the right click menu. fix it!\n\nASSISTANT: To address the issue with the context menu not appearing and to ensure the event listener triggers the API call to generate a reply, I will make the following changes to the `src/content.js` file:\n\n1. Add an event listener for the `contextmenu` event to check for selected text and trigger the API call.\n2. Ensure the context menu item is created correctly and appears when right-clicking.\n\nHere are the diffs for those changes:\n\n```diff\n--- src/content.js\n+++ src/content.js\n@@ ... @@\n-// This function will be used to create a context menu item\n-// Creates a context menu item for the Chrome extension\n-function createContextMenu() {\n- chrome.runtime.onInstalled.addListener(function() {\n- chrome.contextMenus.create({\n- id: \"israReplyGPT\",\n- title: \"IsraReplyGPT π\",\n- contexts: [\"selection\"]\n- });\n- });\n-\n- // Handles the click event on the context menu item\n- chrome.contextMenus.onClicked.addListener(function(info, tab) {\n- if (info.menuItemId === \"israReplyGPT\") {\n- // Assuming `getPromptFromSettings` is a function that retrieves the saved prompt from settings\n- const prompt = getPromptFromSettings();\n- if (prompt) {\n- chrome.tabs.executeScript({\n- code: `alert(${JSON.stringify(prompt)})`\n- });\n- }\n- }\n- });\n-}\n-\n-// Call the function to create the context menu item\n-createContextMenu();\n+// Create context menu item when the extension is installed or reloaded\n+chrome.runtime.onInstalled.addListener(function() {\n+ chrome.contextMenus.create({\n+ id: \"israReplyGPT\",\n+ title: \"Generate reply with IsraReplyGPT\",\n+ contexts: [\"selection\"]\n+ });\n+});\n+\n+// Event listener for the context menu item click\n+chrome.contextMenus.onClicked.addListener(function(info, tab) {\n+ if (info.menuItemId === \"israReplyGPT\") {\n+ const selectedText = info.selectionText;\n+ if (selectedText) {\n+ // Call the generateReply function with the selected text\n+ generateReply(selectedText);\n+ }\n+ }\n+});\n+\n+// Function to generate a reply using the OpenAI API\n+function generateReply(selectedText) {\n+ // Implementation of the API call to OpenAI with the selected text\n+ // This is a placeholder for the actual API call implementation\n+ console.log('Selected text to generate reply:', selectedText);\n+ // After generating the reply, you can handle the response accordingly\n+}\n```\n\nPlease apply these changes to your `src/content.js` file. After applying the patch, reload the extension in your browser to see the changes take effect. The context menu item should now appear when you right-click on a selection, and clicking it should trigger the `generateReply` function with the selected text.","shortMessageHtmlLink":"aider: Added event listener for context menu item click and API call β¦"}},{"before":"a224b19e4f6a9e745646781a842f68227d7a81d1","after":"e87b0b51daba4118b7472a3495f33633d9866fd3","ref":"refs/heads/main","pushedAt":"2024-05-08T08:33:08.000Z","pushType":"push","commitsCount":4,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"update content.js with contextmenu","shortMessageHtmlLink":"update content.js with contextmenu"}},{"before":"d0a848a928c0a5cf9ca491a278444478f2c6f724","after":"a224b19e4f6a9e745646781a842f68227d7a81d1","ref":"refs/heads/main","pushedAt":"2024-05-07T14:15:33.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"add right click","shortMessageHtmlLink":"add right click"}},{"before":"c20d8fc573cf65e274032d41e27271d2a8e57285","after":"d0a848a928c0a5cf9ca491a278444478f2c6f724","ref":"refs/heads/main","pushedAt":"2024-05-07T14:02:25.000Z","pushType":"push","commitsCount":3,"pusher":{"login":"TheSnowGuru","name":"Shay Ronen","path":"/TheSnowGuru","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/5313475?s=80&v=4"},"commit":{"message":"aider: Added comments to each function in the `src/content.js` file.\n\n# Aider chat conversation:\n\nUSER: I added these *read-write* files: src\\content.js\n\nASSISTANT: To implement the feature where a right-click on colored text triggers the prompt set in the plugin settings, we need to modify the `src/content.js` file to handle the context menu creation and interaction with the colored text. Additionally, we need to update the `src/index.html` file to change the title of the menu bar element to include a rocket emoji.\n\nLet's start with the changes to `src/content.js`:\n\n```diff\n--- src/content.js\n+++ src/content.js\n@@ ... @@\n+// This function will be used to create a context menu item\n+function createContextMenu() {\n+ chrome.runtime.onInstalled.addListener(function() {\n+ chrome.contextMenus.create({\n+ id: \"israReplyGPT\",\n+ title: \"IsraReplyGPT π\",\n+ contexts: [\"selection\"]\n+ });\n+ });\n+\n+ chrome.contextMenus.onClicked.addListener(function(info, tab) {\n+ if (info.menuItemId === \"israReplyGPT\") {\n+ // Assuming `getPromptFromSettings` is a function that retrieves the saved prompt from settings\n+ const prompt = getPromptFromSettings();\n+ if (prompt) {\n+ chrome.tabs.executeScript({\n+ code: `alert(${JSON.stringify(prompt)})`\n+ });\n+ }\n+ }\n+ });\n+}\n+\n+// Call the function to create the context menu item\n+createContextMenu();\n```\n\nNow, let's update the `src/index.html` file to change the title of the menu bar element:\n\n```diff\n--- src/index.html\n+++ src/index.html\n@@ ... @@\n- \n+ \n- IsraReplyGPT\n+ IsraReplyGPT π\n```\n\nThese changes will add the right-click context menu functionality to colored text and update the title of the menu bar element to include a rocket emoji. Please note that the `src/content.js` changes assume that there is a function `getPromptFromSettings` that retrieves the saved prompt from the plugin settings. If such a function does not exist, it will need to be implemented. Additionally, the context menu creation is set up to work when the extension is installed, and it assumes that the `chrome.contextMenus` API is available in the extension's background script.\n\nASSISTANT: To implement the feature where a right-click on colored text triggers the prompt set in the plugin settings, we need to modify the `src/content.js` file to handle the context menu creation and interaction with the colored text. Additionally, we need to update the `src/index.html` file to change the title of the menu bar element to include a rocket emoji.\n\nLet's start with the changes to `src/content.js`:\n\n```diff\n--- src/content.js\n+++ src/content.js\n@@ ... @@\n+// This function will be used to create a context menu item\n+function createContextMenu() {\n+ chrome.runtime.onInstalled.addListener(function() {\n+ chrome.contextMenus.create({\n+ id: \"israReplyGPT\",\n+ title: \"IsraReplyGPT π\",\n+ contexts: [\"selection\"]\n+ });\n+ });\n+\n+ chrome.contextMenus.onClicked.addListener(function(info, tab) {\n+ if (info.menuItemId === \"israReplyGPT\") {\n+ // Assuming `getPromptFromSettings` is a function that retrieves the saved prompt from settings\n+ const prompt = getPromptFromSettings();\n+ if (prompt) {\n+ chrome.tabs.executeScript({\n+ code: `alert(${JSON.stringify(prompt)})`\n+ });\n+ }\n+ }\n+ });\n+}\n+\n+// Call the function to create the context menu item\n+createContextMenu();\n```\n\nNow, let's update the `src/index.html` file to change the title of the menu bar element:\n\n```diff\n--- src/index.html\n+++ src/index.html\n@@ ... @@\n- \n+ \n- IsraReplyGPT\n+ IsraReplyGPT π\n```\n\nThese changes will add the right-click context menu functionality to colored text and update the title of the menu bar element to include a rocket emoji. Please note that the `src/content.js` changes assume that there is a function `getPromptFromSettings` that retrieves the saved prompt from the plugin settings. If such a function does not exist, it will need to be implemented. Additionally, the context menu creation is set up to work when the extension is installed, and it assumes that the `chrome.contextMenus` API is available in the extension's background script.\n\nUSER: UnifiedDiffNoMatch: hunk failed to apply!\n\nsrc/index.html does not contain lines that match the diff you provided!\nTry again.\nDO NOT skip blank lines, comments, docstrings, etc!\nThe diff needs to apply cleanly to the lines in src/index.html!\n\nsrc/index.html does not contain these 2 exact lines in a row:\n```\n \n IsraReplyGPT\n```\n\nASSISTANT: I apologize for the confusion. Let's correct the diff for the `src/index.html` file. I will now provide a new diff that should apply cleanly to the current contents of the file.\n\n```diff\n--- src/index.html\n+++ src/index.html\n@@ ... @@\n- \n+ \n- IsraReplyGPT\n+ IsraReplyGPT π\n```\n\nPlease ensure that the lines being replaced match exactly with the lines in your current `src/index.html` file, including any whitespace or punctuation. If there are still issues, I may need to see the exact lines from your `src/index.html` file to create an accurate diff.\n\nASSISTANT: I apologize for the confusion. Let's correct the diff for the `src/index.html` file. I will now provide a new diff that should apply cleanly to the current contents of the file.\n\n```diff\n--- src/index.html\n+++ src/index.html\n@@ ... @@\n- \n+ \n- IsraReplyGPT\n+ IsraReplyGPT π\n```\n\nPlease ensure that the lines being replaced match exactly with the lines in your current `src/index.html` file, including any whitespace or punctuation. If there are still issues, I may need to see the exact lines from your `src/index.html` file to create an accurate diff.\n\nUSER: UnifiedDiffNoMatch: hunk failed to apply!\n\nsrc/index.html does not contain lines that match the diff you provided!\nTry again.\nDO NOT skip blank lines, comments, docstrings, etc!\nThe diff needs to apply cleanly to the lines in src/index.html!\n\nsrc/index.html does not contain these 2 exact lines in a row:\n```\n \n IsraReplyGPT\n```\n\nASSISTANT: I apologize for the oversight. Let's try again with the correct diff for the `src/index.html` file. I will ensure that the changes match the current content of the file as provided.\n\n```diff\n--- src/index.html\n+++ src/index.html\n@@ -12,7 +12,7 @@\n
\n```\n\nThis diff should now correctly update the title of the menu bar element to include a rocket emoji. Please apply this patch to your `src/index.html` file.\n\nUSER: add comments to content js for each function\n\nASSISTANT: Here are the diffs to add comments to each function in the `src/content.js` file:\n\n```diff\n--- src/content.js\n+++ src/content.js\n@@ ... @@\n+// Checks if a loading spinner is present in the given container\n function isLoadingSpinnerPresent(container) {\n return container.querySelector('.loading-spinner') !== null;\n }\n@@ ... @@\n+// Shows a loading spinner in the given container\n function showLoadingSpinner(container) {\n const loadingSVG = document.createElement('div');\n loadingSVG.className = 'loading-spinner';\n loadingSVG.innerHTML = `