Changeset 0.4.3 (#32)
This commit is contained in:
@@ -39,12 +39,19 @@ async function init() {
|
||||
|
||||
// Already authed or no backend → go straight to app
|
||||
hideSplashGate();
|
||||
await loadSettingsFromBackend();
|
||||
await initApp();
|
||||
}
|
||||
|
||||
async function initApp() {
|
||||
await loadChats();
|
||||
initializeEventListeners();
|
||||
|
||||
// In managed mode, fetch models from backend (ignore localStorage cache)
|
||||
if (Backend.isManaged) {
|
||||
fetchModels(false); // async, non-blocking
|
||||
}
|
||||
|
||||
updateQuickModelSelector();
|
||||
renderChatHistory();
|
||||
updateConnectionStatus();
|
||||
@@ -80,8 +87,9 @@ function hideSplashGate() {
|
||||
|
||||
async function authSuccess() {
|
||||
hideSplashGate();
|
||||
await loadSettingsFromBackend();
|
||||
await initApp();
|
||||
showToast(`✅ Welcome, ${Backend.user?.username || 'user'}!`, 'success');
|
||||
showToast(`✅ Welcome, ${Backend.user?.display_name || Backend.user?.username || 'user'}!`, 'success');
|
||||
}
|
||||
|
||||
function initializeEventListeners() {
|
||||
@@ -99,6 +107,12 @@ function initializeEventListeners() {
|
||||
});
|
||||
document.getElementById('profileSavePwBtn').addEventListener('click', handleChangePassword);
|
||||
|
||||
// Providers (managed mode)
|
||||
document.getElementById('providerShowAddBtn').addEventListener('click', showProviderForm);
|
||||
document.getElementById('providerCancelBtn').addEventListener('click', hideProviderForm);
|
||||
document.getElementById('providerCreateBtn').addEventListener('click', handleCreateProvider);
|
||||
document.getElementById('providerType').addEventListener('change', updateProviderEndpointHint);
|
||||
|
||||
// Chat controls
|
||||
document.getElementById('newChatBtn').addEventListener('click', newChat);
|
||||
document.getElementById('sendBtn').addEventListener('click', sendMessage);
|
||||
|
||||
Reference in New Issue
Block a user