| 244 | } |
| 245 | }), |
| 246 | cycle(direction: 1 | -1) { |
| 247 | const current = currentModel() |
| 248 | if (!current) return |
| 249 | const recent = modelStore.recent |
| 250 | const index = recent.findIndex((x) => x.providerID === current.providerID && x.modelID === current.modelID) |
| 251 | if (index === -1) return |
| 252 | let next = index + direction |
| 253 | if (next < 0) next = recent.length - 1 |
| 254 | if (next >= recent.length) next = 0 |
| 255 | const val = recent[next] |
| 256 | if (!val) return |
| 257 | setModelStore("model", agent.current().name, { ...val }) |
| 258 | }, |
| 259 | cycleFavorite(direction: 1 | -1) { |
| 260 | const favorites = modelStore.favorite.filter((item) => isModelValid(item)) |
| 261 | if (!favorites.length) { |