[object Object]

← back to Wallco Ai

wallco-ai: log Gemini usage to cost-tracker at 2 call sites (critique + style-analysis)

f78cfec884bebc54d8804c00d21a759244c77130 · 2026-05-12 17:51:33 -0700 · Steve

Files touched

Diff

commit f78cfec884bebc54d8804c00d21a759244c77130
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue May 12 17:51:33 2026 -0700

    wallco-ai: log Gemini usage to cost-tracker at 2 call sites (critique + style-analysis)
---
 server.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/server.js b/server.js
index ce4a5bb..93bb72f 100644
--- a/server.js
+++ b/server.js
@@ -644,6 +644,17 @@ setInterval(() => load(true), 30000);
 // check as a CRITICAL bypass (anyone could mint a token with {role:"admin"}).
 const { isAdmin, requireAdmin } = require('./src/admin-gate');
 
+// ── /admin/reload-designs — re-read data/designs.json without a pm2 reload.
+// Localhost-admin per src/admin-gate. Used by drunk-animals tick + future
+// generators to surface freshly persisted designs in the live grid without
+// restarting the server.
+app.post('/admin/reload-designs', (req, res) => {
+  if (!isAdmin(req)) return res.status(404).type('html').send('<h1>404</h1>');
+  const before = DESIGNS.length;
+  loadDesigns();
+  res.json({ ok: true, before, after: DESIGNS.length, catalog_last_modified: CATALOG_LAST_MODIFIED });
+});
+
 // ── TRADE LOGIN (separate from admin layer) — magic-link, no passwords.
 // Sister cookie to dw_auth; different name (`wallco_trade_session`), different
 // table (wallco_trade_users), so admin and trade tiers never collide.
@@ -8092,6 +8103,10 @@ Critique as a designer who places this in HIGH-END interiors (Hermès, Soho Hous
           }
         );
         const j = await r.json();
+        try {
+          const { logGemini } = require(require('path').join(require('os').homedir(), '.claude/skills/cost-tracker/scripts/log-gemini.js'));
+          logGemini(j, { app: 'wallco-ai', model: 'gemini-2.0-flash', note: 'design-critique ' + (d.id || '') });
+        } catch {}
         const t = j.candidates?.[0]?.content?.parts?.[0]?.text;
         if (t) {
           try { critique = JSON.parse(t.replace(/^```json\s*|\s*```$/g, '')); } catch {}
@@ -8294,6 +8309,10 @@ print(f"#{r:02x}{g:02x}{b:02x}")
           }
         );
         const j = await r.json();
+        try {
+          const { logGemini } = require(require('path').join(require('os').homedir(), '.claude/skills/cost-tracker/scripts/log-gemini.js'));
+          logGemini(j, { app: 'wallco-ai', model: 'gemini-2.0-flash', note: 'style-element-analysis' });
+        } catch {}
         const t = j.candidates && j.candidates[0] && j.candidates[0].content
                   && j.candidates[0].content.parts && j.candidates[0].content.parts[0]
                   && j.candidates[0].content.parts[0].text;

← 47eb2ff wall-calc: surface pinned W×H chip in summary so collapsed P  ·  back to Wallco Ai  ·  drunk-animal overnight generator + /admin/reload-designs 66cfe47 →