MCPcopy Create free account
hub / github.com/Roy3838/Observer / fetchModels

Method fetchModels

app/src/utils/ModelManager.ts:261–289  ·  view source on GitHub ↗

* Fetch models from all sources (remote servers + refresh local cache)

()

Source from the content-addressed store, hash-verified

259 * Fetch models from all sources (remote servers + refresh local cache)
260 */
261 public async fetchModels(): Promise<ModelsResponse> {
262 try {
263 const allModels: Model[] = [];
264
265 // Fetch from all inference addresses
266 for (const address of this.inferenceAddresses) {
267 const models = await this.fetchFromAddress(address);
268 allModels.push(...models);
269 }
270
271 // Update remote models state
272 this.remoteModels = allModels;
273
274 // Refresh local model caches
275 // llama.cpp models (Tauri only)
276 if (isTauri()) {
277 await NativeLlmManager.getInstance().refreshGgufCache();
278 }
279 // Note: GemmaModelManager doesn't have a refresh - it reads from localStorage synchronously
280
281 this.notifyListeners();
282 return this.listModels();
283 } catch (error) {
284 return {
285 models: [],
286 error: `Could not retrieve models: ${error instanceof Error ? error.message : String(error)}`
287 };
288 }
289 }
290
291 /**
292 * Fetch models from a single address

Callers 4

sendPromptMethod · 0.95
sendMessagesMethod · 0.95
sendToolMessagesMethod · 0.95
fetchModelsFunction · 0.80

Calls 7

fetchFromAddressMethod · 0.95
notifyListenersMethod · 0.95
listModelsMethod · 0.95
isTauriFunction · 0.90
pushMethod · 0.80
refreshGgufCacheMethod · 0.80
getInstanceMethod · 0.45

Tested by

no test coverage detected