Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
Root cause resolu: WEVIA simulait quand demande UX via Gemini. Apres scan Option C: 0 intents gemini_ux_review ou fix_page_ux existants. Opus wire cause-racine (Option A). Artefacts deployes: - /var/www/html/api/wevia-gemini-ux.sh (4KB handler end-to-end) Pipeline: Playwright screenshot -> Gemini 2.5 Flash vision review -> JSON plan refonte Fix bug playwright require (cd /var/www/html/api avant node) Fix parser bash bad substitution (Python inline cleaner) maxTokens 4000 (vs 80 v1 qui tronquait) - /var/www/html/api/wired-pending/intent-opus4-wevia_gemini_ux_fix.php 10 triggers NL: gemini ux, refais ux, review ux gemini, audit ux gemini, etc. status EXECUTED - integre routing opus4 stubs fired before fast-path-v3 - /var/www/html/api/wgux-shot.js (Playwright screenshot module) E2E test leadforge: - before.png 58KB genere OK - gemini-raw.json 1.3KB Gemini repond - review.json 774B avec critique detaillee - Verdict Gemini: Manque profondeur fonctionnelle. Experience statique. Absence KPIs graphiques badges indicateurs performance temps reel. EXACTEMENT ce que Yacine a identifie avant wire. Validation WEVIA-FIRST: - Yacine test chat role non-tech: WEVIA simulait avec intent code_real sur fragments - Cross-scan registry: 0 intents gemini/ux_review existants - Cause-racine: handlers Opus (gemini-vision-*) jamais wired en intent Cumul: - 55 tags Opus (54+1) - 38 doctrines (146-199) - Train multi-Claude sync 222+ intents LIVE Next: Yacine peut dire a WEVIA via chat: gemini ux <page> WEVIA execute reellement Gemini UX review + publie proof URL.
85 lines
3.9 KiB
Bash
Executable File
85 lines
3.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Doctrine 199: WEVIA Gemini UX Fix v2 - fix parser + maxTokens 4000
|
|
set -u
|
|
PAGE="${1:-weval-technology-platform}"
|
|
PAGE="${PAGE%.html}"
|
|
|
|
TARGET=""
|
|
if [ -f "/var/www/html/${PAGE}.html" ]; then
|
|
TARGET="/var/www/html/${PAGE}.html"
|
|
elif [ -f "/var/www/html/products/${PAGE}.html" ]; then
|
|
TARGET="/var/www/html/products/${PAGE}.html"
|
|
else
|
|
echo "{\"ok\":false,\"err\":\"page_not_found\",\"page\":\"$PAGE\"}"
|
|
exit 1
|
|
fi
|
|
|
|
KG=$(grep "^GEMINI_KEY=" /etc/weval/secrets.env 2>/dev/null | cut -d= -f2- | tr -d '"' | head -c 80)
|
|
[ -z "$KG" ] && { echo '{"ok":false,"err":"no_gemini_key"}'; exit 1; }
|
|
|
|
TS=$(date +%Y%m%d-%H%M%S)
|
|
OUT="/var/www/html/proofs/wevia-gemini-ux-fix-$TS"
|
|
mkdir -p "$OUT"
|
|
|
|
# 1) Playwright screenshot
|
|
cat > /var/www/html/api/wgux-shot.js << 'JSEOF'
|
|
const { chromium } = require("playwright");
|
|
(async () => {
|
|
const url = process.argv[2];
|
|
const out = process.argv[3];
|
|
const browser = await chromium.launch({ headless: true, args: ["--no-sandbox","--disable-gpu","--disable-dev-shm-usage"] });
|
|
const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } });
|
|
const pg = await ctx.newPage();
|
|
await pg.goto(url, { waitUntil: "domcontentloaded", timeout: 20000 });
|
|
await pg.waitForTimeout(3000);
|
|
await pg.screenshot({ path: out, fullPage: false });
|
|
await browser.close();
|
|
console.log("SHOT_OK");
|
|
})();
|
|
JSEOF
|
|
|
|
URL="https://weval-consulting.com/${TARGET#/var/www/html/}"
|
|
timeout 45 bash -c "cd /var/www/html/api && node wgux-shot.js \"$URL\" \"$OUT/before.png\"" > /tmp/wgux-shot.log 2>&1
|
|
[ ! -f "$OUT/before.png" ] && { echo "{\"ok\":false,\"err\":\"playwright_fail\"}"; exit 1; }
|
|
|
|
# 2) Gemini review with 4000 tokens
|
|
base64 -w0 < "$OUT/before.png" > "$OUT/before.b64"
|
|
python3 -c "
|
|
import json
|
|
with open('$OUT/before.b64') as f: b64=f.read().strip()[:400000]
|
|
prompt='Tu es agent UX premium WEVAL Technology Platform (ERP SaaS). Analyse cette page. CRITIQUE UX. PROPOSE plan refonte PREMIUM: cartes gradient teal/yellow bg dark, icones, KPIs live sparklines, badges status color-coded, action buttons (Open Configure Logs Test), hierarchy forte, zero chauvauchement. JSON strict sans markdown: {\\\"critique\\\":[\\\"prob1\\\",\\\"prob2\\\"],\\\"score_actuel\\\":N,\\\"plan_refonte\\\":[{\\\"module\\\":\\\"nom\\\",\\\"cards_premium\\\":\\\"desc\\\",\\\"kpis\\\":[\\\"x\\\",\\\"y\\\"],\\\"actions\\\":[\\\"Open\\\",\\\"Test\\\"]}],\\\"css_suggest\\\":\\\"CSS key-value\\\"}'
|
|
print(json.dumps({'contents':[{'parts':[{'text':prompt},{'inline_data':{'mime_type':'image/png','data':b64}}]}],'generationConfig':{'temperature':0.3,'maxOutputTokens':4000}}))
|
|
" > "$OUT/payload.json"
|
|
|
|
curl -sk -m 90 -X POST "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent?key=$KG" \
|
|
-H "Content-Type: application/json" -d @"$OUT/payload.json" > "$OUT/gemini-raw.json" 2>&1
|
|
|
|
# 3) Parse - robust python script separate
|
|
python3 -c "
|
|
import json, re, os
|
|
with open('$OUT/gemini-raw.json') as f: resp=json.load(f)
|
|
try:
|
|
text=resp['candidates'][0]['content']['parts'][0]['text']
|
|
text=re.sub(r'\`\`\`[a-z]*','',text).strip()
|
|
m=re.search(r'\{.*\}',text,re.DOTALL)
|
|
out={}
|
|
if m:
|
|
try:
|
|
parsed=json.loads(m.group(0))
|
|
out={'ok':True,'review':parsed,'finishReason':resp['candidates'][0].get('finishReason')}
|
|
except:
|
|
out={'ok':False,'raw':text[:3000],'finishReason':resp['candidates'][0].get('finishReason'),'parse_err':'json_decode_fail'}
|
|
else:
|
|
out={'ok':False,'raw':text[:3000],'finishReason':resp['candidates'][0].get('finishReason')}
|
|
with open('$OUT/review.json','w') as f:
|
|
json.dump(out,f,ensure_ascii=False,indent=2)
|
|
print('REVIEW_OK')
|
|
except Exception as e:
|
|
print('ERR',str(e)[:100])
|
|
" >> /tmp/wgux-shot.log 2>&1
|
|
|
|
rm -f "$OUT/before.b64" "$OUT/payload.json"
|
|
|
|
PROOF_URL="https://weval-consulting.com/proofs/wevia-gemini-ux-fix-$TS"
|
|
echo "{\"ok\":true,\"page\":\"$PAGE\",\"target\":\"$TARGET\",\"proofs\":\"$PROOF_URL\",\"shot\":\"$PROOF_URL/before.png\",\"review\":\"$PROOF_URL/review.json\"}"
|