MCPcopy Create free account
hub / github.com/NsLearning/LangHelper / cmdInput

Function cmdInput

ChatGPT/src-tauri/src/scripts/cmd.js:273–298  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271 searchInput.addEventListener('keydown', cmdKeydown, { capture: true });
272
273 function cmdInput() {
274 if (searchInput.value === '') {
275 initDom();
276 }
277
278 if (window.__CHAT_MODEL_STATUS__) return;
279
280 const query = searchInput.value;
281 if (!query || !/^\//.test(query)) {
282 initDom();
283 return;
284 }
285
286 // all cmd result
287 if (query === '/') {
288 renderList(data);
289 return;
290 }
291
292 const result = data.filter(i => new RegExp(query.substring(1)).test(i.cmd));
293 if (result.length > 0) {
294 renderList(result);
295 } else {
296 initDom();
297 }
298 }
299 searchInput.removeEventListener('input', cmdInput);
300 searchInput.addEventListener('input', cmdInput);
301 }

Callers

nothing calls this directly

Calls 2

initDomFunction · 0.85
renderListFunction · 0.85

Tested by

no test coverage detected