(model: { providerID: string; modelID: string })
| 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 |
nothing calls this directly
no test coverage detected