()
| 181 | // Get current session from app |
| 182 | if (this.app) { |
| 183 | this.currentSession = this.app.getCurrentSession(); |
| 184 | this.loadSessionData(); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | loadSessionData() { |
| 189 | if (!this.currentSession) { |
| 190 | // No session selected - clear session data and show next ticket |
| 191 | this.apiKey = null; |
| 192 | this.apiKeyInfo = null; |
| 193 | this.expiresAt = null; |
| 194 | |
| 195 | // Load next available ticket |
| 196 | this.loadNextTicket(); |
| 197 | |
| 198 | // Render to show ticket panel instead of API key panel |
| 199 | this.renderTopSectionOnly(); |
| 200 | |
| 201 | return; |
| 202 | } |
| 203 | |
| 204 | // Load API key from current session |
| 205 | this.app.services.inference.ensureSessionBackend(this.currentSession); |
| 206 | const accessInfo = this.app.services.inference.getAccessInfo(this.currentSession); |
| 207 | this.apiKey = accessInfo?.token || null; |
| 208 | this.apiKeyInfo = accessInfo?.info || null; |
| 209 | this.expiresAt = accessInfo?.expiresAt || null; |
| 210 | |
| 211 | // Load ALL network logs globally (not just for this session) |
| 212 | this.networkLogs = this.app.services.networkLogger.getAllLogs(); |
| 213 | this.previousLogCount = this.networkLogs.length; |
| 214 | |
| 215 | // Only update the top section (API key/tickets) without re-rendering logs |
| 216 | this.renderTopSectionOnly(); |
| 217 | this.startExpirationTimer(); |
| 218 | |
| 219 | // Ensure scroll is at bottom when switching sessions |
| 220 | requestAnimationFrame(() => { |
| 221 | this.scrollToBottomInstant(); |
no test coverage detected