Files
Eric BuehlerandGitHub 104370b52a Refactor web chat, fix multichat image restore (#1364)
* Fix multichat image restoration.

* Clippy

* Refactor

* Refactor frontent
2025-05-23 21:30:45 -04:00

40 lines
1.2 KiB
JavaScript

// Main application initialization and coordination
// Get DOM elements that are used across modules
const log = document.getElementById('log');
const input = document.getElementById('input');
const form = document.getElementById('form');
const modelSelect = document.getElementById('modelSelect');
const clearBtn = document.getElementById('clearBtn');
const newChatBtn = document.getElementById('newChatBtn');
const renameBtn = document.getElementById('renameBtn');
const deleteBtn = document.getElementById('deleteBtn');
const chatList = document.getElementById('chatList');
const imageInput = document.getElementById('imageInput');
const imageLabel = document.getElementById('imageLabel');
const mainArea = document.getElementById('main');
/**
* Initialize the entire application
*/
async function initApp() {
// Initialize WebSocket connection
initWebSocket();
// Initialize all modules
initModelSelection();
initChatHandlers();
initMessageSending();
initUI();
// Load initial data
await refreshModels();
}
// Start the application when DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', initApp);
} else {
initApp();
}