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

Method checkServer

app/src/utils/ModelManager.ts:475–498  ·  view source on GitHub ↗
(address: string)

Source from the content-addressed store, hash-verified

473 }
474
475 public async checkServer(address: string): Promise<{ status: 'online' | 'offline'; error?: string }> {
476 try {
477 const response = await platformFetch(`${address}/v1/models`, {
478 method: 'GET',
479 headers: { 'Content-Type': 'application/json' },
480 });
481
482 if (response.ok) {
483 return { status: 'online' };
484 }
485
486 return {
487 status: 'offline',
488 error: `Server responded with status ${response.status}`
489 };
490 } catch (error) {
491 const detail = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
492 console.error(`[ModelManager] checkServer(${address}) failed:`, error);
493 return {
494 status: 'offline',
495 error: `Could not connect to server (${detail})${error instanceof TypeError ? '\nMaybe check CORS?' : ''}`
496 };
497 }
498 }
499
500 // ===========================================================================
501 // Local Model Management (unified interface)

Callers 2

checkCustomServerMethod · 0.95
checkInferenceServerFunction · 0.80

Calls 2

platformFetchFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected