Initial 智念AIGC platform

This commit is contained in:
inman
2026-05-29 10:26:02 +08:00
commit f9c3393f84
86 changed files with 14741 additions and 0 deletions

26
scripts/health-check.mjs Normal file
View File

@@ -0,0 +1,26 @@
const port = process.env.PORT || process.env.NIANXX_PLAY_PORT || '3000';
const hostname = process.env.HOSTNAME || '127.0.0.1';
const baseUrl = process.env.NIANXXPLAY_PUBLIC_BASE_URL || `http://${hostname}:${port}`;
const healthUrl = new URL('/api/health', baseUrl).toString();
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 3000);
try {
const response = await fetch(healthUrl, { signal: controller.signal });
const text = await response.text();
if (!response.ok) {
console.error(`[health] ${response.status} ${response.statusText}: ${text}`);
process.exit(1);
}
const payload = JSON.parse(text);
console.log(JSON.stringify(payload, null, 2));
if (payload?.appId !== 'zhinian-web-studio' || !payload?.ok) {
process.exit(1);
}
} catch (error) {
console.error(`[health] Failed to reach ${healthUrl}: ${error instanceof Error ? error.message : String(error)}`);
process.exit(1);
} finally {
clearTimeout(timeout);
}