fix(v0.2.3): dashboard polling for LLM blog pipeline
Root cause: pollBlogLlm() checked for 'llm' in generated_by but pipeline sets 'fo-blog-engine-v3'. Dashboard showed template forever. Fixes: - Poll check: now detects any non-template generated_by - Poll timeout: 20s interval × 60 attempts = 20 min (pipeline takes ~10 min) - Status toast shows pipeline step progress (Step X/10) - Generation message tells user LLM runs ~10 min in background - Version bump to v0.2.3
This commit is contained in:
parent
9bb2f549f8
commit
4233118505
@ -67,7 +67,7 @@ app.get("/", (_req, res) => {
|
||||
app.get("/api", (_req, res) => {
|
||||
res.json({
|
||||
name: "Transceiver Intelligence Platform",
|
||||
version: "0.2.2",
|
||||
version: "0.2.3",
|
||||
endpoints: [
|
||||
"GET /api/transceivers?q=&form_factor=&speed=&category=&fiber_type=&wdm_type=&coherent=",
|
||||
"GET /api/transceivers/:id",
|
||||
|
||||
@ -14,7 +14,7 @@ healthRouter.get("/", async (_req: Request, res: Response) => {
|
||||
res.json({
|
||||
success: true,
|
||||
status: "healthy",
|
||||
version: "0.2.2",
|
||||
version: "0.2.3",
|
||||
uptime: process.uptime(),
|
||||
database: {
|
||||
connected: true,
|
||||
|
||||
@ -2287,7 +2287,7 @@ function copyBlogContent(id) {
|
||||
|
||||
// BLOG
|
||||
function generateBlog(topic, speed) {
|
||||
el('blog-list').innerHTML = '<div class="loading pulse">Generating article...</div>';
|
||||
el('blog-list').innerHTML = '<div class="loading pulse" id="blog-gen-status">Generating template... LLM 10-step pipeline starts in background (~10 min)</div>';
|
||||
var body = { topic: topic };
|
||||
if (speed) body.speed = speed;
|
||||
fetch(API + '/api/blog/generate', {
|
||||
@ -2308,17 +2308,17 @@ function generateBlog(topic, speed) {
|
||||
}
|
||||
|
||||
function pollBlogLlm(id, attempt) {
|
||||
if (attempt > 30) return;
|
||||
if (attempt > 60) { showToast("Timeout", "LLM pipeline took too long. Check logs."); return; }
|
||||
setTimeout(function() {
|
||||
api('/api/blog/' + id).then(function(data) {
|
||||
if (data.draft && data.draft.generated_by && data.draft.generated_by.includes('llm')) {
|
||||
if (data.draft && data.draft.generated_by && data.draft.generated_by && data.draft.generated_by !== 'tip-blog-engine-template' && data.draft.generated_by !== null) {
|
||||
showToast('LLM Enhanced', data.draft.title + ' — ' + data.draft.word_count + ' words');
|
||||
loadBlogDrafts();
|
||||
} else {
|
||||
pollBlogLlm(id, attempt + 1);
|
||||
var steps = data.draft.pipeline_steps_completed || 0; showToast("LLM Step " + steps + "/10", "Pipeline running..."); pollBlogLlm(id, attempt + 1);
|
||||
}
|
||||
}).catch(function() {});
|
||||
}, 10000);
|
||||
}, 20000);
|
||||
}
|
||||
|
||||
el('gen-hype').addEventListener('click', function() { generateBlog('hype_cycle', '800G'); });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user