diff --git a/easy_chatgpt_access/README.rst b/easy_chatgpt_access/README.rst new file mode 100644 index 000000000..30e80b0af --- /dev/null +++ b/easy_chatgpt_access/README.rst @@ -0,0 +1,51 @@ +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Easy ChatGPT Access +=================== +This module enables easy access to the ChatGPT dialog box from the systray icon. + +Features +======== +* Access ChatGPT from systray icon. +* Able to copy the AI generated text into clipboard. + +Configuration +============= +* No Additional configuration is needed. + +License +------- +Affero General Public License, v3.0 (AGPL v3). +(https://www.gnu.org/licenses/agpl-3.0-standalone.html) + +Company +------- +* `Cybrosys Techno Solutions `__ + +Credits +------- +* Developer: (V17) Aysha Shalin N. + +Contacts +-------- +* Mail Contact : odoo@cybrosys.com +* Website : https://cybrosys.com + +Bug Tracker +----------- +Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. + +Maintainer +========== +.. image:: https://cybrosys.com/images/logo.png + :target: https://cybrosys.com + +This module is maintained by Cybrosys Technologies. + +For support and more information, please visit `Our Website `__ + +Further information +=================== +HTML Description: ``__ diff --git a/easy_chatgpt_access/__init__.py b/easy_chatgpt_access/__init__.py new file mode 100644 index 000000000..9392a03af --- /dev/null +++ b/easy_chatgpt_access/__init__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin N (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### diff --git a/easy_chatgpt_access/__manifest__.py b/easy_chatgpt_access/__manifest__.py new file mode 100644 index 000000000..4735aa09d --- /dev/null +++ b/easy_chatgpt_access/__manifest__.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +############################################################################### +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2024-TODAY Cybrosys Technologies() +# Author: Aysha Shalin N (odoo@cybrosys.com) +# +# You can modify it under the terms of the GNU AFFERO +# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# (AGPL v3) along with this program. +# If not, see . +# +############################################################################### +{ + 'name': 'Easy ChatGPT Access', + 'version': '17.0.1.0.0', + 'category': 'Extra Tools', + 'summary': 'Access ChatGPT from systray.', + 'description': """This module enables easy access to the ChatGPT dialog box + from the systray icon and allows copying the generated text to the + clipboard.""", + 'author': 'Cybrosys Techno Solutions', + 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', + 'website': "https://www.cybrosys.com", + 'depends': ['web'], + 'assets': { + 'web.assets_backend': [ + ('include', 'web_editor.assets_wysiwyg'), + 'easy_chatgpt_access/static/src/xml/chatgpt_button_views.xml', + 'easy_chatgpt_access/static/src/xml/chatgpt_prompt_dialog.xml', + 'easy_chatgpt_access/static/src/js/chatgpt_button.js', + 'easy_chatgpt_access/static/src/js/wysiwyg.js', + 'easy_chatgpt_access/static/src/js/ChatGPTPromptDialog.js', + 'easy_chatgpt_access/static/src/js/chatgpt_dialog.js', + ], + }, + 'images': ['static/description/banner.jpg'], + 'license': 'AGPL-3', + 'installable': True, + 'auto_install': False, + 'application': False, +} diff --git a/easy_chatgpt_access/doc/RELEASE_NOTES.md b/easy_chatgpt_access/doc/RELEASE_NOTES.md new file mode 100644 index 000000000..74aa29da7 --- /dev/null +++ b/easy_chatgpt_access/doc/RELEASE_NOTES.md @@ -0,0 +1,6 @@ +## Module + +#### 18.03.2024 +#### Version 17.0.1.0.0 +##### ADD +- Initial Commit for Easy ChatGPT Access diff --git a/easy_chatgpt_access/static/description/assets/icons/capture (1).png b/easy_chatgpt_access/static/description/assets/icons/capture (1).png new file mode 100644 index 000000000..8824deafc Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/capture (1).png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/check.png b/easy_chatgpt_access/static/description/assets/icons/check.png new file mode 100644 index 000000000..c8e85f51d Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/check.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/chevron.png b/easy_chatgpt_access/static/description/assets/icons/chevron.png new file mode 100644 index 000000000..2089293d6 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/chevron.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/cogs.png b/easy_chatgpt_access/static/description/assets/icons/cogs.png new file mode 100644 index 000000000..95d0bad62 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/cogs.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/consultation.png b/easy_chatgpt_access/static/description/assets/icons/consultation.png new file mode 100644 index 000000000..8319d4baa Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/consultation.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/ecom-black.png b/easy_chatgpt_access/static/description/assets/icons/ecom-black.png new file mode 100644 index 000000000..a9385ff13 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/ecom-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/education-black.png b/easy_chatgpt_access/static/description/assets/icons/education-black.png new file mode 100644 index 000000000..3eb09b27b Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/education-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/hotel-black.png b/easy_chatgpt_access/static/description/assets/icons/hotel-black.png new file mode 100644 index 000000000..130f613be Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/hotel-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/img.png b/easy_chatgpt_access/static/description/assets/icons/img.png new file mode 100644 index 000000000..70197f477 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/img.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/license.png b/easy_chatgpt_access/static/description/assets/icons/license.png new file mode 100644 index 000000000..a5869797e Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/license.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/lifebuoy.png b/easy_chatgpt_access/static/description/assets/icons/lifebuoy.png new file mode 100644 index 000000000..658d56ccc Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/lifebuoy.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/manufacturing-black.png b/easy_chatgpt_access/static/description/assets/icons/manufacturing-black.png new file mode 100644 index 000000000..697eb0e9f Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/manufacturing-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/photo-capture.png b/easy_chatgpt_access/static/description/assets/icons/photo-capture.png new file mode 100644 index 000000000..06c111758 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/photo-capture.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/pos-black.png b/easy_chatgpt_access/static/description/assets/icons/pos-black.png new file mode 100644 index 000000000..97c0f90c1 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/pos-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/puzzle.png b/easy_chatgpt_access/static/description/assets/icons/puzzle.png new file mode 100644 index 000000000..65cf854e7 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/puzzle.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/restaurant-black.png b/easy_chatgpt_access/static/description/assets/icons/restaurant-black.png new file mode 100644 index 000000000..4a35eb939 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/restaurant-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/service-black.png b/easy_chatgpt_access/static/description/assets/icons/service-black.png new file mode 100644 index 000000000..301ab51cb Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/service-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/trading-black.png b/easy_chatgpt_access/static/description/assets/icons/trading-black.png new file mode 100644 index 000000000..9398ba2f1 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/trading-black.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/training.png b/easy_chatgpt_access/static/description/assets/icons/training.png new file mode 100644 index 000000000..884ca024d Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/training.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/update.png b/easy_chatgpt_access/static/description/assets/icons/update.png new file mode 100644 index 000000000..ecbc5a01a Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/update.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/user.png b/easy_chatgpt_access/static/description/assets/icons/user.png new file mode 100644 index 000000000..6ffb23d9f Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/user.png differ diff --git a/easy_chatgpt_access/static/description/assets/icons/wrench.png b/easy_chatgpt_access/static/description/assets/icons/wrench.png new file mode 100644 index 000000000..6c04dea0f Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/icons/wrench.png differ diff --git a/easy_chatgpt_access/static/description/assets/misc/Cybrosys R.png b/easy_chatgpt_access/static/description/assets/misc/Cybrosys R.png new file mode 100644 index 000000000..da4058087 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/misc/Cybrosys R.png differ diff --git a/easy_chatgpt_access/static/description/assets/misc/email.svg b/easy_chatgpt_access/static/description/assets/misc/email.svg new file mode 100644 index 000000000..15291cdc3 --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/email.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/easy_chatgpt_access/static/description/assets/misc/phone.svg b/easy_chatgpt_access/static/description/assets/misc/phone.svg new file mode 100644 index 000000000..b7bd7f251 --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/phone.svg @@ -0,0 +1,3 @@ + + + diff --git a/easy_chatgpt_access/static/description/assets/misc/star (1) 2.svg b/easy_chatgpt_access/static/description/assets/misc/star (1) 2.svg new file mode 100644 index 000000000..5ae9f507a --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/star (1) 2.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/easy_chatgpt_access/static/description/assets/misc/support (1) 1.svg b/easy_chatgpt_access/static/description/assets/misc/support (1) 1.svg new file mode 100644 index 000000000..7d37a8f30 --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/support (1) 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/easy_chatgpt_access/static/description/assets/misc/support-email.svg b/easy_chatgpt_access/static/description/assets/misc/support-email.svg new file mode 100644 index 000000000..eb70370d6 --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/support-email.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/easy_chatgpt_access/static/description/assets/misc/tick-mark.svg b/easy_chatgpt_access/static/description/assets/misc/tick-mark.svg new file mode 100644 index 000000000..2dbb40187 --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/tick-mark.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/easy_chatgpt_access/static/description/assets/misc/whatsapp 1.svg b/easy_chatgpt_access/static/description/assets/misc/whatsapp 1.svg new file mode 100644 index 000000000..0bfaf8fc6 --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/whatsapp 1.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/easy_chatgpt_access/static/description/assets/misc/whatsapp.svg b/easy_chatgpt_access/static/description/assets/misc/whatsapp.svg new file mode 100644 index 000000000..b618aea1d --- /dev/null +++ b/easy_chatgpt_access/static/description/assets/misc/whatsapp.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/easy_chatgpt_access/static/description/assets/modules/access_restriction_by_ip.png b/easy_chatgpt_access/static/description/assets/modules/access_restriction_by_ip.png new file mode 100644 index 000000000..dc8d15471 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/modules/access_restriction_by_ip.png differ diff --git a/easy_chatgpt_access/static/description/assets/modules/custom_gantt_view.png b/easy_chatgpt_access/static/description/assets/modules/custom_gantt_view.png new file mode 100644 index 000000000..ec1472e4a Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/modules/custom_gantt_view.png differ diff --git a/easy_chatgpt_access/static/description/assets/modules/login_user_detail.png b/easy_chatgpt_access/static/description/assets/modules/login_user_detail.png new file mode 100644 index 000000000..27a628b12 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/modules/login_user_detail.png differ diff --git a/easy_chatgpt_access/static/description/assets/modules/project_dashboard_odoo.png b/easy_chatgpt_access/static/description/assets/modules/project_dashboard_odoo.png new file mode 100644 index 000000000..62135f2a4 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/modules/project_dashboard_odoo.png differ diff --git a/easy_chatgpt_access/static/description/assets/modules/web_login_styles.png b/easy_chatgpt_access/static/description/assets/modules/web_login_styles.png new file mode 100644 index 000000000..252f25c4c Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/modules/web_login_styles.png differ diff --git a/easy_chatgpt_access/static/description/assets/modules/whatsapp_redirect.png b/easy_chatgpt_access/static/description/assets/modules/whatsapp_redirect.png new file mode 100644 index 000000000..c4420d292 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/modules/whatsapp_redirect.png differ diff --git a/easy_chatgpt_access/static/description/assets/screenshots/1.png b/easy_chatgpt_access/static/description/assets/screenshots/1.png new file mode 100644 index 000000000..c1bf3de4a Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/screenshots/1.png differ diff --git a/easy_chatgpt_access/static/description/assets/screenshots/2.png b/easy_chatgpt_access/static/description/assets/screenshots/2.png new file mode 100644 index 000000000..aac4a1cc7 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/screenshots/2.png differ diff --git a/easy_chatgpt_access/static/description/assets/screenshots/3.png b/easy_chatgpt_access/static/description/assets/screenshots/3.png new file mode 100644 index 000000000..c7ef20439 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/screenshots/3.png differ diff --git a/easy_chatgpt_access/static/description/assets/screenshots/4.png b/easy_chatgpt_access/static/description/assets/screenshots/4.png new file mode 100644 index 000000000..6f02e4297 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/screenshots/4.png differ diff --git a/easy_chatgpt_access/static/description/assets/screenshots/hero.gif b/easy_chatgpt_access/static/description/assets/screenshots/hero.gif new file mode 100644 index 000000000..f19efcf50 Binary files /dev/null and b/easy_chatgpt_access/static/description/assets/screenshots/hero.gif differ diff --git a/easy_chatgpt_access/static/description/banner.jpg b/easy_chatgpt_access/static/description/banner.jpg new file mode 100644 index 000000000..fcc19a331 Binary files /dev/null and b/easy_chatgpt_access/static/description/banner.jpg differ diff --git a/easy_chatgpt_access/static/description/icon.png b/easy_chatgpt_access/static/description/icon.png new file mode 100644 index 000000000..4b10fc3f8 Binary files /dev/null and b/easy_chatgpt_access/static/description/icon.png differ diff --git a/easy_chatgpt_access/static/description/index.html b/easy_chatgpt_access/static/description/index.html new file mode 100644 index 000000000..2498a8012 --- /dev/null +++ b/easy_chatgpt_access/static/description/index.html @@ -0,0 +1,549 @@ + + + + + + + Odoo App 3 Index + + + + + + + + +
+
+
+
+
+ +
+
+
+ Community +
+
+ Enterprise +
+
+
+
+
+
+

+ Easy ChatGPT Access

+

+ Access ChatGPT Dialog Box From Systray. +

+
+ +
+
+
+
+
+

Key Highlights +

+
+
+
+
+
+ +
+
+

Easily Access ChatGPT from Systray

+

No Need of Any Text Editor Field for Opening ChatGPT Dialog Box. +

+
+
+
+
+
+
+ +
+
+

Can Copy the Text into the Clipboard.

+

You Can Copy the AI Generated Text into the Clipboard. +

+
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+

+ Click on the Icon from Systray.

+
+
+
+
+
+
+ +
+
+

+ The ChatGPT Dialog Box will Pop Up, Allowing Users to Input Queries.

+
+
+
+
+
+
+ +
+
+

+ The Response will Consist of AI-Generated Text, and Users will have the Option to Copy + this Text Using a Dedicated Copy Button.

+
+
+
+
+
+
+ +
+
+

+ A Notification is Displayed Following the Action of Copying Text to the Clipboard.

+
+
+
+
+
+
+
    +
  • + Access ChatGPT Easily from Systray. +
  • +
  • + Copy the Generated Text to the Clipboard. +
  • +
+
+
+
+
+
+
Version + 17.0.1.0.0|Released on:30th March 2024 +
+

+ Initial Commit for Easy ChatGPT Access.

+
+
+
+
+
+ +
+
+

Related Products

+
+
+ +
+
+

Our Services

+
+
+
+
+
+
+
+
+ service-icon +
+
+

Odoo Customization

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Support

+
+
+
+
+
+
+ service-icon +
+
+

Hire Odoo Developer

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Integration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Migration

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Consultancy

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Implementation

+
+
+
+
+
+
+ service-icon +
+
+

Odoo Licensing Consultancy

+
+
+
+
+
+
+

Our Industries

+
+
+
+
+
+
+ +

Trading

+

Easily procure and sell your products

+
+
+
+
+ +

POS

+

Easy configuration and convivial experience

+
+
+
+
+ +

Education

+

A platform for educational management

+
+
+
+
+ +

Manufacturing

+

Plan, track and schedule your operations

+
+
+
+
+ +

E-commerce & Website

+

Mobile friendly, awe-inspiring product pages

+
+
+
+
+ +

Service Management

+

Keep track of services and invoice

+
+
+
+
+ +

Restaurant

+

Run your bar or restaurant methodically

+
+
+
+
+ +

Hotel Management

+

An all-inclusive hotel management application

+
+
+
+
+
+
+

Support

+
+
+
+
+
+
+
+ +
+ Need + Help? +

Got questions or need help? Get in touch.

+
odoo@cybrosys.com +
+
+
+
+
+
+
+
+ +
+ WhatsApp +

Say hi to us on WhatsApp!

+
+91 + 99456767686
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/easy_chatgpt_access/static/src/js/ChatGPTPromptDialog.js b/easy_chatgpt_access/static/src/js/ChatGPTPromptDialog.js new file mode 100644 index 000000000..a150b7b7c --- /dev/null +++ b/easy_chatgpt_access/static/src/js/ChatGPTPromptDialog.js @@ -0,0 +1,13 @@ +/** @odoo-module **/ +import { ChatGPTPromptDialog } from '@web_editor/js/wysiwyg/widgets/chatgpt_prompt_dialog'; +//Default props are extended to include a 'systray' object with an 'insert' property set to true. +ChatGPTPromptDialog.defaultProps = { + ...ChatGPTPromptDialog.defaultProps, + systray: { + insert: true, + } +} +ChatGPTPromptDialog.props = { + ...ChatGPTPromptDialog.props, + systray: { type: Object, optional: true }, +} diff --git a/easy_chatgpt_access/static/src/js/chatgpt_button.js b/easy_chatgpt_access/static/src/js/chatgpt_button.js new file mode 100644 index 000000000..c42959007 --- /dev/null +++ b/easy_chatgpt_access/static/src/js/chatgpt_button.js @@ -0,0 +1,133 @@ +/** @odoo-module **/ +import { registry } from "@web/core/registry"; +import { Component, onWillStart, useState } from "@odoo/owl"; +import { Wysiwyg } from "@web_editor/js/wysiwyg/wysiwyg"; +import { QWebPlugin } from '@web_editor/js/backend/QWebPlugin'; +let stripHistoryIds; + +import { session } from "@web/session"; + + +/* Export new class SystrayIcon by extending Component */ +export class SystrayIcon extends Component { + static components = { Wysiwyg } + setup() { + this.state = useState({ + open: false, + }) + this.odoo_version = session.isEnterprise() ? 'Enterprise' : 'Community'; + onWillStart(async() => await this._lazyloadWysiwyg()) + }; + // Lazily loads the Wysiwyg module and its dependencies if not already loaded. + async _lazyloadWysiwyg() { + let wysiwygModule = await odoo.loader.modules.get('@web_editor/js/wysiwyg/wysiwyg'); + this.MoveNodePlugin = (await odoo.loader.modules.get('@web_editor/js/wysiwyg/MoveNodePlugin'))?.MoveNodePlugin; + // Otherwise, load the module. + if (!wysiwygModule) { + await loadBundle('web_editor.backend_assets_wysiwyg'); + wysiwygModule = await odoo.loader.modules.get('@web_editor/js/wysiwyg/wysiwyg'); + this.MoveNodePlugin = (await odoo.loader.modules.get('@web_editor/js/wysiwyg/MoveNodePlugin')).MoveNodePlugin; + } + stripHistoryIds = wysiwygModule.stripHistoryIds; + this.Wysiwyg = wysiwygModule.Wysiwyg; + } + /** + * Retrieves Wysiwyg properties. + * @returns {object} An object containing Wysiwyg properties. + */ + get wysiwygProps() { + return { + startWysiwyg: this.startWysiwyg.bind(this), + editingValue: undefined, + options: this.wysiwygOptions + } + } + // Include the 'open' parameter in the object to enable loading the prompt dialog from the Systray. + get wysiwygOptions() { + return { + value: "", + allowCommandVideo: false, + autostart: false, + collaborationChannel: undefined, + editorPlugins: [QWebPlugin, this.MoveNodePlugin], + field_id: "", + height: undefined, + inIframe: false, + iframeCssAssets: undefined, + iframeHtmlClass: undefined, + linkOptions: { + forceNewWindow: true, + }, + maxHeight: undefined, + mediaModalParams: { + noVideos: true, + useMediaLibrary: true, + }, + minHeight: undefined, + noAttachment: undefined, + onDblClickEditableMedia: this._onDblClickEditableMedia.bind(this), + onWysiwygBlur: this._onWysiwygBlur.bind(this), + placeholder: "", + resizable: false, + snippets: undefined, + tabsize: 0, + document, + openPrompt: this.state.open, + systray: { + insert: false, + } + } + } + _onDblClickEditableMedia(ev) { + const el = ev.currentTarget; + if (el.nodeName === 'IMG' && el.src) { + this.wysiwyg.showImageFullscreen(el.src); + } + } + _onWysiwygBlur() { + // Avoid save on blur if the html field is in inline mode. + if (!this.props.isInlineStyle) { + this.commitChanges(); + } + } + async startWysiwyg(wysiwyg) { + this.wysiwyg = wysiwyg; + await this.wysiwyg.startEdition(); + wysiwyg.$editable[0].classList.add("odoo-editor-qweb"); + if (this.props.codeview) { + const $codeviewButtonToolbar = $(` +
+ +
+ `); + this.wysiwyg.toolbarEl.append($codeviewButtonToolbar[0]); + $codeviewButtonToolbar.click(this.toggleCodeView.bind(this)); + } + this.wysiwyg.odooEditor.addEventListener("historyStep", () => + this.props.record.model.bus.trigger("FIELD_IS_DIRTY", this._isDirty()) + ); + if (this.props.isCollaborative) { + this.wysiwyg.odooEditor.addEventListener("onExternalHistorySteps", () => + this.props.record.model.bus.trigger("FIELD_IS_DIRTY", this._isDirty()) + ); + } + this.isRendered = true; + } + // Onclick event of systray Icon + _onClick() { + this.state.open = !this.state.open + setTimeout(() => { + this.state.open = false; + }, 500); + }; +}; +session.isEnterprise = function () { + return !!session.server_version_info[5]; + }; +SystrayIcon.template = "systray_icon"; +export const systrayItem = { + Component: SystrayIcon, +}; +registry.category("systray").add("SystrayIcon", systrayItem); diff --git a/easy_chatgpt_access/static/src/js/chatgpt_dialog.js b/easy_chatgpt_access/static/src/js/chatgpt_dialog.js new file mode 100644 index 000000000..6ad1ff05a --- /dev/null +++ b/easy_chatgpt_access/static/src/js/chatgpt_dialog.js @@ -0,0 +1,37 @@ +/** @odoo-module **/ +import { ChatGPTDialog } from '@web_editor/js/wysiwyg/widgets/chatgpt_dialog'; +import { patch } from "@web/core/utils/patch"; +import { useService } from "@web/core/utils/hooks"; +/** + * Patch ChatGPTDialog for modifying the setup and adding copyMessage function. + * Modifies the setup function to include initialization of the 'action' service. + * Adds the copyMessage function to copy generated AI text into the clipboard and display a notification. + */ +patch(ChatGPTDialog.prototype, { + setup() { + super.setup(...arguments); + this.action = useService('action'); + }, + // Copy the generated AI text into clipboard when hitting the Copy button + copyMessage(ev) { + var content = ev.target.parentElement.children[1].innerText + const message = "Copied to Clipboard!" + var textArea = document.createElement("textarea"); + textArea.value = content; + document.body.appendChild(textArea); + textArea.select(); + var successful = document.execCommand('copy'); + document.body.removeChild(textArea) + // Display notification after copying the text + this.action.doAction({ + type: "ir.actions.client", + tag: "display_notification", + params: { + title: "Text copied", + message: "Text copied to Clipboard!", + sticky: false, + }, + }); + return successful; + } +}) diff --git a/easy_chatgpt_access/static/src/js/wysiwyg.js b/easy_chatgpt_access/static/src/js/wysiwyg.js new file mode 100644 index 000000000..82859b18a --- /dev/null +++ b/easy_chatgpt_access/static/src/js/wysiwyg.js @@ -0,0 +1,84 @@ +/** @odoo-module **/ +import * as OdooEditorLib from "@web_editor/js/editor/odoo-editor/src/OdooEditor"; +import { Wysiwyg } from "@web_editor/js/wysiwyg/wysiwyg"; +import { patch } from "@web/core/utils/patch"; +import { ChatGPTPromptDialog } from '@web_editor/js/wysiwyg/widgets/chatgpt_prompt_dialog'; +import { ChatGPTAlternativesDialog } from '@web_editor/js/wysiwyg/widgets/chatgpt_alternatives_dialog'; +import { _t } from "@web/core/l10n/translation"; + +const preserveCursor = OdooEditorLib.preserveCursor; +const closestElement = OdooEditorLib.closestElement; +/** + * Patch method for modifying the setup and openChatGPTDialog functions of the Wysiwyg class. + * Modifies the setup function to include functionality for handling the opening of the dialog based on the 'openPrompt' prop. + * Modifies the openChatGPTDialog function to include systray options from the component's props in the parameters for opening the dialog. + */ +patch(Wysiwyg.prototype, { + // Extends the setup method of the superclass and adds functionality to handle the opening + // of the dialog based on the 'openPrompt' prop. + setup() { + super.setup(...arguments); + owl.useEffect((openPrompt) => { + if (openPrompt) { + this.openChatGPTDialog() + } + }, () => [this.props.options?.openPrompt]) + }, + // Modifies this function for loading the dialog box from systray icon + openChatGPTDialog(mode = 'prompt') { + const restore = preserveCursor(this.odooEditor.document); + const params = { + insert: content => { + this.odooEditor.historyPauseSteps(); + const insertedNodes = this.odooEditor.execCommand('insert', content); + this.odooEditor.historyUnpauseSteps(); + this.notification.add(_t('Your content was successfully generated.'), { + title: _t('Content generated'), + type: 'success', + }); + this.odooEditor.historyStep(); + // Add a frame around the inserted content to highlight it for 2 + // seconds. + const start = insertedNodes?.length && closestElement(insertedNodes[0]); + const end = insertedNodes?.length && closestElement(insertedNodes[insertedNodes.length - 1]); + if (start && end) { + const divContainer = this.odooEditor.editable.parentElement; + let [parent, left, top] = [start.offsetParent, start.offsetLeft, start.offsetTop - start.scrollTop]; + while (parent && !parent.contains(divContainer)) { + left += parent.offsetLeft; + top += parent.offsetTop - parent.scrollTop; + parent = parent.offsetParent; + } + let [endParent, endTop] = [end.offsetParent, end.offsetTop - end.scrollTop]; + while (endParent && !endParent.contains(divContainer)) { + endTop += endParent.offsetTop - endParent.scrollTop; + endParent = endParent.offsetParent; + } + const div = document.createElement('div'); + div.classList.add('o-chatgpt-content'); + const FRAME_PADDING = 3; + div.style.left = `${left - FRAME_PADDING}px`; + div.style.top = `${top - FRAME_PADDING}px`; + div.style.width = `${Math.max(start.offsetWidth, end.offsetWidth) + (FRAME_PADDING * 2)}px`; + div.style.height = `${endTop + end.offsetHeight - top + (FRAME_PADDING * 2)}px`; + divContainer.prepend(div); + setTimeout(() => div.remove(), 2000); + } + }, + }; + if (mode === 'alternatives') { + params.originalText = this.odooEditor.document.getSelection().toString() || ''; + } + // If systray options are provided in the component's props, they are included + // in the parameters for opening the dialog. + if (this.props.options.systray){ + params.systray = this.props.options.systray + } + this.odooEditor.document.getSelection().collapseToEnd(); + this.env.services.dialog.add( + mode === 'prompt' ? ChatGPTPromptDialog : ChatGPTAlternativesDialog, + params, + { onClose: restore }, + ); + } +}) diff --git a/easy_chatgpt_access/static/src/xml/chatgpt_button_views.xml b/easy_chatgpt_access/static/src/xml/chatgpt_button_views.xml new file mode 100644 index 000000000..b947fe23e --- /dev/null +++ b/easy_chatgpt_access/static/src/xml/chatgpt_button_views.xml @@ -0,0 +1,27 @@ + + + + +
+ +
+
+
+
+ + + + + + +
+
+
+
+
diff --git a/easy_chatgpt_access/static/src/xml/chatgpt_prompt_dialog.xml b/easy_chatgpt_access/static/src/xml/chatgpt_prompt_dialog.xml new file mode 100644 index 000000000..6107cdf07 --- /dev/null +++ b/easy_chatgpt_access/static/src/xml/chatgpt_prompt_dialog.xml @@ -0,0 +1,18 @@ + + + + + + + + + +