Merge OpenAI init functions

94977e71ff0498b5de9ebab8504b1b1b4d67ac2f

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +4 -6Ignore whitespace
public/script.js+2 -2
@@ -100,7 +100,7 @@ import {
100 proxies,100 proxies,
101 loadProxyPresets,101 loadProxyPresets,
102 selected_proxy,102 selected_proxy,
103 initOpenai,103 initOpenAI,
104} from './scripts/openai.js';104} from './scripts/openai.js';
105105
106import {106import {
@@ -932,6 +932,7 @@ async function firstLoadInit() {
932 await initLocales();932 await initLocales();
933 initDefaultSlashCommands();933 initDefaultSlashCommands();
934 initTextGenModels();934 initTextGenModels();
935 initOpenAI();
935 await getSystemMessages();936 await getSystemMessages();
936 sendSystemMessage(system_message_types.WELCOME);937 sendSystemMessage(system_message_types.WELCOME);
937 sendSystemMessage(system_message_types.WELCOME_PROMPT);938 sendSystemMessage(system_message_types.WELCOME_PROMPT);
@@ -939,7 +940,6 @@ async function firstLoadInit() {
939 initKeyboard();940 initKeyboard();
940 initDynamicStyles();941 initDynamicStyles();
941 initTags();942 initTags();
942 initOpenai();
943 initBookmarks();943 initBookmarks();
944 await getUserAvatars(true, user_avatar);944 await getUserAvatars(true, user_avatar);
945 await getCharacters();945 await getCharacters();
public/scripts/openai.js+2 -4
@@ -4937,7 +4937,7 @@ function runProxyCallback(_, value) {
4937 return foundName;4937 return foundName;
4938}4938}
49394939
4940export function initOpenai() {4940export function initOpenAI() {
4941 SlashCommandParser.addCommandObject(SlashCommand.fromProps({4941 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
4942 name: 'proxy',4942 name: 'proxy',
4943 callback: runProxyCallback,4943 callback: runProxyCallback,
@@ -4953,9 +4953,7 @@ export function initOpenai() {
4953 ],4953 ],
4954 helpString: 'Sets a proxy preset by name.',4954 helpString: 'Sets a proxy preset by name.',
4955 }));4955 }));
4956}
49574956
4958$(document).ready(async function () {
4959 $('#test_api_button').on('click', testApiConnection);4957 $('#test_api_button').on('click', testApiConnection);
49604958
4961 $('#scale-alt').on('change', function () {4959 $('#scale-alt').on('change', function () {
@@ -5419,4 +5417,4 @@ $(document).ready(async function () {
5419 $('#openai_proxy_password_show').on('click', onProxyPasswordShowClick);5417 $('#openai_proxy_password_show').on('click', onProxyPasswordShowClick);
5420 $('#customize_additional_parameters').on('click', onCustomizeParametersClick);5418 $('#customize_additional_parameters').on('click', onCustomizeParametersClick);
5421 $('#openai_proxy_preset').on('change', onProxyPresetChange);5419 $('#openai_proxy_preset').on('change', onProxyPresetChange);
5422});5420}