mirror of
https://github.com/bitbaum/botsmann.git
synced 2026-12-04 05:08:02 +01:00
Botsmann now runs self-hosted on the Hetzner box "bitbaum" behind Caddy (botsmann.orangecat.ch); Vercel is fully decommissioned. - CI: rename the "Deploy to Vercel" workflow to a vendor-neutral CI workflow (build/lint/test only). Actual deploy runs from .husky/pre-push → Hetzner deploy script. Remove vercel.json and the Vercel-only deploy-monitor.sh. - Docs: rewrite current-setup deploy/hosting text in .claude/CLAUDE.md, README badge, docs/COMMANDS.md and docs/SHARED_CONTEXT.md to the self-hosted box. Repoint the dead botsmann.vercel.app URL → botsmann.orangecat.ch. - Code: neutralize "(Vercel)" route-segment comments; reword the warmup cron comment; update the demo page tech-stack line to self-hosted. - Keep: secret-scan guardrail (VERCEL_OIDC_TOKEN) and `env -u VERCEL` in the husky hooks, the educational hosting-comparison page, historical docs/archive, and executive-docs business/finance planning material (see PR body). Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
/**
|
|
* Warmup API Endpoint
|
|
*
|
|
* GET /api/warmup - Pre-loads the embedding model to avoid cold start delays
|
|
*
|
|
* Called periodically by a cron/uptime check to keep the embedding model warm
|
|
*/
|
|
|
|
import { NextResponse } from 'next/server';
|
|
import { generateEmbedding } from '@/lib/embeddings';
|
|
import { logger } from '@/lib/logger';
|
|
|
|
// Extend function timeout for model loading
|
|
export const maxDuration = 60;
|
|
|
|
export async function GET() {
|
|
const startTime = Date.now();
|
|
logger.log('[Warmup] Starting warmup...');
|
|
|
|
try {
|
|
// Generate a simple embedding to load the model
|
|
await generateEmbedding('warmup test');
|
|
|
|
const elapsed = Date.now() - startTime;
|
|
logger.log(`[Warmup] Model loaded in ${elapsed} ms`);
|
|
|
|
return NextResponse.json({
|
|
success: true,
|
|
message: 'Embedding model warmed up',
|
|
loadTime: elapsed,
|
|
});
|
|
} catch (error) {
|
|
const elapsed = Date.now() - startTime;
|
|
logger.error(`[Warmup] Failed after ${elapsed} ms:`, error);
|
|
|
|
return NextResponse.json(
|
|
{
|
|
success: false,
|
|
error: 'Warmup failed',
|
|
elapsed,
|
|
},
|
|
{ status: 500 },
|
|
);
|
|
}
|
|
}
|