MCPcopy Create free account
hub / github.com/cursor/cookbook / toggleModelPreference

Function toggleModelPreference

sdk/coding-agent-cli/src/tui/App.tsx:328–340  ·  view source on GitHub ↗
(preference: keyof ModelPreference)

Source from the content-addressed store, hash-verified

326 }
327
328 const toggleModelPreference = (preference: keyof ModelPreference) => {
329 setModelPreference((current) => {
330 const next = { ...current, [preference]: !current[preference] }
331 const selection = findPreferredSelection(model, modelItems, next)
332
333 if (selection) {
334 sessionRef.current?.setModel(selection)
335 setModel(selection)
336 }
337
338 return next
339 })
340 }
341
342 const selectCommand = (item: CommandSelectItem) => {
343 void runCommand(item.value)

Callers 1

AppFunction · 0.85

Calls 2

findPreferredSelectionFunction · 0.85
setModelMethod · 0.80

Tested by

no test coverage detected