(session)
| 82 | } |
| 83 | |
| 84 | async function confirmSwitchSession(session) { |
| 85 | const label = trunc(getSessionTitle(session), 40); |
| 86 | const ok = await showConfirm(`切换到会话 "${label}"?\n当前对话进度不会丢失。`); |
| 87 | if (!ok) return; |
| 88 | closeSessionDrawer(); |
| 89 | if (S.ws && S.ws.readyState === WebSocket.OPEN) { |
| 90 | S.ws.send(JSON.stringify({ type: 'switch_session', sessionId: session.sessionId })); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | export function initSessions() { |
| 95 | $('btn-sessions').addEventListener('click', openSessionDrawer); |
no test coverage detected