ONLYOFFICE / onlyoffice.github.io

Apache License 2.0
114 stars 337 forks source link

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

Open jejbq opened 6 days ago

jejbq commented 6 days ago

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

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 commented 5 days ago

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 commented 4 days ago

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!