AI desktop path: plain-HTML Review and Cost tabs over the Qt bridge, gate in Python
ai_sections.html pastes into the no-AI dashboard.html; ai_bridge.py adds one ai_request slot that hands every AI contract request (incl. GET /roi) to the review backend's dispatch(). Desktop page check reruns the web review and cost cases plus a tampered-page gate case. Eval fixture e-pyqt-ai added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
128f153f84
commit
d89dce3c33
13 files changed
+203
-14
No files matched your search
+21
-2
@@ -80,6 +80,17 @@ FIXTURES = {
|
||||
"page_has": ["--accent:#ff3049"],
|
||||
"ai": True,
|
||||
},
|
||||
# (e) PyQt bot with an LLM extraction call: the AI skill's desktop path, no web server.
|
||||
"e-pyqt-ai": {
|
||||
"prompt": "Build me an RPA dashboard for this project. I can't answer questions while you "
|
||||
"work, so here are my answers to anything the skill asks. Colours: Tebra Sky. "
|
||||
"Optional sections: none.",
|
||||
"frontend": r"^\s*(none|no\b)",
|
||||
"asks": [r"colou?r", r"section"],
|
||||
"never_asks": [r"\bkeep\b|restyle", r"desktop|web"],
|
||||
"bot": True,
|
||||
"ai_desktop": True,
|
||||
},
|
||||
}
|
||||
# A line a restyle may change: a custom property, a comment, a blank, or a web-font link.
|
||||
TOKEN_LINE = r"^\s*(--[\w-]+\s*:.*|/\*.*\*/|<link[^>]*fonts\.googleapis\.com.*|@import.*fonts\.googleapis\.com.*)?\s*$"
|
||||
@@ -171,6 +182,11 @@ def main(fixture):
|
||||
html += css.read_text(encoding="utf-8") if css.exists() else ""
|
||||
checks["AI path: review starter and server stub built"] = all(
|
||||
(pages[0].parent / f).exists() for f in ["server_stub.py", "bands.py", "src/components/Review.tsx"])
|
||||
if cfg.get("ai_desktop"): # the no-AI page with the plain-HTML AI sections, hosted by ai_bridge.py
|
||||
host = pages[0].with_name("ai_bridge.py")
|
||||
checks["AI desktop path: sections, ai_bridge and review backend built"] = 'id="ai-review-tab"' in html and all(
|
||||
pages[0].with_name(f).exists() for f in ["ai_bridge.py", "server_stub.py", "bands.py", "pricing.py"])
|
||||
checks["no placeholders left in ai_bridge.py"] = host.exists() and "{{" not in host.read_text(encoding="utf-8")
|
||||
shutil.copy(pages[0], results / f"{fixture}.dashboard.html")
|
||||
checks["no placeholders left"] = "{{" not in html
|
||||
if cfg.get("brand"):
|
||||
@@ -186,8 +202,11 @@ def main(fixture):
|
||||
env.update(bot_checks(project, html, checks, results / f"{fixture}.run.jsonl"))
|
||||
if cfg.get("ai"):
|
||||
env["PAGE_CHECK_AI_DIR"] = str(pages[0].parent)
|
||||
check_dir = ROOT / "tests" / ("page_check_ai" if cfg.get("ai") else "page_check")
|
||||
pc = subprocess.run([sys.executable, "-m", "pytest", str(check_dir), "-q"],
|
||||
check_dirs = [ROOT / "tests" / ("page_check_ai" if cfg.get("ai") else "page_check")]
|
||||
if cfg.get("ai_desktop"):
|
||||
env["PAGE_CHECK_AI_DESKTOP_DIR"] = str(pages[0].parent)
|
||||
check_dirs.append(ROOT / "tests" / "page_check_ai_desktop")
|
||||
pc = subprocess.run([sys.executable, "-m", "pytest", *map(str, check_dirs), "-q"],
|
||||
env=env, capture_output=True, text=True)
|
||||
checks["page check passes"] = pc.returncode == 0
|
||||
page_check = pc.stdout.strip().splitlines()[-1:] if pc.stdout else [pc.stderr[-500:]]
|
||||
|
||||
Reference in new issue
Block a user