How to connect LocalAI to ONLYOFFICE on Linux
The upgraded AI functionality in ONLYOFFICE allows you to connect any AI model to the editors, including a local one. In this article, we’ll explore the example of connecting LocalAI on Linux.
Step 1: Install LocalAI
curl https://localai.io/install.sh | sh
You can also check this instruction on installing LocalAI. Installation via Docker is possible.
Please note the hardware requirements:
CPU: It is advisable to use a multi-core processor.
RAM: A minimum of 8 GB of RAM is necessary for basic tasks. To handle larger models smoothly and prevent memory problems, 16 GB or more is recommended.
Storage: For quicker data access, opt for SSD storage. Make sure to have a minimum of 20 GB of available space for storing the model and handling temporary files.
Network: LocalAI functions without an internet connection. However, a reliable connection is advised for downloading models and applying updates.
Step 2: Install the required model
For example, this one:
local-ai models install hermes-2-theta-llama-3-8b
Step 3: Launch LocalAI with the cors flag
So that it can be used not only locally, but also in the web.
local-ai run --cors
Alternatively, you can add the following line to the /etc/localai.env
file:
CORSALLOWEDORIGINS = "*"
Step 4: Configure the AI plugin settings in ONLYOFFICE
- Launch any web editor depending on what ONLYOFFICE solution you are using.
- Go to the Plugins tab and click the Plugin Manager icon. Click Install next to the AI plugin. Open Background plugins and enable the switcher for AI. If you already have the AI plugin installed, just skip this step.
- Access the appeared AI tab. Click Settings to open the configuration window. Click Edit AI models -> Add.
- Here, specify LocalAI as a provider name. And enter the URL http://127.0.0.1:8080 (if you did not change it when launching local-ai).
- The models will load automatically to the list – select hermes-2-theta-llama-3-8b.
- Click OK to save the settings.
Ready! You can start using LocalAI to handle the AI-related tasks in your documents.
Create your free ONLYOFFICE account
View, edit and collaborate on docs, sheets, slides, forms, and PDF files online.