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

Method fetchModels

app/src/utils/ModelManager.ts:275–303  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

273 * Fetch models from all sources (remote servers + refresh local cache)
274 */
275 public async fetchModels(): Promise<ModelsResponse> {
276 try {
277 const allModels: Model[] = [];
278
279 // Fetch from all inference addresses
280 for (const address of this.inferenceAddresses) {
281 const models = await this.fetchFromAddress(address);
282 allModels.push(...models);
283 }
284
285 // Update remote models state
286 this.remoteModels = allModels;
287
288 // Refresh local model caches
289 // llama.cpp models (Tauri only)
290 if (isTauri()) {
291 await NativeLlmManager.getInstance().refreshGgufCache();
292 }
293 // Note: GemmaModelManager doesn't have a refresh - it reads from localStorage synchronously
294
295 this.notifyListeners();
296 return this.listModels();
297 } catch (error) {
298 return {
299 models: [],
300 error: `Could not retrieve models: ${error instanceof Error ? error.message : String(error)}`
301 };
302 }
303 }
304
305 /**
306 * 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