MCPcopy Create free account
hub / github.com/arctic-cli/interface / toggleFavorite

Function toggleFavorite

packages/arctic/src/cli/cmd/tui/context/local.tsx:308–327  ·  view source on GitHub ↗
(model: { providerID: string; modelID: string })

Source from the content-addressed store, hash-verified

306 })
307 },
308 toggleFavorite(model: { providerID: string; modelID: string }) {
309 batch(() => {
310 if (!isModelValid(model)) {
311 toast.show({
312 message: `Model ${model.providerID}/${model.modelID} is not valid`,
313 variant: "warning",
314 duration: 3000,
315 })
316 return
317 }
318 const exists = modelStore.favorite.some(
319 (x) => x.providerID === model.providerID && x.modelID === model.modelID,
320 )
321 const next = exists
322 ? modelStore.favorite.filter((x) => x.providerID !== model.providerID || x.modelID !== model.modelID)
323 : [model, ...modelStore.favorite]
324 setModelStore("favorite", next)
325 save()
326 })
327 },
328 }
329 })
330

Callers

nothing calls this directly

Calls 2

isModelValidFunction · 0.85
saveFunction · 0.70

Tested by

no test coverage detected