With synthetic intelligence taking deep roots spherical our lives and making it simpler for us to do quite a few factors, increasingly more additional software program program program builders, IT corporations and start-ups are in search of methods to combine state-of-the-art AI expertise into their merchandise to get the soar over their rivals.
Many trendy CRM platforms, e mail consumers, private assistants, video editors, mission administration packages and utterly different types of software program program program units now come geared up with AI assistants permitting their prospects to work sooner and be further productive.
Workplace software program program program will not be an exception. The thought-about integrating synthetic intelligence into digital doc workflows has been worthwhile the minds of workplace software program program program builders over the previous couple of years and now there are a selection of attention-grabbing integration examples that considerably change one of many easiest methods individuals work with workplace recordsdata.
On this textual content, we’ll attempt mainly in all probability probably the most worthwhile examples of symbiosis between synthetic intelligence and workplace software program program program, and look at the technique of integrating an AI assistant into an workplace package deal deal deal by way of the event of ONLYOFFICE Docs, an open-source workplace suite.
AI and workplace software program program program: most attention-grabbing integration examples
The market of workplace software program program program is very aggressive, and it’s an evident incontrovertible fact that essential companies frequently have a bonus over utterly totally different avid avid gamers. Nonetheless, even small corporations and unbiased builders can present you elegant decisions bringing the power of synthetic intelligence into the universe of doc enhancing and collaboration.
This can be a fast overview of among the many many hottest workplace packages with built-in AI assistants in the marketplace accessible obtainable in the marketplace:
- Microsoft 365. The Redmond huge supplied its personal AI software program program sometimes known as Copilot in March 2023. It combines the power of massive language fashions (LLMs) and makes it simpler for patrons to work with the Microsoft 365 apps, together with Groups, Outlook and Edge. Copilot is deeply built-in into the Microsoft ecosystem and means which you’ll be able to write and edit textual content material materials content material materials supplies in Phrase, analyze traits and create full information visualizations in Excel, and create spectacular displays based mostly in your prompts in PowerPoint. Copilot for Microsoft 365 is obtainable with a paid subscription.
- WPS Workplace. Microsoft Workplace’s competitor from China, WPS Workplace, has an AI assistant known as WPS AI. It’s a generative AI software program program that allows prospects to generate textual content material materials content material materials supplies, summarize massive paperwork, analyze information, extract outlines from PDFs and create assembly drafts. WPS AI could also be utilized in textual content material materials paperwork and PDF recordsdata and offers a free trial with a restricted set of decisions. To entry its full effectivity, you have to to buy one among many paid variations.
- Google Workspace. The Google agency has an AI-powered assistant for its productiveness apps known as Gemini. This software program program is constructed into Docs, Sheets and Slides permitting you to jot down diversified varieties of content material materials supplies and generate photos in textual content material materials paperwork, create tables and formulation in spreadsheets, and generate new slides with photos and content material materials supplies in displays. Gemini for Google Workspace is obtainable as a paid add-on. Apparently, the Google Workspace Market furthermore offers utterly utterly totally different AI assistants developed by third-party builders for Docs, Sheets and Slides nonetheless it’s best to attempt them at your explicit particular person hazard.
- Zoho WorkDrive. This on-line content material materials supplies collaboration platform and storage has an IA integration attribute known as Zia. It’s an AI-based writing assistant in the marketplace in some Zoho merchandise, together with Zoho Creator. Utilizing Zia, you in all probability can test your content material materials supplies for spelling and grammar errors and enhance its readability. The primary objective of this software program program is that will present you the right way to write concisely and clearly. Zia may even generate new content material materials supplies and photographs. It’s not in the marketplace utterly free.
Taking every little issue into consideration, the next conclusion appears evident: the favored workplace suites present nice AI integration picks nonetheless nearly all of them are paid.
Now let’s uncover the case of ONLYOFFICE Docs, an open-source workplace package deal deal deal, that gives sturdy AI capabilities based mostly on ChatGPT and uncover how this integration works.
ONLYOFFICE Docs and AI: a quick overview
ONLYOFFICE Docs is an open-source and free workplace suite for textual content material materials paperwork, spreadsheets, displays, fillable types and PDF recordsdata. The suite has a self-hosted model for native deployment and a cloud-based model for a fast begin. There may be furthermore a desktop shopper for Linux, Residence residence home windows and macOS and cell apps for Android and iOS. The availability code of the ONLYOFFICE suite is obtainable on GitHub.
ONLYOFFICE Docs has an open API, which makes it attainable to combine the editors with third-party companies. Such integrations work by way of plugins, particular add-ons that carry new capabilities and decisions. Amongst dozens of ready-to-use plugins for the ONLYOFFICE suite, you may uncover people who allow the power of synthetic intelligence. Further exactly, these are the plugins for ChatGPT and Zhipu Copilot.

Each ChatGPT and Zhipu Copilot are accessible contained in the ONLYOFFICE editor’s interface by way of separate plugins which can be put in and deleted with just a few clicks by way of the Plugin Supervisor. These plugins are formally developed and maintained by the ONLYOFFICE group. As all utterly totally different plugins, they’re in the marketplace utterly free.

To make these plugins work, you have to to specify an API key supplied by the corresponding platform. As regards to ChatGPT, you may uncover a sound API key contained in the settings of your OpenAI account.

Must you enter a sound API key contained in the ChatGPT plugin and allow it by way of the Plugins tab, you might have entry to the next decisions by way of the context menu, which makes it simpler to work with texts*:
- Interval of textual content material materials content material materials supplies based mostly in your prompts;
- Creation of images in a variety of resolutions;
- Translation to a wide range of languages, together with English, Spanish, Italian, Chinese language language language, German, French, and so forth.;
- Phrase evaluation;
- Extraction of key phrases;
- Textual content material materials summarization;
- Textual content material materials manipulation;
- Correction of spelling and grammar errors;
- Communication with the chatbot.
The Zhipu Copilot plugin offers related writing help decisions in ONLYOFFICE Docs and is designed for Chinese language language language-speaking prospects due to it’s based mostly on a localized info base.
In ONLYOFFICE Docs, you in all probability can work together with the ChatGPT service not solely in textual content material materials paperwork nonetheless furthermore in spreadsheets and displays, so that you simply in all probability can carry out diversified duties reminiscent of information evaluation and discovering info to your slides.
Now that you simply simply already know what ChatGPT and Zhipu copilot can do for you for individuals who work on workplace recordsdata, let’s take a deeper take a look at the ChatGPT plugin to see one of the best ways it actually works and what key elements its present code includes.
Keep in mind: the ONLYOFFICE builders assume no accountability for the accuracy or reliability of the data supplied by ChatGPT and ZhiPu Copilot.
Improvement of the ChatGPT plugin
The ChatGPT plugin consists of 5 directories, with the HTML recordsdata saved individually inside the foundation itemizing. This can be a fast overview of every file with code samples:
1. index.html: On condition that plugin operates as a background plugin, it doesn’t require a person interface. The index.html file references all of the scripts, code recordsdata, and stylesheets, guaranteeing they’re utilized when the plugin is activated.
OpenAI
if (!/MSIE d|Trident.*rv:/.take a look at(navigator.userAgent)) {
doc.write("");
]]>
doc.write("");
]]>
} else {
doc.write("");
]]>
}
Code contained throughout the tag of index.html file
2. chat.html: This file defines the HTML constructing for the chatbox that seems as soon as you choose the chat probability contained in the ChatGPT plugin.
3. Completely totally different HTML recordsdata: The thought itemizing incorporates further HTML recordsdata for various error messages and logs. These recordsdata are designed to deal with circumstances reminiscent of inadequate tokens or invalid requests, to ensure the plugin responds appropriately to utterly utterly totally different eventualities.
Overview of the sources itemizing
The sources itemizing primarily consists of two elements: CSS types and photographs for quite a few modes.
1. CSS Sub-directory: This incorporates types.css and customized.css. Each stylesheets apply CSS to fairly a number of elements all by way of the plugin.
2. Picture Directories: The second half includes the next:
- delicate incorporates photos optimized for light-themed editors;
- darkish incorporates photos optimized for dark-themed editors;
- icons includes icons in diversified aspect ratios and sizes for quite a few current settings and themes.
These above-mentioned sources guarantee that the ChatGPT plugin capabilities accurately all via utterly utterly totally different editor themes and resolutions.
Overview of the scripts itemizing
The code.js file incorporates the core logic for the plugin that integrates diversified functionalities powered by the OpenAI API. Let’s bear this file in additional facet:
1. Initialization and Setup:
- The plugin initializes variables, together with an API key, mannequin settings, and UI elements.
- The checkApiKey methodology retrieves the OpenAI API key from native storage.
perform checkApiKey() {
ApiKey = localStorage.getItem('OpenAIApiKey') || '';
if (!ApiKey.dimension) {
bHasKey = false;
} else {
bHasKey = true;
}
};
A code snippet from checkApiKey() methodology
2. Context Menu Interval:
- The getContextMenuItems() methodology dynamically generates context menu objects based mostly on the kind of choice contained in the doc (e.g., textual content material materials choice, photos, shapes, hyperlinks, and so forth.).
- If the API key's current, further picks like spelling and grammar correction, textual content material materials rewriting, translation, and film interval are added to the context menu of the plugin.
- This technique furthermore incorporates a logic to test for the presence of images contained in the doc and an probability for producing picture variations.
perform getContextMenuItems(picks) {
hyperlink = null;
checkApiKey();
let settings = {
guid: window.Asc.plugin.guid,
objects: [
{
id : 'ChatGPT',
text : generateText('ChatGPT'),
items : []
}
]
};
A code snippet from getContextMenuItems() methodology
3. Occasion Dealing with:
- The plugin attaches occasion handlers for context menu actions. As an illustration, the onContextMenuShow() occasion triggers the current of the customized context menu and performs further checks, reminiscent of retrieving the present phrase.
- The onSettings() occasion handler opens a settings modal dialogue when the settings menu merchandise is clicked, and extra.
4. Utility Strategies:
- Helper strategies like generateText() for textual content material materials translation, showError() for error current, and isEmpyText() for textual content material materials validation are included contained in the code.js file as accurately.
- The createSettings() methodology creates a UI container displaying token info and a settings button.
perform createSettings(textual content material materials, tokens, type, isNoBlockedAction) {
let url;
let settings = {
mannequin : mannequin,
max_tokens : maxLen - tokens.dimension
};
if (settings.max_tokens
console.error(new Error('This request is simply too huge!'));
return;
}
A code snippet from createSettings() methodology
The following file is chat.js. It manages the logic for the chatbox, which might probably be initialized by right-clicking anyplace contained in the doc. It truly works together with the chat.html file to make sure the chatbox’s constructing and effectivity are carried out exactly.
perform createMessage(textual content material materials, type) {
let chat = doc.getElementById('chat');
let message = type ? doc.createElement('div') : doc.getElementById('loading');
let textMes = doc.createElement('span');
textMes.classList.add('form-control', 'span_message');
textMes.innerText = textual content material materials;
chat.scrollTop = chat.scrollHeight;
if (type) {
message.classList.add('user_message');
chat.appendChild(message);
sendMessage(textual content material materials);
} else {
message.id = '';
message.innerText="";
}
message.appendChild(textMes);
};
Code snippet of the createMessage() methodology from the chat.js file
Now just a few phrases relating to the settings.js file. It manages the settings part of the plugin. That is the place prospects enter their API keys. This file furthermore validates the API key entered by the actual particular person.
perform createError(error) errMessage);
;
perform createLoader() {
if (!window.Asc.plugin.theme)
window.Asc.plugin.theme = {type: 'delicate'};
$('#loader-container').removeClass( "hidden" );
loader && (loader.take away ? loader.take away() : $('#loader-container')[0].removeChild(loader));
loader = showLoader($('#loader-container')[0], loadMessage);
};
Code snippets of createError() and createLoader() strategies from the settings.js file
There are furthermore one different .js recordsdata contained in the scripts itemizing that primarily embody JavaScript for error prompts (as talked about earlier contained in the HTML half). Moreover, some recordsdata comprise JavaScript triggers for quite a few environments the place the plugin might probably be used (desktop model, cloud model, and so forth.).
Translations itemizing
This itemizing incorporates translation recordsdata for quite a few languages, every represented by a .json file. Utilizing the onTranslate() methodology, the plugin checks this itemizing, identifies the file akin to the system’s language and retrieves the compulsory translated textual content material materials.
This mechanism ensures that the plugin can dynamically adapt to fairly a number of languages, offering a localized and user-friendly expertise.

The seller and the licenses itemizing
The seller itemizing homes the code and useful helpful useful resource recordsdata for the third-party libraries used contained in the plugin. This itemizing ensures that each one exterior dependencies are neatly organized and simply accessible.

This itemizing has three elements:
1. OpenAI (Chat GPT BPE Encoder Scripts): these scripts are mandatory for encoding and decoding the textual content material materials returned by the GPT engine.

2. Select2 Library Scripts: it is a extraordinarily environment friendly library that enhances the plugin’s explicit particular person interface by offering customizable choose packing containers, making the plugin simpler to make the most of.

3. jQuery Base File: jQuery simplifies HTML doc traversal and manipulation, occasion dealing with, and animation, making the UI further dynamic and responsive.
This was an in depth overview of the ChatGPT plugin created by the ONLYOFFICE builders for his or her workplace suite. Must you need to uncover the plugin’s code intimately and the strategies it makes use of, you in all probability can take a loot at this GitHub internet internet web page.
Utilizing the same ideas and the ONLYOFFICE API, you in all probability can assemble a plugin for yet another AI-based writing assistant and use its capabilities all via the interface of an workplace suite.