AI: Add capabilities

This commit is contained in:
Alexey Koshelev
2024-12-12 12:54:02 +03:00
parent 51de686fea
commit 94387af48a
84 changed files with 114 additions and 35 deletions

View File

@ -82,7 +82,13 @@
<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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 224 B

After

Width:  |  Height:  |  Size: 201 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 292 B

After

Width:  |  Height:  |  Size: 262 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 316 B

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 366 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 B

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 108 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 175 B

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 348 B

View File

@ -10,6 +10,7 @@ var providerNameCmbEl = document.getElementById('provider-name-cmb');
var providerUrlInputEl = document.getElementById('provider-url-input');
var providerKeyInputEl = document.getElementById('provider-key-input');
var modelNameCmbEl = document.getElementById('model-name-cmb');
$(modelNameCmbEl).select2();
var updateModelsBtnEl = document.getElementById('update-models-btn');
var updateModelsErrorEl = document.getElementById('update-models-error');
@ -37,32 +38,96 @@ var updateModelsErrorTip = new Tooltip(updateModelsErrorEl, {
align: 'right'
});
var useForTextBtn = new ToggleButton({
id: 'use-for-text',
icon: 'resources/icons/light/ai-texts.png'
});
var useForTextTip = new Tooltip(document.getElementById('use-for-text'), {
text: 'Texts',
yAnchor: 'top'
});
var useForImageBtn = new ToggleButton({
id: 'use-for-image',
icon: 'resources/icons/light/ai-images.png'
});
var useForImageTip = new Tooltip(document.getElementById('use-for-image'), {
text: 'Images',
yAnchor: 'top'
});
var useForVisionBtn = new ToggleButton({
id: 'use-for-vision',
icon: 'resources/icons/light/ai-visual-analysis.png'
});
var useForVisionTip = new Tooltip(document.getElementById('use-for-vision'), {
text: 'Visual Analysis',
yAnchor: 'top'
});
var capabilitiesElements = {
text: {
btn: new ToggleButton({
id: 'use-for-text',
icon: 'resources/icons/light/ai-texts.png'
}),
tip: new Tooltip(document.getElementById('use-for-text'), {
text: 'Text',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Chat
},
image: {
btn: new ToggleButton({
id: 'use-for-image',
icon: 'resources/icons/light/ai-images.png'
}),
tip: new Tooltip(document.getElementById('use-for-image'), {
text: 'Images',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Image
},
embeddings: {
btn: new ToggleButton({
id: 'use-for-embeddings',
icon: 'resources/icons/light/ai-embeddings.png'
}),
tip: new Tooltip(document.getElementById('use-for-embeddings'), {
text: 'Embeddings',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Embeddings
},
audio: {
btn: new ToggleButton({
id: 'use-for-audio',
icon: 'resources/icons/light/ai-audio.png'
}),
tip: new Tooltip(document.getElementById('use-for-audio'), {
text: 'Audio Processing',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Audio
},
moderations: {
btn: new ToggleButton({
id: 'use-for-moderations',
icon: 'resources/icons/light/ai-moderations.png'
}),
tip: new Tooltip(document.getElementById('use-for-moderations'), {
text: 'Content Moderation',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Moderations
},
realtime: {
btn: new ToggleButton({
id: 'use-for-realtime',
icon: 'resources/icons/light/ai-realtime.png'
}),
tip: new Tooltip(document.getElementById('use-for-realtime'), {
text: 'Realtime Tasks',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Realtime
},
code: {
btn: new ToggleButton({
id: 'use-for-code',
icon: 'resources/icons/light/ai-code.png'
}),
tip: new Tooltip(document.getElementById('use-for-code'), {
text: 'Coding Help',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Code
},
vision: {
btn: new ToggleButton({
id: 'use-for-vision',
icon: 'resources/icons/light/ai-visual-analysis.png'
}),
tip: new Tooltip(document.getElementById('use-for-vision'), {
text: 'Visual Analysis',
yAnchor: 'top'
}),
capabilities: AI.CapabilitiesUI.Vision
}
};
var resolveModels = null;
var rejectModels = null;
@ -211,17 +276,20 @@ function onChangeModelComboBox() {
function getCapabilities() {
var result = 0;
useForTextBtn.getValue() && (result += AI.CapabilitiesUI.Chat);
useForImageBtn.getValue() && (result += AI.CapabilitiesUI.Image);
useForVisionBtn.getValue() && (result += AI.CapabilitiesUI.Vision);
for (const key in capabilitiesElements) {
var itemProps = capabilitiesElements[key];
itemProps.btn.getValue() && (result += itemProps.capabilities);
}
return result;
}
function updateCapabilitiesBtns(capabilities) {
if(capabilities === undefined) return;
useForTextBtn.setValue((capabilities & AI.CapabilitiesUI.Chat) !== 0);
useForImageBtn.setValue((capabilities & AI.CapabilitiesUI.Image) !== 0);
useForVisionBtn.setValue((capabilities & AI.CapabilitiesUI.Vision) !== 0);
for (const key in capabilitiesElements) {
var itemProps = capabilitiesElements[key];
itemProps.btn.setValue((capabilities & itemProps.capabilities) !== 0);
}
}
function updateModelsList() {

View File

@ -155,7 +155,7 @@ function onOpenEditModal(data) {
});
aiModelEditWindow.attachEvent("onGetModels", async function(provider){
let models = await AI.getModels(provider);
aiModelEditWindow.command("onGetModels", models);
aiModelEditWindow && aiModelEditWindow.command("onGetModels", models);
});
aiModelEditWindow.attachEvent("onInit", function() {

View File

@ -4,7 +4,12 @@ var aiModelsList = [];
var capabilitiesList = {
[AI.CapabilitiesUI.Chat]: {name: 'Text-Based', icon: 'ai-texts.png'},
[AI.CapabilitiesUI.Image]: {name: 'Images', icon: 'ai-images.png'},
[AI.CapabilitiesUI.Vision]: {name: 'Vision', icon: 'ai-visual-analysis.png'},
[AI.CapabilitiesUI.Embeddings]: {name: 'Embeddings', icon: 'ai-embeddings.png'},
[AI.CapabilitiesUI.Audio]: {name: 'Audio', icon: 'ai-audio.png'},
[AI.CapabilitiesUI.Moderations]: {name: 'Moderations', icon: 'ai-moderations.png'},
[AI.CapabilitiesUI.Realtime]: {name: 'Realtime', icon: 'ai-realtime.png'},
[AI.CapabilitiesUI.Code]: {name: 'Code', icon: 'ai-code.png'},
[AI.CapabilitiesUI.Vision]: {name: 'Vision', icon: 'ai-visual-analysis.png'}
};
var scrollbarList = new PerfectScrollbar("#actions-list", {});
@ -112,7 +117,7 @@ function updatedComboBoxes() {
return data.text;
}
var capability = capabilitiesList[action.capabilities + 100];
var capability = capabilitiesList[action.capabilities];
if(!capability) {
return 'Available models';
}