* List all models from all sources (remote + local)
()
| 192 | * List all models from all sources (remote + local) |
| 193 | */ |
| 194 | public listModels(): ModelsResponse { |
| 195 | const localModels = this.getLocalModels(); |
| 196 | |
| 197 | // Sort: local models first, then user-managed servers, then Observer cloud, then skip model last |
| 198 | const sortedModels = [...this.remoteModels, ...localModels].sort((a, b) => { |
| 199 | const aScore = a.server === ModelManager.SKIP_MODEL ? 3 |
| 200 | : this.isLocalModel(a.server) ? 0 |
| 201 | : a.server.includes('api.observer-ai.com') ? 2 |
| 202 | : 1; |
| 203 | const bScore = b.server === ModelManager.SKIP_MODEL ? 3 |
| 204 | : this.isLocalModel(b.server) ? 0 |
| 205 | : b.server.includes('api.observer-ai.com') ? 2 |
| 206 | : 1; |
| 207 | return aScore - bScore; |
| 208 | }); |
| 209 | |
| 210 | return { models: sortedModels }; |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Get local models converted to the unified Model format. |
no test coverage detected