MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / showModelPicker

Function showModelPicker

app/src/modules/model-picker.js:10–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8import { sendControlInput, sendSlashCmd, sendControlLine } from './input.js';
9
10export function showModelPicker() {
11 const list = $('model-list');
12 list.innerHTML = MODELS.map(m =>
13 `<div class="model-item" data-num="${m.num}">
14 <span class="mi-num">${m.num}</span>
15 <div class="mi-info">
16 <span class="mi-name">${m.label}</span>
17 <span class="mi-desc">${m.desc}</span>
18 </div>
19 </div>`
20 ).join('');
21
22 list.querySelectorAll('.model-item').forEach(el => {
23 el.addEventListener('click', () => {
24 const picked = MODELS.find(m => m.num === el.dataset.num);
25 hideModelPicker();
26 if (!S.ws || S.ws.readyState !== WebSocket.OPEN) return;
27 showToast('Switching to ' + (picked ? picked.label : 'model') + '...');
28 sendControlInput('\x1b');
29 setTimeout(() => {
30 if (S.ws?.readyState === WebSocket.OPEN) sendSlashCmd('/model');
31 }, 250);
32 sendControlLine(el.dataset.num, { startDelayMs: 2400, submitDelayMs: 140 });
33 });
34 });
35
36 $('model-picker').classList.add('visible');
37}
38
39export function hideModelPicker() {
40 $('model-picker').classList.remove('visible');

Callers 1

execCmdFunction · 0.90

Calls 6

$Function · 0.90
showToastFunction · 0.90
sendControlInputFunction · 0.90
sendSlashCmdFunction · 0.90
sendControlLineFunction · 0.90
hideModelPickerFunction · 0.70

Tested by

no test coverage detected