Skip to content

Commit

Permalink
Merge remote-tracking branch 'Developing/feature/AI'
Browse files Browse the repository at this point in the history
  • Loading branch information
K0R0L committed Dec 16, 2024
2 parents e353fd1 + 3d3fc14 commit 80ae06e
Show file tree
Hide file tree
Showing 346 changed files with 25,197 additions and 9,820 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@
* Change list of models for custom requests (add new models and remove old).
* Change default model for request by context menu (now we use gpt-3.5-turbo-16k model for chat and gpt-4 for other request).
* Add new functions: "Fix spelling & grammar", "Rewrite differently", "Make longer", "Make shorter", "Make simpler" (it has restriction by gpt-4 model: 8k tokens)

## 2.0.0
* The plugin has been completely redesigned.

## 2.1.0
* Bug fix.
96 changes: 96 additions & 0 deletions sdkjs-plugins/content/ai/aiModelEdit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!--
(c) Copyright Ascensio System SIA 2020
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Edit action</title>

<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<script src="vendor/jQuery-2.2.2-min/jquery-v2.2.2-min.js"></script>
<script src="vendor/select2-4.0.6-rc.1/dist/js/select2.js"></script>
<script type="text/javascript" src="scripts/engine/storage.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="vendor/select2-4.0.6-rc.1/dist/css/select2.css"/>
<link rel="stylesheet" href="./resources/styles/common.css">
<link rel="stylesheet" href="./resources/styles/aiModelEdit.css">
</head>
<body class="noselect">
<div class="section">
<div class="form-vertical-item">
<div class="section-label">
<label class="i18n">Model name</label>
</div>
<input id="name-input" type="text" class="form-control"/>
</div>
</div>

<div class="section">
<div class="section-label" id="provider-section-label">
<label class="i18n">Provider</label>
</div>
<div class="form-horizontal-item">
<label class="i18n">Name</label>
<select id="provider-name-cmb" class="form-control"></select>
</div>
<div class="form-horizontal-item">
<label class="i18n">URL</label>
<input id="provider-url-input" type="text" class="form-control"/>
</div>
<div class="form-horizontal-item">
<label class="i18n">Key</label>
<input id="provider-key-input" type="text" class="form-control"/>
</div>
</div>

<div class="section">
<div class="form-vertical-item">
<div class="section-label">
<label class="i18n">Model</label>
<div id="update-models-row">
<div id="update-models-loader-container" class="asc-loader-container"></div>
<button id="update-models-btn" class="action-btn i18n">Update models list</button>
<img id="update-models-error" src="resources/icons/error-small/error.png"/>
</div>
</div>
<select id="model-name-cmb" class="form-control"></select>
</div>
</div>

<div class="section" style="margin-bottom: 0;">
<div class="form-vertical-item">
<div class="section-label">
<label class="i18n">Use model for</label>
</div>
</div>
<div class="form-horizontal-item" id="block-use-for" style="margin-bottom: 0;">
<div id="use-for-text"></div>
<div id="use-for-image"></div>
<div id="use-for-embeddings"></div>
<div id="use-for-audio"></div>
<div id="use-for-moderations"></div>
<div id="use-for-realtime"></div>
<div id="use-for-code"></div>
<div id="use-for-vision"></div>

</div>
</div>
<script type="text/javascript" src="scripts/aiModelEdit.js"></script>
</body>
</html>
41 changes: 41 additions & 0 deletions sdkjs-plugins/content/ai/aiModelsList.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
(c) Copyright Ascensio System SIA 2020
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>AI Models list</title>

<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="./resources/styles/common.css">
<link rel="stylesheet" href="./resources/styles/aiModelsList.css">
</head>
<body class="noselect">
<div id="ai-models-list">
<!-- Dynamic render items -->
</div>
<div id="buttons-block">
<button id="add-btn" class="btn-text-default i18n">Add</button>
<button id="edit-btn" class="btn-text-default i18n">Edit</button>
<button id="delete-btn" class="btn-text-default i18n">Delete</button>
</div>
<script type="text/javascript" src="scripts/aiModelsList.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<title>OpenAI</title>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<script src="./vendor/jquery-v2.2.2-min.js"></script>
<script type="text/javascript" src="scripts/desktop.js"></script>
<script type="text/javascript" src="vendor/GPT-3-Encoder/encoder.js"></script>
<script type="text/javascript" src="scripts/chat.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<link rel="stylesheet" href="./resources/css/styles.css">
<script src="vendor/jQuery-2.2.2-min/jquery-v2.2.2-min.js"></script>
<script type="text/javascript" src="vendor/GPT-3-Encoder/encoder.js"></script>
<script src="vendor/md/markdown-it.js"></script>
<link rel="stylesheet" href="./resources/styles/chat.css">
<script type="text/javascript" src="scripts/chat.js"></script>
</head>
<body style="display: flex;">
<div id="chat_window" class="chat_window hidden">
Expand Down
63 changes: 63 additions & 0 deletions sdkjs-plugins/content/ai/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name" : "AI",
"nameLocale": {
"ru": "ИИ",
"fr": "AI",
"es": "AI",
"de": "AI",
"cs": "AI",
"zh": "AI",
"pt-BR": "AI"
},

"guid" : "asc.{9DC93CDB-B576-4F0C-B55E-FCC9C48DD007}",
"version": "2.1.0",
"minVersion" : "8.2.0",

"variations" : [
{
"description": "Use the AI chatbot to perform tasks which involve understanding or generating natural language or code.",
"descriptionLocale": {
"ru": "Используйте чат-бот AI для выполнения задач, связанных с пониманием или генерацией естественного языка или кода.",
"fr": "Utilisez le chatbot AI pour effectuer des tâches qui impliquent la compréhension ou la génération de langage naturel ou de code.",
"es": "Utilice el chatbot AI para realizar tareas que impliquen la comprensión o generación de lenguaje natural o de código.",
"pt-BR": "Use o chatbot AI para realizar tarefas que envolvam compreensão ou geração de linguagem ou código natural.",
"de": "Verwenden Sie den AI-Chatbot, um Aufgaben auszuführen, die das Verstehen oder Generieren von natürlicher Sprache oder Code beinhalten.",
"cs": "AI API lze použít prakticky na jakýkoli úkol, který zahrnuje porozumění nebo generování přirozeného jazyka nebo kódu.",
"zh": "使用 AI 聊天机器人完成有关理解、生成自然语言或代码的任务。"
},

"url" : "index.html",

"icons": "resources/%theme-type%(light|dark)/icon%scale%(default).%extension%(png)",

"isViewer" : false,
"EditorsSupport" : ["word", "cell", "slide"],
"type" : "background",
"initDataType" : "none",
"buttons" : [],
"events" : ["onContextMenuShow", "onContextMenuClick", "onToolbarMenuClick"],

"store": {
"background": {
"light" : "linear-gradient(90deg, #F9B6FF 0%, #E370EE 102.01%)",
"dark" : "linear-gradient(90deg, #F9B6FF 0%, #E370EE 102.01%)"
},
"screenshots" :
[
"resources/store/screenshots/screen_1.png",
"resources/store/screenshots/screen_2.png",
"resources/store/screenshots/screen_3.png",
"resources/store/screenshots/screen_4.png",
"resources/store/screenshots/screen_5.png",
"resources/store/screenshots/screen_6.png"
],
"icons" : {
"light" : "resources/store/icons",
"dark" : "resources/store/icons"
},
"categories": ["specAbilities", "work", "recommended"]
}
}
]
}
67 changes: 67 additions & 0 deletions sdkjs-plugins/content/ai/config.json.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name" : "AI",
"nameLocale": {
"ru": "ИИ",
"fr": "AI",
"es": "AI",
"de": "AI",
"cs": "AI",
"zh": "AI",
"pt-BR": "AI"
},

"guid" : "asc.{9DC93CDB-B576-4F0C-B55E-FCC9C48DD007}",
"version": "2.1.0",
"minVersion" : "7.4.0",

"variations" : [
{
"description": "Use the AI chatbot to perform tasks which involve understanding or generating natural language or code.",
"descriptionLocale": {
"ru": "Используйте чат-бот AI для выполнения задач, связанных с пониманием или генерацией естественного языка или кода.",
"fr": "Utilisez le chatbot AI pour effectuer des tâches qui impliquent la compréhension ou la génération de langage naturel ou de code.",
"es": "Utilice el chatbot AI para realizar tareas que impliquen la comprensión o generación de lenguaje natural o de código.",
"pt-BR": "Use o chatbot AI para realizar tarefas que envolvam compreensão ou geração de linguagem ou código natural.",
"de": "Verwenden Sie den AI-Chatbot, um Aufgaben auszuführen, die das Verstehen oder Generieren von natürlicher Sprache oder Code beinhalten.",
"cs": "AI API lze použít prakticky na jakýkoli úkol, který zahrnuje porozumění nebo generování přirozeného jazyka nebo kódu.",
"zh": "使用 AI 聊天机器人完成有关理解、生成自然语言或代码的任务。"
},

"url" : "index.html",

"icons": "resources/%theme-type%(light|dark)/icon%scale%(default).%extension%(png)",

"isViewer" : false,
"EditorsSupport" : ["word", "cell", "slide"],
"type" : "background",
"initDataType" : "none",
"buttons" : [],
"events" : ["onContextMenuShow", "onContextMenuClick", "onToolbarMenuClick"],

"store": {
"background": {
"light" : "linear-gradient(90deg, #F9B6FF 0%, #E370EE 102.01%)",
"dark" : "linear-gradient(90deg, #F9B6FF 0%, #E370EE 102.01%)"
},
"screenshots" :
[
"resources/store/screenshots/screen_1.png",
"resources/store/screenshots/screen_2.png",
"resources/store/screenshots/screen_3.png",
"resources/store/screenshots/screen_4.png",
"resources/store/screenshots/screen_5.png",
"resources/store/screenshots/screen_6.png",
"resources/store/screenshots/screen_7.png",
"resources/store/screenshots/screen_8.png",
"resources/store/screenshots/screen_9.png",
"resources/store/screenshots/screen_10.png"
],
"icons" : {
"light" : "resources/store/icons",
"dark" : "resources/store/icons"
},
"categories": ["specAbilities", "work", "recommended"]
}
}
]
}
Binary file added sdkjs-plugins/content/ai/deploy/ai.plugin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
<meta charset="UTF-8" />
<title>ChatGPT</title>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">
<script type="text/javascript" src="scripts/desktop.js"></script>
<script type="text/javascript" src="vendor/GPT-3-Encoder/encoder.js"></script>
<script type="text/javascript" src="scripts/hyperlink.js"></script>
<style>
html,body,iframe {
Expand Down
40 changes: 40 additions & 0 deletions sdkjs-plugins/content/ai/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
(c) Copyright Ascensio System SIA 2020
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>AI Constructor</title>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js"></script>
<script type="text/javascript" src="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js"></script>
<link rel="stylesheet" href="https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css">

<script type="text/javascript" src="vendor/GPT-3-Encoder/encoder.js"></script>

<script type="text/javascript" src="scripts/engine/storage.js"></script>
<script type="text/javascript" src="scripts/engine/internal_providers.js"></script>
<script type="text/javascript" src="scripts/engine/local_storage.js"></script>
<script type="text/javascript" src="scripts/engine/engine.js"></script>

<script type="text/javascript" src="scripts/engine/buttons.js"></script>
<script type="text/javascript" src="scripts/engine/register.js"></script>
<script type="text/javascript" src="scripts/engine/library.js"></script>

<script type="text/javascript" src="scripts/code.js"></script>
</head>
<body>
</body>
</html>
Binary file added sdkjs-plugins/content/ai/resources/dark/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sdkjs-plugins/content/ai/resources/dark/icon@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sdkjs-plugins/content/ai/resources/light/icon.png
Binary file added sdkjs-plugins/content/ai/resources/light/icon@2x.png
Loading

0 comments on commit 80ae06e

Please sign in to comment.