Update openai.js added /proxy command.

Added "proxy" slash command to openai.js to change between proxy presets in ST script.
This commit is contained in:
EX3-0 2024-02-07 13:52:48 -05:00 committed by GitHub
parent 58c3d3eb7f
commit b2eb361028
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import {
this_chid,
} from '../script.js';
import { groups, selected_group } from './group-chats.js';
import { registerSlashCommand } from './slash-commands.js';
import {
chatCompletionDefaultPrompts,
@ -4321,3 +4322,12 @@ $(document).ready(async function () {
$('#customize_additional_parameters').on('click', onCustomizeParametersClick);
$('#openai_proxy_preset').on('change', onProxyPresetChange);
});
function runProxyCallback(args,value) {
if ($('#openai_proxy_preset:contains("'+value+'")').length>=1) {
$('#openai_proxy_preset').val(value);
onProxyPresetChange();
} else {
toastr.warning("The selected preset does not exist");
}
}
registerSlashCommand('proxy',runProxyCallback,[],"(name) - Sets a proxy preset by name");