* List all models from all sources (remote + local)
()
| 204 | * List all models from all sources (remote + local) |
| 205 | */ |
| 206 | public listModels(): ModelsResponse { |
| 207 | const localModels = this.getLocalModels(); |
| 208 | |
| 209 | // Sort: local models first, then user-managed servers, then Observer cloud, then skip model last |
| 210 | const sortedModels = [...this.remoteModels, ...localModels].sort((a, b) => { |
| 211 | const aScore = a.server === ModelManager.SKIP_MODEL ? 3 |
| 212 | : this.isLocalModel(a.server) ? 0 |
| 213 | : a.server.includes('api.observer-ai.com') ? 2 |
| 214 | : 1; |
| 215 | const bScore = b.server === ModelManager.SKIP_MODEL ? 3 |
| 216 | : this.isLocalModel(b.server) ? 0 |
| 217 | : b.server.includes('api.observer-ai.com') ? 2 |
| 218 | : 1; |
| 219 | return aScore - bScore; |
| 220 | }); |
| 221 | |
| 222 | return { models: sortedModels }; |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Get local models converted to the unified Model format. |
no test coverage detected