super secret fix

This commit is contained in:
Alex Cheema
2025-10-07 22:16:03 +01:00
parent beda699ffb
commit 7282ca964c
2 changed files with 25 additions and 12 deletions

View File

@@ -1931,6 +1931,11 @@
return fallback;
};
// Helper: detect API placeholders like "unknown" (case-insensitive)
const isUnknown = (value) => {
return typeof value === 'string' && value.trim().toLowerCase() === 'unknown';
};
// Process nodes from topology or fallback to node_profiles directly
let nodesToProcess = {};
if (clusterState.topology && Array.isArray(clusterState.topology.nodes)) {
@@ -1961,10 +1966,15 @@
memBytesAvailable = getBytes(ramAvailVal);
const memBytesUsed = Math.max(memBytesTotal - memBytesAvailable, 0);
// Extract model information
const modelId = pick(nodeProfile, 'model_id', 'modelId', 'Unknown');
const chipId = pick(nodeProfile, 'chip_id', 'chipId', '');
const friendlyName = pick(nodeProfile, 'friendly_name', 'friendlyName', `${nodeId.substring(0, 8)}...`);
// Extract model information with graceful placeholders while node is loading
const rawModelId = pick(nodeProfile, 'model_id', 'modelId', 'Unknown');
const rawChipId = pick(nodeProfile, 'chip_id', 'chipId', '');
const rawFriendlyName = pick(nodeProfile, 'friendly_name', 'friendlyName', `${nodeId.substring(0, 8)}...`);
// When API has not fully loaded (reports "unknown"), present a nice default
const modelId = isUnknown(rawModelId) ? 'Mac Studio' : rawModelId;
const chipId = isUnknown(rawChipId) ? '' : rawChipId;
const friendlyName = (!rawFriendlyName || isUnknown(rawFriendlyName)) ? 'Mac' : rawFriendlyName;
// Extract network addresses (support snake_case and camelCase)
const addrList = [];

View File

@@ -26,6 +26,7 @@ from exo.utils.chainlit_ui import (
launch_chainlit,
terminate_process,
)
from exo.utils.browser import open_url_in_browser_when_ready
# TODO: Entrypoint refactor
@@ -168,7 +169,9 @@ def main():
# TODO: Refactor the current verbosity system
logger_setup(EXO_LOG, args.verbosity)
logger.info("Starting EXO")
node = anyio.run(Node.create, args)
ui_proc = None
if args.with_chainlit:
cfg = ChainlitConfig(
@@ -177,16 +180,16 @@ def main():
ui_dir=os.path.abspath(os.path.join(os.path.dirname(__file__), "ui")),
)
try:
ui_proc = launch_chainlit(cfg)
ui_proc = launch_chainlit(cfg, wait_ready=False)
logger.info(
f"Chainlit running at http://{cfg.host}:{cfg.port} (UI -> API http://localhost:8000/v1)"
f"Launching Chainlit (non-blocking) at http://{cfg.host}:{cfg.port} (UI -> API http://localhost:8000/v1)"
)
except ChainlitLaunchError as e:
logger.error(str(e))
logger_cleanup()
raise
node = anyio.run(Node.create, args)
logger.warning(f"Chainlit not started: {e}")
# Open the dashboard once the API is reachable.
if args.spawn_api:
open_url_in_browser_when_ready(f"http://localhost:{args.api_port}")
try:
anyio.run(node.run)
finally: