mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: eagerly start AI dispatcher at boot and log actual GPU status
Replaces the misleading 'waiting for AI sidecar startup...' message that never resolved. The dispatcher now starts during server init, and the startup log shows the actual GPU detection result.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { randomUUID } from "node:crypto";
|
import { randomUUID } from "node:crypto";
|
||||||
import cors from "@fastify/cors";
|
import cors from "@fastify/cors";
|
||||||
import rateLimit from "@fastify/rate-limit";
|
import rateLimit from "@fastify/rate-limit";
|
||||||
import { getDispatcherStatus, isGpuAvailable } from "@snapotter/ai";
|
import { getDispatcherStatus, initDispatcher, isGpuAvailable } from "@snapotter/ai";
|
||||||
import { APP_VERSION } from "@snapotter/shared";
|
import { APP_VERSION } from "@snapotter/shared";
|
||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import Fastify from "fastify";
|
import Fastify from "fastify";
|
||||||
@@ -242,12 +242,13 @@ const cleanupCron = startCleanupCron();
|
|||||||
// Start
|
// Start
|
||||||
try {
|
try {
|
||||||
await app.listen({ port: env.PORT, host: "0.0.0.0" });
|
await app.listen({ port: env.PORT, host: "0.0.0.0" });
|
||||||
const dispatcherStatus = getDispatcherStatus();
|
|
||||||
const gpuLine = !dispatcherStatus.ready
|
const dispatcherResult = await initDispatcher();
|
||||||
? "[INFO] GPU status: waiting for AI sidecar startup..."
|
const gpuLine = dispatcherResult.ready
|
||||||
: dispatcherStatus.gpu
|
? dispatcherResult.gpu
|
||||||
? "[INFO] GPU detected — AI tools will use CUDA acceleration"
|
? "[INFO] GPU detected -- AI tools will use CUDA acceleration"
|
||||||
: "[WARN] No GPU detected — AI tools will use CPU (slower)";
|
: "[WARN] No GPU detected -- AI tools will use CPU (slower)"
|
||||||
|
: "[WARN] AI sidecar did not start -- AI tools will use per-request Python (slower)";
|
||||||
console.log(
|
console.log(
|
||||||
[
|
[
|
||||||
`SnapOtter v${APP_VERSION} running on port ${env.PORT}`,
|
`SnapOtter v${APP_VERSION} running on port ${env.PORT}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user