Merge branch 'staging' into sysprompt-divorce

This commit is contained in:
Cohee 2024-09-19 23:14:40 +03:00
commit d0657161a1
2 changed files with 19 additions and 11 deletions

View File

@ -8569,20 +8569,27 @@ async function connectAPISlash(args, text) {
return '';
}
$(`#main_api option[value='${apiConfig.selected || text}']`).prop('selected', true);
$('#main_api').trigger('change');
let connectionRequired = false;
if (apiConfig.source) {
if (main_api !== apiConfig.selected) {
$(`#main_api option[value='${apiConfig.selected || text}']`).prop('selected', true);
$('#main_api').trigger('change');
connectionRequired = true;
}
if (apiConfig.source && oai_settings.chat_completion_source !== apiConfig.source) {
$(`#chat_completion_source option[value='${apiConfig.source}']`).prop('selected', true);
$('#chat_completion_source').trigger('change');
connectionRequired = true;
}
if (apiConfig.type) {
if (apiConfig.type && textgen_settings.type !== apiConfig.type) {
$(`#textgen_type option[value='${apiConfig.type}']`).prop('selected', true);
$('#textgen_type').trigger('change');
connectionRequired = true;
}
if (apiConfig.button) {
if (connectionRequired && apiConfig.button) {
$(apiConfig.button).trigger('click');
}

View File

@ -19,20 +19,21 @@ const DEFAULT_SETTINGS = {
selectedProfile: null,
};
const COMMON_COMMANDS = [
const CC_COMMANDS = [
'api',
'preset',
// Do not fix; CC needs to set the API twice because it could be overridden by the preset
'api',
'api-url',
'model',
];
const CC_COMMANDS = [
...COMMON_COMMANDS,
'proxy',
];
const TC_COMMANDS = [
...COMMON_COMMANDS,
'api',
'preset',
'api-url',
'model',
'sysprompt',
'sysprompt-state',
'instruct',