fix(admin): trend chart height 100px, logs 3-column layout, KPI cards clickable links, AI timeout 120s env var, X/Pinterest settings

This commit is contained in:
chattie
2026-08-24 22:09:12 +02:00
parent 30f0cb0702
commit 2ed2ac8cd1
11 changed files with 105 additions and 9 deletions

View File

@@ -1,5 +1,8 @@
import { AppError } from './errors.js';
/** Default AI timeout: 2 minutes for complex product descriptions */
const AI_TIMEOUT_MS = Number.parseInt(process.env.AI_TIMEOUT_MS ?? '120000', 10);
/**
* Shared helpers for AI content generation (OpenAI-compatible chat API)
* and HTML formatting of the generated text.
@@ -15,7 +18,7 @@ export async function generateWithModel(
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ model, messages: [{ role: 'user', content: prompt }], temperature: 0.4 }),
signal: AbortSignal.timeout(30_000),
signal: AbortSignal.timeout(AI_TIMEOUT_MS),
});
const payload = (await response.json().catch(() => null)) as {
choices?: Array<{ message?: { content?: unknown } }>;