| |
|
|
| import { checkAuthAndRedirect, setupLoginForm, setupLogoutButton } from './auth.js'; |
| import { setupSendButton, setupPasteImage } from './chat.js'; |
| import { loadMetrics } from './metrics.js'; |
| import { loadRecords } from './records.js'; |
| import { initTabbedSessionManagement, loadSessions } from './session.js'; |
| import { AUTH_TOKEN_STORAGE_KEY } from './constants.js'; |
|
|
| document.addEventListener('DOMContentLoaded', async () => { |
| const loginForm = document.getElementById('login-form'); |
| const authTokenInput = document.getElementById('api-key'); |
| const errorMessage = document.getElementById('error-message'); |
| const logoutButton = document.getElementById('logout-button'); |
| const chatWindow = document.getElementById('chat-window'); |
| const userInput = document.getElementById('user-input'); |
| const imageUpload = document.getElementById('image-upload'); |
| const sendButton = document.getElementById('send-button'); |
| const callRecordsTableBody = document.querySelector('#call-records-table tbody'); |
| const modelSelect = document.getElementById('model-select'); |
|
|
| |
| checkAuthAndRedirect(); |
|
|
| |
| setupLoginForm(loginForm, authTokenInput, errorMessage); |
| setupLogoutButton(logoutButton); |
|
|
| |
|
|
| |
| |
| if (window.location.pathname === '/' || window.location.pathname === '/static/index.html') { |
| |
| await initTabbedSessionManagement(chatWindow); |
|
|
| |
| setupSendButton(sendButton, userInput, imageUpload, modelSelect); |
| setupPasteImage(userInput, imageUpload); |
| |
| |
| loadSessions(); |
|
|
| |
| loadMetrics(); |
| loadRecords(callRecordsTableBody); |
|
|
| |
| setInterval(loadMetrics, 15000); |
| setInterval(() => loadRecords(callRecordsTableBody), 30000); |
| } |
| }); |
|
|