Don't display toast on updating empty profile

c4aa79a8e1c371c0426f6d77d86e21770cbac2b8

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

1 files changed, +9 -9Showing whitespace changes
public/scripts/extensions/connection-manager/index.js+9 -9
@@ -185,16 +185,10 @@ async function applyConnectionProfile(profile) {
185185
186/**186/**
187 * Updates the selected connection profile.187 * Updates the selected connection profile.
188 * @param {ConnectionProfile} profile Connection profile
188 * @returns {Promise<void>}189 * @returns {Promise<void>}
189 */190 */
190async function updateConnectionProfile() {191async function updateConnectionProfile(profile) {
191 const selectedProfile = extension_settings.connectionManager.selectedProfile;
192 const profile = extension_settings.connectionManager.profiles.find(p => p.id === selectedProfile);
193 if (!profile) {
194 console.log('No profile selected');
195 return;
196 }
197
198 profile.mode = main_api === 'openai' ? 'cc' : 'tc';192 profile.mode = main_api === 'openai' ? 'cc' : 'tc';
199 await readProfileFromCommands(profile.mode, profile, true);193 await readProfileFromCommands(profile.mode, profile, true);
200}194}
@@ -308,7 +302,13 @@ async function renderDetailsContent(details, detailsContent) {
308302
309 const updateButton = document.getElementById('update_connection_profile');303 const updateButton = document.getElementById('update_connection_profile');
310 updateButton.addEventListener('click', async () => {304 updateButton.addEventListener('click', async () => {
311 await updateConnectionProfile();305 const selectedProfile = extension_settings.connectionManager.selectedProfile;
306 const profile = extension_settings.connectionManager.profiles.find(p => p.id === selectedProfile);
307 if (!profile) {
308 console.log('No profile selected');
309 return;
310 }
311 await updateConnectionProfile(profile);
312 await renderDetailsContent(details, detailsContent);312 await renderDetailsContent(details, detailsContent);
313 saveSettingsDebounced();313 saveSettingsDebounced();
314 toastr.success('Connection profile updated', '', { timeOut: 1500 });314 toastr.success('Connection profile updated', '', { timeOut: 1500 });