(cmd)
| 85 | } |
| 86 | |
| 87 | function execCmd(cmd) { |
| 88 | cmd = normalizeSlashCommandInput(cmd) || String(cmd || '').trim().toLowerCase(); |
| 89 | hideCmdMenu(); |
| 90 | $input.value = ''; |
| 91 | $input.style.height = 'auto'; |
| 92 | updateSendBtn(); |
| 93 | |
| 94 | if (cmd === '/model') { |
| 95 | showModelPicker(); |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | if (cmd === '/cost') { |
| 100 | closeGroup(); |
| 101 | const el = document.createElement('div'); |
| 102 | el.className = 'user-msg'; |
| 103 | el.textContent = '/cost'; |
| 104 | $msgs.appendChild(el); |
| 105 | scrollEnd(); |
| 106 | sendSlashCmd(cmd); |
| 107 | return; |
| 108 | } |
| 109 | |
| 110 | if (cmd === '/clear') { |
| 111 | clearConversationUi(); |
| 112 | S.sessionId = ''; |
| 113 | S.resumeRequestedFor = ''; |
| 114 | sendSlashCmd(cmd); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | const fb = CMD_FEEDBACK[cmd]; |
| 119 | if (fb) { |
| 120 | if (fb.overlay) showCmdOverlay(fb.label); |
| 121 | else if (fb.toast) showToast(fb.toast); |
| 122 | } |
| 123 | sendSlashCmd(cmd); |
| 124 | } |
| 125 | |
| 126 | export function sendSlashCmd(text) { |
| 127 | if (!S.ws || S.ws.readyState !== WebSocket.OPEN) return; |
no test coverage detected