mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-10 17:10:45 +01:00
Fix connection profile for CC setting incorrect source by preset
This commit is contained in:
parent
5269725f1c
commit
9197ed7fce
@ -8569,20 +8569,27 @@ async function connectAPISlash(args, text) {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let connectionRequired = false;
|
||||||
|
|
||||||
|
if (main_api !== apiConfig.selected) {
|
||||||
$(`#main_api option[value='${apiConfig.selected || text}']`).prop('selected', true);
|
$(`#main_api option[value='${apiConfig.selected || text}']`).prop('selected', true);
|
||||||
$('#main_api').trigger('change');
|
$('#main_api').trigger('change');
|
||||||
|
connectionRequired = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (apiConfig.source) {
|
if (apiConfig.source && oai_settings.chat_completion_source !== apiConfig.source) {
|
||||||
$(`#chat_completion_source option[value='${apiConfig.source}']`).prop('selected', true);
|
$(`#chat_completion_source option[value='${apiConfig.source}']`).prop('selected', true);
|
||||||
$('#chat_completion_source').trigger('change');
|
$('#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 option[value='${apiConfig.type}']`).prop('selected', true);
|
||||||
$('#textgen_type').trigger('change');
|
$('#textgen_type').trigger('change');
|
||||||
|
connectionRequired = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (apiConfig.button) {
|
if (connectionRequired && apiConfig.button) {
|
||||||
$(apiConfig.button).trigger('click');
|
$(apiConfig.button).trigger('click');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,20 +19,21 @@ const DEFAULT_SETTINGS = {
|
|||||||
selectedProfile: null,
|
selectedProfile: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const COMMON_COMMANDS = [
|
const CC_COMMANDS = [
|
||||||
'api',
|
'api',
|
||||||
'preset',
|
'preset',
|
||||||
|
// Do not fix; CC needs to set the API twice because it could be overridden by the preset
|
||||||
|
'api',
|
||||||
'api-url',
|
'api-url',
|
||||||
'model',
|
'model',
|
||||||
];
|
|
||||||
|
|
||||||
const CC_COMMANDS = [
|
|
||||||
...COMMON_COMMANDS,
|
|
||||||
'proxy',
|
'proxy',
|
||||||
];
|
];
|
||||||
|
|
||||||
const TC_COMMANDS = [
|
const TC_COMMANDS = [
|
||||||
...COMMON_COMMANDS,
|
'api',
|
||||||
|
'preset',
|
||||||
|
'api-url',
|
||||||
|
'model',
|
||||||
'instruct',
|
'instruct',
|
||||||
'context',
|
'context',
|
||||||
'instruct-state',
|
'instruct-state',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user