Merge OpenAI init functions

This commit is contained in:
Cohee 2024-09-22 12:29:32 +03:00
parent 9206e6d948
commit 94977e71ff
2 changed files with 4 additions and 6 deletions

View File

@ -100,7 +100,7 @@ import {
proxies, proxies,
loadProxyPresets, loadProxyPresets,
selected_proxy, selected_proxy,
initOpenai, initOpenAI,
} from './scripts/openai.js'; } from './scripts/openai.js';
import { import {
@ -932,6 +932,7 @@ async function firstLoadInit() {
await initLocales(); await initLocales();
initDefaultSlashCommands(); initDefaultSlashCommands();
initTextGenModels(); initTextGenModels();
initOpenAI();
await getSystemMessages(); await getSystemMessages();
sendSystemMessage(system_message_types.WELCOME); sendSystemMessage(system_message_types.WELCOME);
sendSystemMessage(system_message_types.WELCOME_PROMPT); sendSystemMessage(system_message_types.WELCOME_PROMPT);
@ -939,7 +940,6 @@ async function firstLoadInit() {
initKeyboard(); initKeyboard();
initDynamicStyles(); initDynamicStyles();
initTags(); initTags();
initOpenai();
initBookmarks(); initBookmarks();
await getUserAvatars(true, user_avatar); await getUserAvatars(true, user_avatar);
await getCharacters(); await getCharacters();

View File

@ -4937,7 +4937,7 @@ function runProxyCallback(_, value) {
return foundName; return foundName;
} }
export function initOpenai() { export function initOpenAI() {
SlashCommandParser.addCommandObject(SlashCommand.fromProps({ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
name: 'proxy', name: 'proxy',
callback: runProxyCallback, callback: runProxyCallback,
@ -4953,9 +4953,7 @@ export function initOpenai() {
], ],
helpString: 'Sets a proxy preset by name.', helpString: 'Sets a proxy preset by name.',
})); }));
}
$(document).ready(async function () {
$('#test_api_button').on('click', testApiConnection); $('#test_api_button').on('click', testApiConnection);
$('#scale-alt').on('change', function () { $('#scale-alt').on('change', function () {
@ -5419,4 +5417,4 @@ $(document).ready(async function () {
$('#openai_proxy_password_show').on('click', onProxyPasswordShowClick); $('#openai_proxy_password_show').on('click', onProxyPasswordShowClick);
$('#customize_additional_parameters').on('click', onCustomizeParametersClick); $('#customize_additional_parameters').on('click', onCustomizeParametersClick);
$('#openai_proxy_preset').on('change', onProxyPresetChange); $('#openai_proxy_preset').on('change', onProxyPresetChange);
}); }