Don't display toast on updating empty profile
This commit is contained in:
parent
4c4477098d
commit
c4aa79a8e1
|
@ -185,16 +185,10 @@ async function applyConnectionProfile(profile) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the selected connection profile.
|
* Updates the selected connection profile.
|
||||||
|
* @param {ConnectionProfile} profile Connection profile
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async function updateConnectionProfile() {
|
async function updateConnectionProfile(profile) {
|
||||||
const selectedProfile = extension_settings.connectionManager.selectedProfile;
|
|
||||||
const profile = extension_settings.connectionManager.profiles.find(p => p.id === selectedProfile);
|
|
||||||
if (!profile) {
|
|
||||||
console.log('No profile selected');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
profile.mode = main_api === 'openai' ? 'cc' : 'tc';
|
profile.mode = main_api === 'openai' ? 'cc' : 'tc';
|
||||||
await readProfileFromCommands(profile.mode, profile, true);
|
await readProfileFromCommands(profile.mode, profile, true);
|
||||||
}
|
}
|
||||||
|
@ -308,7 +302,13 @@ async function renderDetailsContent(details, detailsContent) {
|
||||||
|
|
||||||
const updateButton = document.getElementById('update_connection_profile');
|
const updateButton = document.getElementById('update_connection_profile');
|
||||||
updateButton.addEventListener('click', async () => {
|
updateButton.addEventListener('click', async () => {
|
||||||
await updateConnectionProfile();
|
const selectedProfile = extension_settings.connectionManager.selectedProfile;
|
||||||
|
const profile = extension_settings.connectionManager.profiles.find(p => p.id === selectedProfile);
|
||||||
|
if (!profile) {
|
||||||
|
console.log('No profile selected');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await updateConnectionProfile(profile);
|
||||||
await renderDetailsContent(details, detailsContent);
|
await renderDetailsContent(details, detailsContent);
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
toastr.success('Connection profile updated', '', { timeOut: 1500 });
|
toastr.success('Connection profile updated', '', { timeOut: 1500 });
|
||||||
|
|
Loading…
Reference in New Issue