diff --git a/README.md b/README.md index 573f349..187a208 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ |![theme-dark](./website/static/readme/noi-theme-dark.png)|![theme-light](./website/static/readme/noi-theme-light.png)| |![batch-ask](./website/static/readme/noi-batch-ask.png)|![settings-prompts](./website/static/readme/noi-settings-prompts.png)| +--- + +[![Star History Chart](https://api.star-history.com/svg?repos=lencx/Noi&type=Timeline)](https://star-history.com/#lencx/Noi&Timeline) + ## FAQ ### macOS diff --git a/extensions/noi-ask-custom/README.md b/extensions/noi-ask-custom/README.md new file mode 100644 index 0000000..57b8567 --- /dev/null +++ b/extensions/noi-ask-custom/README.md @@ -0,0 +1 @@ +# @noi/ask-custom diff --git a/extensions/noi-ask-custom/main.js b/extensions/noi-ask-custom/main.js new file mode 100644 index 0000000..7ffba96 --- /dev/null +++ b/extensions/noi-ask-custom/main.js @@ -0,0 +1,61 @@ +/** + * NoiAskCustom: Batch send messages to AI Chat. + */ + +class NoiAskCustom { + static sync(message) { + const inputElement = document.querySelector('textarea'); + if (inputElement) { + const nativeTextareaSetter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value').set; + nativeTextareaSetter.call(inputElement, message); + const inputEvent = new InputEvent('input', { + bubbles: true, + cancelable: true, + }); + inputElement.dispatchEvent(inputEvent); + } + } + + static simulateUserInput(element, text) { + const inputEvent = new InputEvent('input', { + bubbles: true, + cancelable: true, + }); + element.focus(); + element.value = text; + element.dispatchEvent(inputEvent); + } + + static autoClick(btn) { + btn.focus(); + btn.disabled = false; + btn.click(); + } +} + +// TODO: Implement your custom AI Chat +// TODO: In manifest.json to match the url of your AI Chat +// ref: https://github.com/lencx/Noi/tree/main/extensions/noi-ask +class MyAsk extends NoiAskCustom { + // TODO: Change the name and url to your AI Chat + static name = 'MyChat'; + // TODO: Change the url to your AI Chat + static url = ''; + + // TODO: Implement the sync method + static sync() { + // code... + } + + // TODO: Implement the submit method + static submit() { + // code... + } +} + +// Register your AI Chat class within the NoiAsk global namespace for accessibility. +window.NoiAsk = { + ...window.NoiAsk || {}, + // TODO: Add your AI Chat class here + MyAsk, +}; diff --git a/extensions/noi-ask-custom/manifest.json b/extensions/noi-ask-custom/manifest.json new file mode 100644 index 0000000..2bf1bf2 --- /dev/null +++ b/extensions/noi-ask-custom/manifest.json @@ -0,0 +1,15 @@ +{ + "manifest_version": 3, + "name": "@noi/ask-custom", + "version": "0.1.0", + "homepage": "https://github.com/lencx/Noi/tree/main/extensions/noi-ask-custom", + "description": "The best assistant for batch asking and quick typing of prompts.", + "content_scripts": [ + { + "matches": [], + "js": ["main.js"], + "run_at": "document_end", + "world": "MAIN" + } + ] +} \ No newline at end of file diff --git a/extensions/noi-ask/main.js b/extensions/noi-ask/main.js index 082b9a1..8c9db40 100644 --- a/extensions/noi-ask/main.js +++ b/extensions/noi-ask/main.js @@ -214,7 +214,7 @@ class CozeAsk extends NoiAsk { } class YouAsk extends NoiAsk { - static name = 'YouAsk'; + static name = 'YOU'; static url = 'https://you.com'; static submit() { @@ -223,6 +223,58 @@ class YouAsk extends NoiAsk { } } +class CozeCNAsk extends NoiAsk { + static name = 'Coze'; + static url = 'https://www.coze.cn/home'; + + static submit() { + const inputElement = document.querySelector('textarea'); + if (inputElement) { + const nextElement = inputElement.nextElementSibling; + if (nextElement) { + const btn = nextElement.querySelector('button'); + if (btn) btn.click(); + } + } + } +} + +class ChatGMLAsk extends NoiAsk { + static name = 'ChatGLM'; // 智谱清言 + static url = 'https://chatglm.cn'; + + static submit() { + const btn = document.querySelector('#search-input-box .enter img'); + if (btn) btn.click(); + } +} + +class DoubaoAsk extends NoiAsk { + static name = 'Doubao'; // 豆包 + static url = 'https://www.doubao.com'; + + static submit() { + const btn = document.querySelector('#flow-end-msg-send'); + if (btn) btn.click(); + } +} + +class TongyiAsk extends NoiAsk { + static name = 'TongYi'; // 通义千问 + static url = 'https://tongyi.aliyun.com/qianwen'; + + static submit() { + const inputElement = document.querySelector('textarea'); + if (inputElement) { + const nextElement = inputElement.nextElementSibling; + if (nextElement) { + const btn = nextElement.querySelector('div[class^="chatBtn"]'); + if (btn) btn.click(); + } + } + } +} + window.NoiAsk = { OpenAIAsk, PoeAsk, @@ -234,4 +286,8 @@ window.NoiAsk = { PiAsk, CozeAsk, YouAsk, + CozeCNAsk, + DoubaoAsk, + ChatGMLAsk, + TongyiAsk, }; diff --git a/extensions/noi-ask/manifest.json b/extensions/noi-ask/manifest.json index 830fd71..31e204c 100644 --- a/extensions/noi-ask/manifest.json +++ b/extensions/noi-ask/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 3, "name": "@noi/ask", - "version": "0.1.1", + "version": "0.1.2", "homepage": "https://github.com/lencx/Noi/tree/main/extensions/noi-ask", "description": "The best assistant for batch asking and quick typing of prompts.", "content_scripts": [ @@ -16,7 +16,11 @@ "https://copilot.microsoft.com/*", "https://pi.ai/talk/*", "https://www.coze.com/home/*", - "https://you.com/*" + "https://you.com/*", + "https://www.coze.cn/home/*", + "https://chatglm.cn/*", + "https://www.doubao.com/*", + "https://tongyi.aliyun.com/qianwen/*" ], "js": ["main.js"], "run_at": "document_end", diff --git a/extensions/noi-export-chatgpt/manifest.json b/extensions/noi-export-chatgpt/manifest.json index 774dfa1..3f748fb 100644 --- a/extensions/noi-export-chatgpt/manifest.json +++ b/extensions/noi-export-chatgpt/manifest.json @@ -6,7 +6,7 @@ "description": "ChatGPT chat history export, supports PDF, Image, and Markdown formats.", "content_scripts": [ { - "matches": ["https://*.openai.com/*"], + "matches": ["https://chat.openai.com/*"], "js": ["main.js"], "css": ["style.css"], "run_at": "document_end", diff --git a/extensions/noi.extensions.json b/extensions/noi.extensions.json index 1b61699..3183129 100644 --- a/extensions/noi.extensions.json +++ b/extensions/noi.extensions.json @@ -5,8 +5,17 @@ { "name": "@noi/ask", "description": "The best assistant for batch asking and quick typing of prompts.", - "version": "0.1.1", + "version": "0.1.2", "url": "https://github.com/lencx/Noi/tree/main/extensions/noi-ask", + "dirname": "noi-ask", + "disabled": false + }, + { + "name": "@noi/ask-custom", + "description": "The best assistant for batch asking and quick typing of prompts.", + "version": "0.1.0", + "url": "https://github.com/lencx/Noi/tree/main/extensions/noi-ask-custom", + "dirname": "noi-ask-custom", "disabled": false }, { @@ -14,6 +23,7 @@ "description": "ChatGPT chat history export, supports PDF, Image, and Markdown formats.", "version": "0.1.0", "url": "https://github.com/lencx/Noi/tree/main/extensions/noi-export-chatgpt", + "dirname": "noi-export-chatgpt", "disabled": false }, { @@ -21,6 +31,7 @@ "description": "Reset certain website styles to enhance compatibility with Noi.", "version": "0.1.0", "url": "https://github.com/lencx/Noi/tree/main/extensions/noi-reset", + "dirname": "noi-reset", "disabled": false } ]