Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChatGPT Plugin How to set OpenAIApiKey (inp_key) globaly #348

Open
jejbq opened this issue Jul 2, 2024 · 4 comments
Open

ChatGPT Plugin How to set OpenAIApiKey (inp_key) globaly #348

jejbq opened this issue Jul 2, 2024 · 4 comments
Labels
feature request Issues that request new features to be added to OnlyOffice fixed Issues that fixed and released

Comments

@jejbq
Copy link

jejbq commented Jul 2, 2024

Hello,

I installed chatgpt plugin in OnlyOffice DocumentServer for Nextcloud-AIO
but we don't want our OnlyOffice/Nextcloud user to enter the OpenAI's API key manually
to activate it.

Is there a way to set OpenAI API Key "inp_key" globaly for all users?

If yes, is it possible to keep this API Key somehow secret? (via PostgreSQL or env)

TECHNICAL DETAILS

docker exec -it $(docker ps --filter name=nextcloud-aio-onlyoffice -q) bash
cd /var/www/onlyoffice/documentserver/server/tools
./pluginsmanager --directory="/var/www/onlyoffice/documentserver/sdkjs-plugins" --install="chatgpt"
chown -cR ds:ds /var/www/onlyoffice/documentserver/sdkjs-plugins
cd /var/www/onlyoffice/documentserver/sdkjs-plugins/{9DC93CDB-B576-4F0C-B55E-FCC9C48DD007}

FILES

  • /var/www/onlyoffice/documentserver/sdkjs-plugins/{9DC93CDB-B576-4F0C-B55E-FCC9C48DD007}/config.json
  • /var/www/onlyoffice/documentserver/sdkjs-plugins/{9DC93CDB-B576-4F0C-B55E-FCC9C48DD007}/settings.html
  • /etc/onlyoffice/documentserver/local.json

REFERENCES
https://helpcenter.onlyoffice.com/ONLYOFFICE-Editors/ONLYOFFICE-Presentation-Editor/UsageInstructions/ChatGPT.aspx
https://helpcenter.onlyoffice.com/installation/docs-developer-configuring.aspx
https://api.onlyoffice.com/plugin/installation/onpremises
https://api.onlyoffice.com/editors/config/editor/plugins
https://api.onlyoffice.com/plugin/config

@jejbq
Copy link
Author

jejbq commented Jul 3, 2024

From my understanding of the documentation, there is no concept of global configuration / variable / storage to be the same for all users for OnlyOffice plugin such as openai / chatgpt (to set and store OpenAI API Key "inp_key" globaly) and Nextcloud AIO has no volumes for /etc/onlyoffice/documentserver (for local.json) and /var/www/onlyoffice/documentserver/sdkjs-plugins so it's impossible to automatically start (autostart) plugins or modify the code or config of an existing plugin.

I still don't understand where the "Document Server config" / "ONLYOFFICE Docs config" (var docEditor = new DocsAPI.DocEditor etc.) is in the Nextcloud AIO integration similar to #103

REFERENCES
https://github.com/ONLYOFFICE/DocumentServer/wiki/Plugins:-Autostart
https://api.onlyoffice.com/plugin/installation/onpremises#config
https://helpcenter.onlyoffice.com/integration/gettingstarted-nextcloud.aspx

@VladimirProkofiev52
Copy link

Hello! @jejbq

Is there a way to set OpenAI API Key "inp_key" globaly for all users?

You correctly pointed out that currently, there is no feature allowing the server administrator to add API keys to plugins.

We are already working on adding this functionality, and it will be available in one of the future versions of our editor.

Thank you for your report!

@Rita-Bubnova Rita-Bubnova added feature request Issues that request new features to be added to OnlyOffice fixed Issues that fixed and released labels Jul 4, 2024
@Galaxy102
Copy link

Hello @VladimirProkofiev52 ! Is there a related issue in DocumentServer that will track the functionality addition?

@jejbq
Copy link
Author

jejbq commented Jan 22, 2025

We have since migrated to OnlyOffice Docs Enterprise outside of Nextcloud AIO and are using our own inference server with Ollama with llama3.2:3b LLM, Open WebUI with an OpenAI compatible API endpoint.

It would be nice to have a solution to use the custom OpenAI compatible API and save the API key for all our users. The AI "ChatGPT" plugin is currently useless without that.

The above commands are not working with onlyoffice_documentserver-ee while it was workng with non ee edition.

root@006210af9ea9:/var/www/onlyoffice/documentserver/server/tools# ./pluginsmanager --directory="/var/www/onlyoffice/documentserver/sdkjs-plugins" --install="chatgpt"
./pluginsmanager: error while loading shared libraries: libicuuc.so.58: cannot open shared object file: No such file or directory

ln -s /usr/lib/x86_64-linux-gnu/libicuuc.so.70 /usr/lib/x86_64-linux-gnu/libicuuc.so.58

root@006210af9ea9:/var/www/onlyoffice/documentserver/server/tools# ./pluginsmanager --directory="/var/www/onlyoffice/documentserver/sdkjs-plugins" --install="chatgpt"
./pluginsmanager: error while loading shared libraries: libkernel.so: cannot open shared object file: No such file or directory

echo /var/www/onlyoffice/documentserver/server/FileConverter/bin >> /etc/ld.so.conf.d/onlyoffice.conf
ldconfig

root@006210af9ea9:/var/www/onlyoffice/documentserver/server/tools# ./pluginsmanager --directory="/var/www/onlyoffice/documentserver/sdkjs-plugins" --install="chatgpt"

Install plugins ...
------------------------------------------------------------------------------------

Install plugin: chatgpt
The plugin not found.
Check plugin name, GUID using --print-marketplace option or check file path

Installed plugins:
------------------------------------------------------------------------------------
macros              2.0.0                     {E6978D28-0441-4BD7-8346-82FAD68BCA3B} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to OnlyOffice fixed Issues that fixed and released
Projects
None yet
Development

No branches or pull requests

4 participants