Library as its own page; cards show what each member makes; Anthropic-calm palette; artifact previews in answers
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- APPLY-AND-PUSH.bat +17 -0
- assets/library-demos/academy_guide-1.gif +2 -2
- assets/library-demos/academy_guide-1.webp +3 -0
- assets/library-demos/algorithmic_art-1.gif +2 -2
- assets/library-demos/algorithmic_art-1.webp +3 -0
- assets/library-demos/brand_guidelines-1.gif +2 -2
- assets/library-demos/brand_guidelines-1.webp +3 -0
- assets/library-demos/canvas_design-1.gif +2 -2
- assets/library-demos/canvas_design-1.webp +3 -0
- assets/library-demos/claude_api-1.gif +2 -2
- assets/library-demos/claude_api-1.webp +3 -0
- assets/library-demos/create_deck-1.gif +2 -2
- assets/library-demos/create_deck-1.webp +3 -0
- assets/library-demos/create_docx-1.gif +2 -2
- assets/library-demos/create_docx-1.webp +3 -0
- assets/library-demos/create_pdf-1.gif +2 -2
- assets/library-demos/create_pdf-1.webp +3 -0
- assets/library-demos/create_xlsx-1.gif +2 -2
- assets/library-demos/create_xlsx-1.webp +3 -0
- assets/library-demos/csv_table-1.gif +2 -2
- assets/library-demos/csv_table-1.webp +3 -0
- assets/library-demos/discernment_nudge-1.gif +2 -2
- assets/library-demos/discernment_nudge-1.webp +3 -0
- assets/library-demos/frontend_design-1.gif +2 -2
- assets/library-demos/frontend_design-1.webp +3 -0
- assets/library-demos/make_plan-1.gif +2 -2
- assets/library-demos/make_plan-1.webp +3 -0
- assets/library-demos/mcp_builder-1.gif +2 -2
- assets/library-demos/mcp_builder-1.webp +3 -0
- assets/library-demos/review_checklist-1.gif +2 -2
- assets/library-demos/review_checklist-1.webp +3 -0
- assets/library-demos/skill_scaffold-1.gif +2 -2
- assets/library-demos/skill_scaffold-1.webp +3 -0
- assets/library-demos/slack_gif_creator-1.gif +2 -2
- assets/library-demos/slack_gif_creator-1.webp +3 -0
- assets/library-demos/status_update-1.gif +2 -2
- assets/library-demos/status_update-1.webp +3 -0
- assets/library-demos/theme_factory-1.gif +2 -2
- assets/library-demos/theme_factory-1.webp +3 -0
- assets/library-demos/web_artifacts_builder-1.gif +2 -2
- assets/library-demos/web_artifacts_builder-1.webp +3 -0
- assets/library-demos/webapp_testing-1.gif +2 -2
- assets/library-demos/webapp_testing-1.webp +3 -0
- distinct-update.zip +3 -0
- distinct_agent/runners.py +2 -3
- distinct_server.egg-info/SOURCES.txt +41 -0
- distinct_server/presentation.py +438 -142
- distinct_server/render.py +585 -221
- distinct_server/ui.py +392 -285
- distinct_skills/manifest.py +10 -10
APPLY-AND-PUSH.bat
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cd /d "%~dp0"
|
| 2 |
+
@echo off
|
| 3 |
+
(
|
| 4 |
+
echo ===== APPLY =====
|
| 5 |
+
powershell -NoProfile -Command "Expand-Archive -LiteralPath distinct-update.zip -DestinationPath . -Force"
|
| 6 |
+
echo EXPAND_EXIT=%ERRORLEVEL%
|
| 7 |
+
git lfs install --local
|
| 8 |
+
git lfs track "*.gif"
|
| 9 |
+
git lfs track "*.webp"
|
| 10 |
+
git add -A
|
| 11 |
+
git -c user.name=User1342 -c user.email=User1342@users.noreply.huggingface.co commit -m "Library as its own page; cards show what each member makes; Anthropic-calm palette; artifact previews in answers"
|
| 12 |
+
echo COMMIT_EXIT=%ERRORLEVEL%
|
| 13 |
+
git push origin main
|
| 14 |
+
echo PUSH_EXIT=%ERRORLEVEL%
|
| 15 |
+
git log --oneline -1
|
| 16 |
+
git ls-remote origin main
|
| 17 |
+
) >> push-log6.txt 2>&1
|
assets/library-demos/academy_guide-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/academy_guide-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/algorithmic_art-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/algorithmic_art-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/brand_guidelines-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/brand_guidelines-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/canvas_design-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/canvas_design-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/claude_api-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/claude_api-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/create_deck-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/create_deck-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/create_docx-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/create_docx-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/create_pdf-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/create_pdf-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/create_xlsx-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/create_xlsx-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/csv_table-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/csv_table-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/discernment_nudge-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/discernment_nudge-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/frontend_design-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/frontend_design-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/make_plan-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/make_plan-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/mcp_builder-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/mcp_builder-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/review_checklist-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/review_checklist-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/skill_scaffold-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/skill_scaffold-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/slack_gif_creator-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/slack_gif_creator-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/status_update-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/status_update-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/theme_factory-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/theme_factory-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/web_artifacts_builder-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/web_artifacts_builder-1.webp
ADDED
|
Git LFS Details
|
assets/library-demos/webapp_testing-1.gif
CHANGED
|
Git LFS Details
|
|
Git LFS Details
|
assets/library-demos/webapp_testing-1.webp
ADDED
|
Git LFS Details
|
distinct-update.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bf6567abd8ff59b1041ca1e41072335eebeff321526bb347d243f08f8abefad1
|
| 3 |
+
size 2613564
|
distinct_agent/runners.py
CHANGED
|
@@ -172,9 +172,8 @@ class DeterministicDemoRunner:
|
|
| 172 |
"type": "final",
|
| 173 |
"answer": (
|
| 174 |
f"[demo:{model.manifest.id}] ran "
|
| 175 |
-
f"{len(directives)} requested library call(s)
|
| 176 |
-
"
|
| 177 |
-
"your session outputs."
|
| 178 |
),
|
| 179 |
},
|
| 180 |
ensure_ascii=False,
|
|
|
|
| 172 |
"type": "final",
|
| 173 |
"answer": (
|
| 174 |
f"[demo:{model.manifest.id}] ran "
|
| 175 |
+
f"{len(directives)} requested library call(s). "
|
| 176 |
+
"Here is what came back."
|
|
|
|
| 177 |
),
|
| 178 |
},
|
| 179 |
ensure_ascii=False,
|
distinct_server.egg-info/SOURCES.txt
CHANGED
|
@@ -36,6 +36,7 @@ distinct_agent/isolation/windows.py
|
|
| 36 |
distinct_agent/isolation/windows_appcontainer.py
|
| 37 |
distinct_mcp/__init__.py
|
| 38 |
distinct_mcp/common.py
|
|
|
|
| 39 |
distinct_mcp/files.py
|
| 40 |
distinct_mcp/lists.py
|
| 41 |
distinct_mcp/numbers.py
|
|
@@ -69,8 +70,37 @@ distinct_skills/__main__.py
|
|
| 69 |
distinct_skills/handlers.py
|
| 70 |
distinct_skills/loader.py
|
| 71 |
distinct_skills/manifest.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
distinct_skills/skills/csv-table/SKILL.md
|
| 73 |
distinct_skills/skills/csv-table/tool.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
distinct_skills/skills/review-checklist/SKILL.md
|
| 75 |
distinct_skills/skills/review-checklist/tool.json
|
| 76 |
distinct_skills/skills/review-checklist/assets/checklist.md
|
|
@@ -78,9 +108,20 @@ distinct_skills/skills/review-checklist/assets/claim-block.md
|
|
| 78 |
distinct_skills/skills/skill-scaffold/SKILL.md
|
| 79 |
distinct_skills/skills/skill-scaffold/tool.json
|
| 80 |
distinct_skills/skills/skill-scaffold/assets/skill-template.md
|
|
|
|
|
|
|
|
|
|
| 81 |
distinct_skills/skills/status-update/SKILL.md
|
| 82 |
distinct_skills/skills/status-update/tool.json
|
| 83 |
distinct_skills/skills/status-update/assets/status-update.md
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
distinct_tools/__init__.py
|
| 85 |
distinct_tools/approval.py
|
| 86 |
distinct_tools/core.py
|
|
|
|
| 36 |
distinct_agent/isolation/windows_appcontainer.py
|
| 37 |
distinct_mcp/__init__.py
|
| 38 |
distinct_mcp/common.py
|
| 39 |
+
distinct_mcp/external.py
|
| 40 |
distinct_mcp/files.py
|
| 41 |
distinct_mcp/lists.py
|
| 42 |
distinct_mcp/numbers.py
|
|
|
|
| 70 |
distinct_skills/handlers.py
|
| 71 |
distinct_skills/loader.py
|
| 72 |
distinct_skills/manifest.py
|
| 73 |
+
distinct_skills/skills/academy-guide/SKILL.md
|
| 74 |
+
distinct_skills/skills/academy-guide/tool.json
|
| 75 |
+
distinct_skills/skills/academy-guide/assets/guide.md
|
| 76 |
+
distinct_skills/skills/algorithmic-art/SKILL.md
|
| 77 |
+
distinct_skills/skills/algorithmic-art/tool.json
|
| 78 |
+
distinct_skills/skills/algorithmic-art/assets/guide.md
|
| 79 |
+
distinct_skills/skills/brand-guidelines/SKILL.md
|
| 80 |
+
distinct_skills/skills/brand-guidelines/tool.json
|
| 81 |
+
distinct_skills/skills/brand-guidelines/assets/guide.md
|
| 82 |
+
distinct_skills/skills/canvas-design/SKILL.md
|
| 83 |
+
distinct_skills/skills/canvas-design/tool.json
|
| 84 |
+
distinct_skills/skills/canvas-design/assets/guide.md
|
| 85 |
+
distinct_skills/skills/claude-api/SKILL.md
|
| 86 |
+
distinct_skills/skills/claude-api/tool.json
|
| 87 |
+
distinct_skills/skills/claude-api/assets/guide.md
|
| 88 |
+
distinct_skills/skills/create-deck/SKILL.md
|
| 89 |
+
distinct_skills/skills/create-deck/tool.json
|
| 90 |
+
distinct_skills/skills/create-docx/SKILL.md
|
| 91 |
+
distinct_skills/skills/create-docx/tool.json
|
| 92 |
+
distinct_skills/skills/create-xlsx/SKILL.md
|
| 93 |
+
distinct_skills/skills/create-xlsx/tool.json
|
| 94 |
distinct_skills/skills/csv-table/SKILL.md
|
| 95 |
distinct_skills/skills/csv-table/tool.json
|
| 96 |
+
distinct_skills/skills/discernment-nudge/SKILL.md
|
| 97 |
+
distinct_skills/skills/discernment-nudge/tool.json
|
| 98 |
+
distinct_skills/skills/discernment-nudge/assets/guide.md
|
| 99 |
+
distinct_skills/skills/frontend-design/SKILL.md
|
| 100 |
+
distinct_skills/skills/frontend-design/tool.json
|
| 101 |
+
distinct_skills/skills/mcp-builder/SKILL.md
|
| 102 |
+
distinct_skills/skills/mcp-builder/tool.json
|
| 103 |
+
distinct_skills/skills/mcp-builder/assets/guide.md
|
| 104 |
distinct_skills/skills/review-checklist/SKILL.md
|
| 105 |
distinct_skills/skills/review-checklist/tool.json
|
| 106 |
distinct_skills/skills/review-checklist/assets/checklist.md
|
|
|
|
| 108 |
distinct_skills/skills/skill-scaffold/SKILL.md
|
| 109 |
distinct_skills/skills/skill-scaffold/tool.json
|
| 110 |
distinct_skills/skills/skill-scaffold/assets/skill-template.md
|
| 111 |
+
distinct_skills/skills/slack-gif-creator/SKILL.md
|
| 112 |
+
distinct_skills/skills/slack-gif-creator/tool.json
|
| 113 |
+
distinct_skills/skills/slack-gif-creator/assets/guide.md
|
| 114 |
distinct_skills/skills/status-update/SKILL.md
|
| 115 |
distinct_skills/skills/status-update/tool.json
|
| 116 |
distinct_skills/skills/status-update/assets/status-update.md
|
| 117 |
+
distinct_skills/skills/theme-factory/SKILL.md
|
| 118 |
+
distinct_skills/skills/theme-factory/tool.json
|
| 119 |
+
distinct_skills/skills/web-artifacts-builder/SKILL.md
|
| 120 |
+
distinct_skills/skills/web-artifacts-builder/tool.json
|
| 121 |
+
distinct_skills/skills/web-artifacts-builder/assets/guide.md
|
| 122 |
+
distinct_skills/skills/webapp-testing/SKILL.md
|
| 123 |
+
distinct_skills/skills/webapp-testing/tool.json
|
| 124 |
+
distinct_skills/skills/webapp-testing/assets/guide.md
|
| 125 |
distinct_tools/__init__.py
|
| 126 |
distinct_tools/approval.py
|
| 127 |
distinct_tools/core.py
|
distinct_server/presentation.py
CHANGED
|
@@ -18,22 +18,23 @@ letter, because an absence drawn as a D is a measured poor result that nobody
|
|
| 18 |
measured.
|
| 19 |
|
| 20 |
**2. WCAG AA, computed rather than assumed.**
|
| 21 |
-
Contrast against the canvas ``#
|
| 22 |
|
| 23 |
=============== ========= ====== ==========================================
|
| 24 |
Colour Ratio AA? Used for
|
| 25 |
=============== ========= ====== ==========================================
|
| 26 |
-
``#
|
| 27 |
-
``#
|
| 28 |
-
``#
|
| 29 |
-
``#
|
| 30 |
-
``#
|
| 31 |
-
``#
|
| 32 |
-
``#
|
| 33 |
=============== ========= ====== ==========================================
|
| 34 |
|
| 35 |
-
The
|
| 36 |
-
text.
|
|
|
|
| 37 |
|
| 38 |
**Layout: the shell decides its own height.**
|
| 39 |
The previous sheet locked ``.gradio-container`` and ``.c-shell`` to ``100vh``
|
|
@@ -54,19 +55,25 @@ four the layout had grown.
|
|
| 54 |
from __future__ import annotations
|
| 55 |
|
| 56 |
PALETTE = {
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
"surface": "#FFFFFF",
|
| 59 |
-
"mint": "#
|
| 60 |
-
"sage": "#
|
| 61 |
-
"sage_dark": "#
|
| 62 |
-
"border": "#
|
| 63 |
-
"text": "#
|
| 64 |
-
"muted": "#
|
| 65 |
-
# Accessible shades of the
|
| 66 |
-
"sage_deep": "#
|
| 67 |
-
"sage_button": "#
|
| 68 |
-
"text_secondary": "#
|
| 69 |
-
"hairline": "#
|
| 70 |
}
|
| 71 |
|
| 72 |
# Loaded via launch(head=...) so the font arrives before first paint rather than
|
|
@@ -87,7 +94,8 @@ HEAD = """
|
|
| 87 |
|
| 88 |
<script>
|
| 89 |
(function(){
|
| 90 |
-
function
|
|
|
|
| 91 |
function show(m){
|
| 92 |
if(!m || m.classList.contains('is-playing')) return;
|
| 93 |
var src = m.getAttribute('data-gif');
|
|
@@ -101,21 +109,65 @@ HEAD = """
|
|
| 101 |
m.classList.remove('is-playing');
|
| 102 |
m.querySelectorAll('img').forEach(function(i){i.remove();});
|
| 103 |
}
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
document.addEventListener('mouseout', function(e){
|
| 106 |
-
var m =
|
| 107 |
if(m && !m.contains(e.relatedTarget)) hide(m);
|
| 108 |
});
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
document.addEventListener('touchstart', function(e){
|
| 111 |
-
var
|
| 112 |
-
|
|
|
|
| 113 |
}, {passive:true});
|
| 114 |
['touchend','touchcancel'].forEach(function(name){
|
| 115 |
document.addEventListener(name, function(e){
|
| 116 |
-
clearTimeout(holdTimer); hide(
|
| 117 |
}, {passive:true});
|
| 118 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
})();
|
| 120 |
</script>
|
| 121 |
"""
|
|
@@ -127,12 +179,12 @@ CSS = """
|
|
| 127 |
==================================================================== */
|
| 128 |
:root{
|
| 129 |
/* colour */
|
| 130 |
-
--c-canvas:#
|
| 131 |
-
--c-sage:#
|
| 132 |
-
--c-accent:#
|
| 133 |
-
--c-text:#
|
| 134 |
-
--c-hairline:#
|
| 135 |
-
--c-warn-bg:#
|
| 136 |
|
| 137 |
/* spacing: 4px base, no value outside this scale */
|
| 138 |
--s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px;
|
|
@@ -146,17 +198,20 @@ CSS = """
|
|
| 146 |
--r-md:12px; --r-lg:16px; --r-pill:999px;
|
| 147 |
|
| 148 |
/* elevation: two levels */
|
| 149 |
-
--e1:0 1px 2px rgba(32,
|
| 150 |
-
--e2:0 8px 28px -12px rgba(32,
|
| 151 |
|
| 152 |
--font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
| 153 |
--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
|
| 154 |
|
| 155 |
-
/* DISPLAY FACE. Option
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
|
|
|
|
|
|
| 159 |
|
|
|
|
| 160 |
--measure:68ch;
|
| 161 |
|
| 162 |
/* One shell geometry, referenced by every top-level block so there is
|
|
@@ -272,9 +327,11 @@ footer,.gradio-container footer{display:none !important;}
|
|
| 272 |
line-height:1; white-space:nowrap; overflow:hidden;
|
| 273 |
text-overflow:ellipsis; padding-left:var(--s3);
|
| 274 |
border-left:1px solid var(--c-hairline);}
|
| 275 |
-
.
|
| 276 |
-
|
| 277 |
-
|
|
|
|
|
|
|
| 278 |
.c-identity--link{text-decoration:underline; cursor:pointer;}
|
| 279 |
|
| 280 |
/* ========================================================================
|
|
@@ -344,19 +401,24 @@ footer,.gradio-container footer{display:none !important;}
|
|
| 344 |
/* ========================================================================
|
| 345 |
NOTICE
|
| 346 |
==================================================================== */
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
|
|
|
|
|
|
|
|
|
| 351 |
font-size:var(--t-label); color:var(--c-text-2);
|
| 352 |
-
line-height:1.
|
| 353 |
.c-notice__summary::-webkit-details-marker{display:none;}
|
| 354 |
.c-notice__summary strong{color:var(--c-text); font-weight:600;}
|
| 355 |
.c-notice__mark{flex:none; width:16px; height:16px; border-radius:50%;
|
| 356 |
-
|
| 357 |
-
|
|
|
|
| 358 |
.c-notice__toggle{margin-left:auto; white-space:nowrap; font-size:var(--t-micro);
|
| 359 |
-
color:var(--c-muted); text-decoration:underline;
|
|
|
|
| 360 |
.c-notice__body{margin:var(--s3) 0 var(--s1) 28px; font-size:var(--t-micro);
|
| 361 |
line-height:1.6; color:var(--c-text-2); max-width:var(--measure);}
|
| 362 |
.c-notice__summary:focus-visible{outline:3px solid var(--c-sage); outline-offset:3px;
|
|
@@ -495,10 +557,9 @@ footer,.gradio-container footer{display:none !important;}
|
|
| 495 |
.c-grade-card__name{font-size:var(--t-body); font-weight:600; color:var(--c-text);}
|
| 496 |
.c-grade-card__link{font-size:var(--t-micro); color:var(--c-sage-deep);
|
| 497 |
text-decoration:underline; white-space:nowrap;}
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
denominator beside it is the thing this panel must not produce. */
|
| 502 |
.c-grade-card__coverage{font-size:var(--t-micro); color:var(--c-text-2);
|
| 503 |
font-variant-numeric:tabular-nums;}
|
| 504 |
.c-grade-card__note{margin:0; padding-top:var(--s3); font-size:var(--t-micro);
|
|
@@ -511,50 +572,82 @@ footer,.gradio-container footer{display:none !important;}
|
|
| 511 |
.c-grade-row:last-child{border-bottom:none;}
|
| 512 |
.c-grade-row__label{font-size:var(--t-label); color:var(--c-text-2);}
|
| 513 |
|
| 514 |
-
/* ONE TOKEN, NOT A
|
| 515 |
-
The
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
because one is a
|
| 523 |
-
single hue so colour cannot
|
| 524 |
-
.c-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
.c-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
.c-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
.c-grade-
|
| 555 |
-
|
| 556 |
-
.c-grade-
|
| 557 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 558 |
.c-rubric__warning{margin:0; padding:var(--s3); background:var(--c-mint);
|
| 559 |
border-radius:var(--r-md); font-size:var(--t-micro);
|
| 560 |
line-height:1.55; color:var(--c-text);}
|
|
@@ -567,7 +660,6 @@ footer,.gradio-container footer{display:none !important;}
|
|
| 567 |
.c-legend__scale-body{margin:0; font-size:var(--t-micro); line-height:1.55;
|
| 568 |
color:var(--c-text-2);}
|
| 569 |
.c-legend__scale-body strong{color:var(--c-text); font-weight:600;}
|
| 570 |
-
.c-grade-card__scores{display:flex; flex-wrap:wrap; gap:var(--s2);}
|
| 571 |
|
| 572 |
/* ========================================================================
|
| 573 |
EMPTY STATES: no dashed drop-zone rectangles
|
|
@@ -1317,14 +1409,12 @@ details[open] .c-libhelp__toggle::after{content:" -";}
|
|
| 1317 |
.c-grade-row{flex-wrap:wrap; gap:var(--s2);}
|
| 1318 |
}
|
| 1319 |
|
| 1320 |
-
/* The
|
| 1321 |
-
with its
|
| 1322 |
allowed to wrap and the token is not allowed to shrink below its content.
|
| 1323 |
The row around it wraps instead. */
|
| 1324 |
-
.c-
|
| 1325 |
-
.c-
|
| 1326 |
-
white-space:nowrap; flex:none;
|
| 1327 |
-
}
|
| 1328 |
.c-grade-row__label{min-width:0; overflow-wrap:anywhere;}
|
| 1329 |
|
| 1330 |
@media (prefers-reduced-motion:reduce){
|
|
@@ -1356,48 +1446,163 @@ details[open] .c-libhelp__toggle::after{content:" -";}
|
|
| 1356 |
}
|
| 1357 |
|
| 1358 |
|
| 1359 |
-
/* ---- Library page
|
| 1360 |
-
.
|
| 1361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1362 |
gap:var(--s4); margin:var(--s4) 0;}
|
| 1363 |
-
.c-libcard{
|
| 1364 |
-
border
|
| 1365 |
-
|
| 1366 |
-
|
| 1367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1368 |
.c-libcard__media{margin:calc(var(--s4)*-1) calc(var(--s4)*-1) var(--s2);
|
| 1369 |
-
aspect-ratio:16/9; border-radius:var(--r-lg) var(--r-lg) 0 0;
|
| 1370 |
background:var(--c-fill) center/cover no-repeat;
|
| 1371 |
display:flex; align-items:center; justify-content:center;
|
| 1372 |
overflow:hidden; position:relative;}
|
| 1373 |
-
.c-libcard__media img{width:100%; height:100%; object-fit:cover;
|
| 1374 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1375 |
.c-libcard__media.is-playing .c-libcard__play{display:none;}
|
| 1376 |
-
.c-libcard__head{display:flex; align-items:center; gap:var(--s2);}
|
| 1377 |
.c-libcard__kind{font-size:var(--t-micro); letter-spacing:.06em; text-transform:uppercase;
|
| 1378 |
padding:2px 8px; border-radius:999px; background:var(--c-fill);
|
| 1379 |
-
color:var(--c-text-2);}
|
| 1380 |
-
.c-libcard__kind--skill{background:var(--c-
|
| 1381 |
-
.c-libcard__default{margin-left:auto; font-size:var(--t-micro); color:var(--c-sage-deep);
|
| 1382 |
-
border:1px solid currentColor; border-radius:999px; padding:1px 8px;}
|
| 1383 |
.c-libcard__name{margin:0; font-size:var(--t-body); font-weight:650; color:var(--c-text);
|
| 1384 |
text-transform:capitalize;}
|
| 1385 |
.c-libcard__author{margin:0; font-size:var(--t-micro); color:var(--c-muted);}
|
| 1386 |
-
.c-libcard__desc{margin:2px 0 0; font-size:
|
| 1387 |
color:var(--c-text-2);
|
| 1388 |
display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical;
|
| 1389 |
overflow:hidden;}
|
| 1390 |
.c-libcard__ref{margin-top:auto; padding-top:var(--s2); font-family:var(--mono);
|
| 1391 |
font-size:11px; color:var(--c-muted);}
|
| 1392 |
-
.c-librarydefaults-head{margin-top:var(--s4);}
|
| 1393 |
|
| 1394 |
-
/* ----
|
| 1395 |
-
|
| 1396 |
-
|
| 1397 |
-
|
| 1398 |
-
|
| 1399 |
-
|
| 1400 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1401 |
|
| 1402 |
/* ---- The no-agents veil ----------------------------------------------- */
|
| 1403 |
/* Shown only while somebody is signed in (the identity span has text) and
|
|
@@ -1406,9 +1611,13 @@ details[open] .c-libhelp__toggle::after{content:" -";}
|
|
| 1406 |
.c-conversation{position:relative;}
|
| 1407 |
.c-shell:has(.c-identity:not(:empty)):has(.c-noworker-hook) .c-veil{
|
| 1408 |
display:flex; position:absolute; inset:0; z-index:12;
|
| 1409 |
-
|
| 1410 |
-
|
| 1411 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1412 |
/* The veil informs; it does not imprison. Pointer events pass through
|
| 1413 |
everywhere except its own panel, so a transient no-worker blip (a poll
|
| 1414 |
gap, a mode change) can never trap a click mid-flow. */
|
|
@@ -1419,11 +1628,16 @@ details[open] .c-libhelp__toggle::after{content:" -";}
|
|
| 1419 |
.c-veil__panel{max-width:380px; text-align:center; background:var(--c-surface);
|
| 1420 |
border:1px solid var(--c-hairline); border-radius:var(--r-lg);
|
| 1421 |
box-shadow:var(--e2); padding:var(--s5);}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1422 |
.c-veil__title{margin:0 0 6px; font-weight:650; font-size:var(--t-lg); color:var(--c-text);}
|
| 1423 |
.c-veil__body{margin:0 0 var(--s4); color:var(--c-text-2); line-height:1.55;}
|
| 1424 |
-
.c-veil__action{display:inline-block; text-decoration:none; background:var(--c-
|
| 1425 |
-
color:#fff; padding:10px
|
| 1426 |
-
.c-veil__action:hover{
|
| 1427 |
|
| 1428 |
/* ---- Professional polish pass ----------------------------------------- */
|
| 1429 |
/* Calmer sections: the tail accordions read as pages, not widgets. */
|
|
@@ -1436,11 +1650,93 @@ details[open] .c-libhelp__toggle::after{content:" -";}
|
|
| 1436 |
/* Inputs: quiet until focused. */
|
| 1437 |
.gradio-container input[type="text"], .gradio-container textarea{
|
| 1438 |
border-radius:var(--r-md) !important;}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1439 |
@media (max-width:700px){
|
| 1440 |
-
.c-libgrid{grid-template-columns:1fr
|
| 1441 |
.c-quicknav{justify-content:flex-start;}
|
| 1442 |
-
}
|
| 1443 |
-
|
| 1444 |
-
.c-libgrid{grid-template-columns:1fr;}
|
| 1445 |
}
|
| 1446 |
"""
|
|
|
|
| 18 |
measured.
|
| 19 |
|
| 20 |
**2. WCAG AA, computed rather than assumed.**
|
| 21 |
+
Contrast against the canvas ``#FAF9F5``:
|
| 22 |
|
| 23 |
=============== ========= ====== ==========================================
|
| 24 |
Colour Ratio AA? Used for
|
| 25 |
=============== ========= ====== ==========================================
|
| 26 |
+
``#1F1E1A`` 15.6:1 pass body text
|
| 27 |
+
``#504D45`` 7.6:1 pass secondary text
|
| 28 |
+
``#6C6961`` 4.6:1 pass muted text
|
| 29 |
+
``#174F37`` 9.3:1 pass accent text
|
| 30 |
+
``#1E6E4B`` 6.0:1* pass primary button (*white on it: 6.2:1)
|
| 31 |
+
``#4E7561`` 4.2:1 FAIL borders, strokes, 24px+ only
|
| 32 |
+
``#5E8A73`` 3.2:1 FAIL decorative fill only
|
| 33 |
=============== ========= ====== ==========================================
|
| 34 |
|
| 35 |
+
The two lighter greens fail AA for body text, so neither is ever used for
|
| 36 |
+
body text. Every neutral is warm-grey over ivory; green appears only where
|
| 37 |
+
it means something (the action, the selection, the focus).
|
| 38 |
|
| 39 |
**Layout: the shell decides its own height.**
|
| 40 |
The previous sheet locked ``.gradio-container`` and ``.c-shell`` to ``100vh``
|
|
|
|
| 55 |
from __future__ import annotations
|
| 56 |
|
| 57 |
PALETTE = {
|
| 58 |
+
# A warm paper ground with exactly one accent. The previous sheet tinted
|
| 59 |
+
# the canvas, the borders, the fills and the pills green all at once, and
|
| 60 |
+
# four tinted neutrals beside one another read as a colour scheme fighting
|
| 61 |
+
# itself. Now the neutrals are neutral (warm greys over an ivory ground)
|
| 62 |
+
# and green appears only where it means something: the primary action,
|
| 63 |
+
# the selected state, the focus ring.
|
| 64 |
+
"canvas": "#FAF9F5",
|
| 65 |
"surface": "#FFFFFF",
|
| 66 |
+
"mint": "#E8F0EA", # selection tint, the only coloured fill
|
| 67 |
+
"sage": "#5E8A73", # decorative strokes over 24px
|
| 68 |
+
"sage_dark": "#4E7561",
|
| 69 |
+
"border": "#D8D3C7",
|
| 70 |
+
"text": "#1F1E1A",
|
| 71 |
+
"muted": "#6C6961",
|
| 72 |
+
# Accessible shades of the accent; see the table above.
|
| 73 |
+
"sage_deep": "#174F37",
|
| 74 |
+
"sage_button": "#1E6E4B",
|
| 75 |
+
"text_secondary": "#504D45",
|
| 76 |
+
"hairline": "#EAE7DF",
|
| 77 |
}
|
| 78 |
|
| 79 |
# Loaded via launch(head=...) so the font arrives before first paint rather than
|
|
|
|
| 94 |
|
| 95 |
<script>
|
| 96 |
(function(){
|
| 97 |
+
function card(el){return el && el.closest ? el.closest('.c-libcard') : null;}
|
| 98 |
+
function mediaOf(c){return c ? c.querySelector('.c-libcard__media') : null;}
|
| 99 |
function show(m){
|
| 100 |
if(!m || m.classList.contains('is-playing')) return;
|
| 101 |
var src = m.getAttribute('data-gif');
|
|
|
|
| 109 |
m.classList.remove('is-playing');
|
| 110 |
m.querySelectorAll('img').forEach(function(i){i.remove();});
|
| 111 |
}
|
| 112 |
+
/* Hover previews, scoped to the media block so sweeping the grid does not
|
| 113 |
+
start twenty GIFs at once. */
|
| 114 |
+
document.addEventListener('mouseover', function(e){
|
| 115 |
+
var m = e.target.closest ? e.target.closest('.c-libcard__media') : null; show(m);
|
| 116 |
+
});
|
| 117 |
document.addEventListener('mouseout', function(e){
|
| 118 |
+
var m = e.target.closest ? e.target.closest('.c-libcard__media') : null;
|
| 119 |
if(m && !m.contains(e.relatedTarget)) hide(m);
|
| 120 |
});
|
| 121 |
+
/* Press-and-hold anywhere on the card previews on a phone; a plain tap is
|
| 122 |
+
the selection. The two must not fire together, hence the flag. */
|
| 123 |
+
var holdTimer=null, held=false;
|
| 124 |
document.addEventListener('touchstart', function(e){
|
| 125 |
+
var c = card(e.target); if(!c) return;
|
| 126 |
+
held=false;
|
| 127 |
+
holdTimer = setTimeout(function(){held=true; show(mediaOf(c));}, 350);
|
| 128 |
}, {passive:true});
|
| 129 |
['touchend','touchcancel'].forEach(function(name){
|
| 130 |
document.addEventListener(name, function(e){
|
| 131 |
+
clearTimeout(holdTimer); hide(mediaOf(card(e.target)));
|
| 132 |
}, {passive:true});
|
| 133 |
});
|
| 134 |
+
/* THE CARD IS THE CONTROL, and the way it saves is by forwarding its click
|
| 135 |
+
to the framework's own box for that member. Writing a hidden field's
|
| 136 |
+
value and dispatching an input event was tried first: it updates the DOM
|
| 137 |
+
and never reaches the server, because the framework listens to its own
|
| 138 |
+
binding rather than to the element. Clicking its control cannot drift
|
| 139 |
+
from it. The boxes are labelled with the bare reference, so the mapping
|
| 140 |
+
is an exact string rather than a position two lists could disagree on. */
|
| 141 |
+
function boxFor(ref){
|
| 142 |
+
var group = document.getElementById('library-choice');
|
| 143 |
+
if(!group) return null;
|
| 144 |
+
var labels = group.querySelectorAll('label');
|
| 145 |
+
for(var i=0;i<labels.length;i++){
|
| 146 |
+
if((labels[i].textContent||'').trim() === ref){
|
| 147 |
+
return labels[i].querySelector('input[type=checkbox]');
|
| 148 |
+
}
|
| 149 |
+
}
|
| 150 |
+
return null;
|
| 151 |
+
}
|
| 152 |
+
document.addEventListener('click', function(e){
|
| 153 |
+
var c = card(e.target);
|
| 154 |
+
if(!c || !c.hasAttribute('data-ref')) return;
|
| 155 |
+
if(held){held=false; return;}
|
| 156 |
+
if(e.target.closest && e.target.closest('a')) return;
|
| 157 |
+
var box = boxFor(c.getAttribute('data-ref'));
|
| 158 |
+
if(!box) return; /* no transport, no pretend selection */
|
| 159 |
+
/* Paint first so the card answers the tap immediately; the count catches
|
| 160 |
+
up when the save returns. */
|
| 161 |
+
c.classList.toggle('is-on');
|
| 162 |
+
c.setAttribute('aria-pressed', c.classList.contains('is-on') ? 'true' : 'false');
|
| 163 |
+
box.click();
|
| 164 |
+
});
|
| 165 |
+
document.addEventListener('keydown', function(e){
|
| 166 |
+
if(e.key !== ' ' && e.key !== 'Enter') return;
|
| 167 |
+
var c = card(e.target);
|
| 168 |
+
if(!c || e.target !== c) return;
|
| 169 |
+
e.preventDefault(); c.click();
|
| 170 |
+
});
|
| 171 |
})();
|
| 172 |
</script>
|
| 173 |
"""
|
|
|
|
| 179 |
==================================================================== */
|
| 180 |
:root{
|
| 181 |
/* colour */
|
| 182 |
+
--c-canvas:#FAF9F5; --c-surface:#FFFFFF; --c-mint:#E8F0EA;
|
| 183 |
+
--c-sage:#5E8A73; --c-sage-dark:#4E7561; --c-sage-deep:#174F37;
|
| 184 |
+
--c-accent:#1E6E4B; --c-accent-hover:#185C3E;
|
| 185 |
+
--c-text:#1F1E1A; --c-text-2:#504D45; --c-muted:#6C6961;
|
| 186 |
+
--c-hairline:#EAE7DF; --c-border:#D8D3C7; --c-fill:#F4F1EA;
|
| 187 |
+
--c-warn-bg:#FBF6E8; --c-warn-rule:#7A6420;
|
| 188 |
|
| 189 |
/* spacing: 4px base, no value outside this scale */
|
| 190 |
--s1:4px; --s2:8px; --s3:12px; --s4:16px; --s5:24px; --s6:32px;
|
|
|
|
| 198 |
--r-md:12px; --r-lg:16px; --r-pill:999px;
|
| 199 |
|
| 200 |
/* elevation: two levels */
|
| 201 |
+
--e1:0 1px 2px rgba(35,32,26,.05);
|
| 202 |
+
--e2:0 8px 28px -12px rgba(35,32,26,.16);
|
| 203 |
|
| 204 |
--font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
|
| 205 |
--mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
|
| 206 |
|
| 207 |
+
/* DISPLAY FACE. Option B is live: the serif display over a warm paper
|
| 208 |
+
ground is what carries the editorial, Anthropic-adjacent register; the
|
| 209 |
+
sans stays for everything set smaller than a title. Swap the live line
|
| 210 |
+
to compare; nothing else in the sheet changes. */
|
| 211 |
+
/* --font-display:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; */ /* A */
|
| 212 |
+
--font-display:'Fraunces','Iowan Old Style',Georgia,serif; /* B */
|
| 213 |
|
| 214 |
+
--c-focus:rgba(30,110,75,.4);
|
| 215 |
--measure:68ch;
|
| 216 |
|
| 217 |
/* One shell geometry, referenced by every top-level block so there is
|
|
|
|
| 327 |
line-height:1; white-space:nowrap; overflow:hidden;
|
| 328 |
text-overflow:ellipsis; padding-left:var(--s3);
|
| 329 |
border-left:1px solid var(--c-hairline);}
|
| 330 |
+
/* Who you are, said quietly. This was a floating white pill with a shadow,
|
| 331 |
+
which gave the top of the page a second object competing with the
|
| 332 |
+
wordmark for the eye; it is a caption, so it is set like one. */
|
| 333 |
+
.c-identity{font-size:var(--t-micro); color:var(--c-muted); white-space:nowrap;
|
| 334 |
+
overflow:hidden; text-overflow:ellipsis; max-width:38ch;}
|
| 335 |
.c-identity--link{text-decoration:underline; cursor:pointer;}
|
| 336 |
|
| 337 |
/* ========================================================================
|
|
|
|
| 401 |
/* ========================================================================
|
| 402 |
NOTICE
|
| 403 |
==================================================================== */
|
| 404 |
+
/* A caution, not an alarm: paper surface and a hairline, with the mark the
|
| 405 |
+
only saturated pixel. The previous amber flood shouted over the page and
|
| 406 |
+
was the loudest colour on it. */
|
| 407 |
+
.c-notice{background:var(--c-surface); border:1px solid var(--c-hairline);
|
| 408 |
+
border-radius:var(--r-md); padding:var(--s3) var(--s4);}
|
| 409 |
+
.c-notice__summary{display:flex; align-items:baseline; gap:var(--s3);
|
| 410 |
+
flex-wrap:wrap; cursor:pointer; list-style:none;
|
| 411 |
font-size:var(--t-label); color:var(--c-text-2);
|
| 412 |
+
line-height:1.5;}
|
| 413 |
.c-notice__summary::-webkit-details-marker{display:none;}
|
| 414 |
.c-notice__summary strong{color:var(--c-text); font-weight:600;}
|
| 415 |
.c-notice__mark{flex:none; width:16px; height:16px; border-radius:50%;
|
| 416 |
+
align-self:center;
|
| 417 |
+
border:1.5px solid var(--c-warn-rule); color:var(--c-warn-rule);
|
| 418 |
+
font-size:10px; font-weight:700; display:grid; place-items:center;}
|
| 419 |
.c-notice__toggle{margin-left:auto; white-space:nowrap; font-size:var(--t-micro);
|
| 420 |
+
color:var(--c-muted); text-decoration:underline;
|
| 421 |
+
text-underline-offset:2px; padding-left:var(--s3);}
|
| 422 |
.c-notice__body{margin:var(--s3) 0 var(--s1) 28px; font-size:var(--t-micro);
|
| 423 |
line-height:1.6; color:var(--c-text-2); max-width:var(--measure);}
|
| 424 |
.c-notice__summary:focus-visible{outline:3px solid var(--c-sage); outline-offset:3px;
|
|
|
|
| 557 |
.c-grade-card__name{font-size:var(--t-body); font-weight:600; color:var(--c-text);}
|
| 558 |
.c-grade-card__link{font-size:var(--t-micro); color:var(--c-sage-deep);
|
| 559 |
text-decoration:underline; white-space:nowrap;}
|
| 560 |
+
/* Coverage sits in the card head, beside the name, because it qualifies the
|
| 561 |
+
whole card. "three of six areas published" is not a score and must never be
|
| 562 |
+
read as one, so it is set as quiet metadata rather than as a result. */
|
|
|
|
| 563 |
.c-grade-card__coverage{font-size:var(--t-micro); color:var(--c-text-2);
|
| 564 |
font-variant-numeric:tabular-nums;}
|
| 565 |
.c-grade-card__note{margin:0; padding-top:var(--s3); font-size:var(--t-micro);
|
|
|
|
| 572 |
.c-grade-row:last-child{border-bottom:none;}
|
| 573 |
.c-grade-row__label{font-size:var(--t-label); color:var(--c-text-2);}
|
| 574 |
|
| 575 |
+
/* ONE TOKEN, NOT A NUMBER WITH A CAPTION.
|
| 576 |
+
The figure and the method that produced it share a single border and a single
|
| 577 |
+
overflow context, so there is no crop, no skim and no line break that can
|
| 578 |
+
separate them. "54 MWh" metered at the socket and "54 MWh" inferred from a
|
| 579 |
+
chip's rated wattage are different claims, and the word that tells them apart
|
| 580 |
+
is inside the box rather than beside it.
|
| 581 |
+
|
| 582 |
+
Method is told apart three ways at once: the word itself, the fill, and the
|
| 583 |
+
border. Three signals because one is a heading away from being lost, and the
|
| 584 |
+
palette has a single hue so colour cannot carry it alone. */
|
| 585 |
+
.c-fig{display:inline-flex; align-items:stretch; flex:none; line-height:1;
|
| 586 |
+
border:1px solid var(--c-border); border-radius:8px; overflow:hidden;
|
| 587 |
+
font-variant-numeric:tabular-nums;}
|
| 588 |
+
.c-fig__value{display:flex; align-items:center; padding:6px 9px;
|
| 589 |
+
font-size:var(--t-label); font-weight:600; color:#22402C;
|
| 590 |
+
background:var(--c-mint); white-space:nowrap;}
|
| 591 |
+
.c-fig__method{display:flex; align-items:center; padding:0 8px;
|
| 592 |
+
font-size:9.5px; font-weight:600; letter-spacing:.08em;
|
| 593 |
+
text-transform:uppercase; color:var(--c-muted);
|
| 594 |
+
background:var(--c-surface);
|
| 595 |
+
border-left:1px solid var(--c-border); white-space:nowrap;}
|
| 596 |
+
/* A measured figure is the only one that gets the filled value. A modelled one
|
| 597 |
+
is the same shape unfilled, because it is a real published number arrived at
|
| 598 |
+
by calculation rather than by metering, and the difference should read at a
|
| 599 |
+
glance without either being dressed as a fault. */
|
| 600 |
+
.c-fig--modelled .c-fig__value,
|
| 601 |
+
.c-fig--proxy .c-fig__value{background:var(--c-fill); color:var(--c-text);}
|
| 602 |
+
.c-fig--unknown{border-style:dotted;}
|
| 603 |
+
.c-fig--unknown .c-fig__value{background:transparent; color:var(--c-text-2);}
|
| 604 |
+
/* An absence is dashed, wordy and unfilled: it differs from a figure in shape,
|
| 605 |
+
fill and content, because an absence drawn as a small number asserts a light
|
| 606 |
+
result that nobody measured. */
|
| 607 |
+
.c-fig--none{border-style:dashed; background:transparent;}
|
| 608 |
+
.c-fig__word{display:flex; align-items:center; padding:6px 10px;
|
| 609 |
+
font-size:var(--t-micro); font-weight:500; color:var(--c-muted);
|
| 610 |
+
white-space:nowrap;}
|
| 611 |
+
|
| 612 |
+
/* The card's own prose. Summary sits above the figures because a reader who
|
| 613 |
+
stops after one paragraph should stop having read the caveat, not the
|
| 614 |
+
headline number. */
|
| 615 |
+
.c-grade-card__summary{margin:0; font-size:var(--t-label); line-height:1.6;
|
| 616 |
+
color:var(--c-text-2);}
|
| 617 |
+
.c-grade-card__covers{margin:0; font-size:var(--t-micro); line-height:1.55;
|
| 618 |
+
color:var(--c-muted);}
|
| 619 |
+
.c-grade-card__covers strong{color:var(--c-text-2); font-weight:600;}
|
| 620 |
+
.c-grade-card__links{display:flex; flex-wrap:wrap; gap:var(--s3); margin:0;
|
| 621 |
+
padding-top:var(--s3);
|
| 622 |
+
border-top:1px solid var(--c-hairline);}
|
| 623 |
+
|
| 624 |
+
/* THE WORKING, ONE CLICK AWAY.
|
| 625 |
+
Six notes and six citations on the face of the card bury the figures; hiding
|
| 626 |
+
them makes the figures unverifiable. A disclosure is the only arrangement
|
| 627 |
+
that is both complete and readable. */
|
| 628 |
+
.c-sources{border-top:1px solid var(--c-hairline); padding-top:var(--s3);}
|
| 629 |
+
.c-sources__summary{cursor:pointer; font-size:var(--t-micro); font-weight:600;
|
| 630 |
+
letter-spacing:.04em; color:var(--c-sage-deep);}
|
| 631 |
+
.c-sources__summary:focus-visible{outline:2px solid var(--c-sage);
|
| 632 |
+
outline-offset:2px; border-radius:3px;}
|
| 633 |
+
.c-sources__body{display:flex; flex-direction:column; gap:var(--s2);
|
| 634 |
+
margin-top:var(--s3);}
|
| 635 |
+
.c-source{display:grid; grid-template-columns:minmax(88px,auto) 1fr;
|
| 636 |
+
gap:var(--s1) var(--s3); margin:0; font-size:var(--t-micro);
|
| 637 |
+
line-height:1.55;}
|
| 638 |
+
.c-source__label{color:var(--c-text-2); font-weight:600;}
|
| 639 |
+
.c-source__body{color:var(--c-muted);}
|
| 640 |
+
.c-source__link{color:var(--c-sage-deep); text-decoration:underline;
|
| 641 |
+
white-space:nowrap;}
|
| 642 |
+
|
| 643 |
+
.c-reading{padding-top:var(--s3); border-top:1px dashed var(--c-border);}
|
| 644 |
+
.c-reading__title{margin:0 0 var(--s2); font-size:var(--t-micro); font-weight:600;
|
| 645 |
+
letter-spacing:.06em; text-transform:uppercase;
|
| 646 |
+
color:var(--c-muted);}
|
| 647 |
+
.c-reading__links{display:flex; flex-direction:column; gap:var(--s1); margin:0;}
|
| 648 |
+
.c-reading__link{font-size:var(--t-micro); color:var(--c-sage-deep);
|
| 649 |
+
text-decoration:underline;}
|
| 650 |
+
|
| 651 |
.c-rubric__warning{margin:0; padding:var(--s3); background:var(--c-mint);
|
| 652 |
border-radius:var(--r-md); font-size:var(--t-micro);
|
| 653 |
line-height:1.55; color:var(--c-text);}
|
|
|
|
| 660 |
.c-legend__scale-body{margin:0; font-size:var(--t-micro); line-height:1.55;
|
| 661 |
color:var(--c-text-2);}
|
| 662 |
.c-legend__scale-body strong{color:var(--c-text); font-weight:600;}
|
|
|
|
| 663 |
|
| 664 |
/* ========================================================================
|
| 665 |
EMPTY STATES: no dashed drop-zone rectangles
|
|
|
|
| 1409 |
.c-grade-row{flex-wrap:wrap; gap:var(--s2);}
|
| 1410 |
}
|
| 1411 |
|
| 1412 |
+
/* The figure token never breaks up, at any width. The method word sharing a
|
| 1413 |
+
border with its number is the whole design, so the cells are explicitly not
|
| 1414 |
allowed to wrap and the token is not allowed to shrink below its content.
|
| 1415 |
The row around it wraps instead. */
|
| 1416 |
+
.c-fig{flex-wrap:nowrap !important; flex:none !important;}
|
| 1417 |
+
.c-fig__value,.c-fig__method,.c-fig__word{white-space:nowrap; flex:none;}
|
|
|
|
|
|
|
| 1418 |
.c-grade-row__label{min-width:0; overflow-wrap:anywhere;}
|
| 1419 |
|
| 1420 |
@media (prefers-reduced-motion:reduce){
|
|
|
|
| 1446 |
}
|
| 1447 |
|
| 1448 |
|
| 1449 |
+
/* ---- Library page ------------------------------------------------------
|
| 1450 |
+
Its own page, reached from the quick nav. One control: the card. Clicking
|
| 1451 |
+
or tapping a card makes that member a default and the page saves at once;
|
| 1452 |
+
there is no separate list of tick boxes to reconcile with the grid. The
|
| 1453 |
+
selected state has to survive a squint test: accent border, filled check,
|
| 1454 |
+
tinted wash — three signals, any one of which is enough. */
|
| 1455 |
+
.c-libpage{max-width:var(--shell-max); margin:0 auto; padding:var(--s5) var(--shell-pad) var(--s8);}
|
| 1456 |
+
.c-libpage__back{font-size:var(--t-label); color:var(--c-text-2); text-decoration:none;
|
| 1457 |
+
display:inline-flex; align-items:center; gap:6px;}
|
| 1458 |
+
.c-libpage__back:hover{color:var(--c-text);}
|
| 1459 |
+
.c-libpage__title{margin:var(--s3) 0 4px; font-family:var(--font-display);
|
| 1460 |
+
font-weight:600; font-size:clamp(26px,4vw,34px); letter-spacing:-.015em;
|
| 1461 |
+
color:var(--c-text);}
|
| 1462 |
+
.c-libpage__lede{margin:0 0 var(--s5); max-width:var(--measure); color:var(--c-text-2);}
|
| 1463 |
+
.c-libsave{position:sticky; top:0; z-index:9; display:flex; align-items:center; gap:var(--s3);
|
| 1464 |
+
background:color-mix(in srgb, var(--c-canvas) 88%, transparent);
|
| 1465 |
+
backdrop-filter:blur(6px); padding:var(--s2) 0; margin-bottom:var(--s2);}
|
| 1466 |
+
.c-libsave__count{font-size:var(--t-label); color:var(--c-text-2);}
|
| 1467 |
+
.c-libsave__count strong{color:var(--c-sage-deep); font-weight:650;}
|
| 1468 |
+
|
| 1469 |
+
.c-libgrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr));
|
| 1470 |
gap:var(--s4); margin:var(--s4) 0;}
|
| 1471 |
+
.c-libcard{position:relative; background:var(--c-surface);
|
| 1472 |
+
border:1.5px solid var(--c-hairline); border-radius:var(--r-lg);
|
| 1473 |
+
padding:var(--s4); cursor:pointer; -webkit-tap-highlight-color:transparent;
|
| 1474 |
+
display:flex; flex-direction:column; gap:6px; text-align:left;
|
| 1475 |
+
transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;}
|
| 1476 |
+
.c-libcard:hover{border-color:var(--c-border); box-shadow:var(--e1);}
|
| 1477 |
+
.c-libcard:focus-visible{outline:3px solid var(--c-focus, rgba(30,110,75,.4)); outline-offset:2px;}
|
| 1478 |
+
.c-libcard.is-on{border-color:var(--c-accent); background:color-mix(in srgb, var(--c-mint) 38%, var(--c-surface));}
|
| 1479 |
+
.c-libcard.is-on:hover{box-shadow:var(--e1);}
|
| 1480 |
+
/* The check is a real mark, not a decoration: absent = a quiet plus, present
|
| 1481 |
+
= a filled tick. It is what makes the card legible as a control at all. */
|
| 1482 |
+
.c-libcard__check{position:absolute; top:10px; right:10px; z-index:2;
|
| 1483 |
+
width:24px; height:24px; border-radius:50%;
|
| 1484 |
+
display:flex; align-items:center; justify-content:center;
|
| 1485 |
+
font-size:14px; line-height:1;
|
| 1486 |
+
border:1.5px solid var(--c-border); color:var(--c-muted);
|
| 1487 |
+
background:var(--c-surface);
|
| 1488 |
+
transition:all .15s ease;}
|
| 1489 |
+
.c-libcard.is-on .c-libcard__check{border-color:var(--c-accent);
|
| 1490 |
+
background:var(--c-accent); color:#fff;}
|
| 1491 |
+
.c-libcard__check::before{content:"+";}
|
| 1492 |
+
.c-libcard.is-on .c-libcard__check::before{content:"✓";}
|
| 1493 |
.c-libcard__media{margin:calc(var(--s4)*-1) calc(var(--s4)*-1) var(--s2);
|
| 1494 |
+
aspect-ratio:16/9; border-radius:calc(var(--r-lg) - 2px) calc(var(--r-lg) - 2px) 0 0;
|
| 1495 |
background:var(--c-fill) center/cover no-repeat;
|
| 1496 |
display:flex; align-items:center; justify-content:center;
|
| 1497 |
overflow:hidden; position:relative;}
|
| 1498 |
+
.c-libcard__media img{width:100%; height:100%; object-fit:cover;
|
| 1499 |
+
object-position:top center; display:block;
|
| 1500 |
+
position:absolute; inset:0;}
|
| 1501 |
+
/* The still is the run's own result. It sits under the animation, and it is
|
| 1502 |
+
what the card shows on a phone, where nothing hovers. */
|
| 1503 |
+
.c-libcard__poster{z-index:0;}
|
| 1504 |
+
.c-libcard__media.is-playing .c-libcard__poster{opacity:0;}
|
| 1505 |
+
.c-libcard__play{position:relative; z-index:1;
|
| 1506 |
+
display:inline-flex; align-items:center; gap:6px;
|
| 1507 |
+
font-size:var(--t-micro); color:var(--c-text-2);
|
| 1508 |
+
background:color-mix(in srgb, var(--c-surface) 92%, transparent);
|
| 1509 |
+
border:1px solid var(--c-hairline); backdrop-filter:blur(3px);
|
| 1510 |
+
border-radius:999px; padding:4px 10px; opacity:0;
|
| 1511 |
+
transition:opacity .15s ease;}
|
| 1512 |
+
.c-libcard__play::before{content:"▶"; font-size:9px; color:var(--c-sage-deep);}
|
| 1513 |
+
/* The invitation appears on approach and never sits permanently over the
|
| 1514 |
+
result it is inviting you to watch. Always visible where there is no
|
| 1515 |
+
poster to obscure, since then it is the only thing in the frame. */
|
| 1516 |
+
.c-libcard:hover .c-libcard__play,
|
| 1517 |
+
.c-libcard:focus-visible .c-libcard__play{opacity:1;}
|
| 1518 |
+
.c-libcard__media:not(:has(.c-libcard__poster)) .c-libcard__play{opacity:1;}
|
| 1519 |
.c-libcard__media.is-playing .c-libcard__play{display:none;}
|
| 1520 |
+
.c-libcard__head{display:flex; align-items:center; gap:var(--s2); padding-right:28px;}
|
| 1521 |
.c-libcard__kind{font-size:var(--t-micro); letter-spacing:.06em; text-transform:uppercase;
|
| 1522 |
padding:2px 8px; border-radius:999px; background:var(--c-fill);
|
| 1523 |
+
color:var(--c-text-2); flex:none;}
|
| 1524 |
+
.c-libcard__kind--skill{background:var(--c-mint); color:var(--c-sage-deep);}
|
|
|
|
|
|
|
| 1525 |
.c-libcard__name{margin:0; font-size:var(--t-body); font-weight:650; color:var(--c-text);
|
| 1526 |
text-transform:capitalize;}
|
| 1527 |
.c-libcard__author{margin:0; font-size:var(--t-micro); color:var(--c-muted);}
|
| 1528 |
+
.c-libcard__desc{margin:2px 0 0; font-size:13px; line-height:1.5;
|
| 1529 |
color:var(--c-text-2);
|
| 1530 |
display:-webkit-box; -webkit-line-clamp:4; -webkit-box-orient:vertical;
|
| 1531 |
overflow:hidden;}
|
| 1532 |
.c-libcard__ref{margin-top:auto; padding-top:var(--s2); font-family:var(--mono);
|
| 1533 |
font-size:11px; color:var(--c-muted);}
|
|
|
|
| 1534 |
|
| 1535 |
+
/* ---- Navigation, in the header band -----------------------------------
|
| 1536 |
+
A button (the library, which navigates) beside a link (a section of this
|
| 1537 |
+
page). They must look like one row of controls, so the button is styled to
|
| 1538 |
+
match the link rather than the other way round.
|
| 1539 |
+
|
| 1540 |
+
The row is pulled up against the header rule and the sign-in control sits
|
| 1541 |
+
with it, because a site's navigation belongs to its header. Left where it
|
| 1542 |
+
was, the page opened with a rule, a band of nothing, two floating pills,
|
| 1543 |
+
another band of nothing, and only then the product. */
|
| 1544 |
+
.c-quicknav{display:flex !important; flex-wrap:wrap !important; gap:var(--s2) !important;
|
| 1545 |
+
justify-content:flex-end !important; align-items:center !important;
|
| 1546 |
+
/* Pulled tight against the header rule on both sides. The shell
|
| 1547 |
+
puts a 24px gap between every child, which around a 34px row of
|
| 1548 |
+
pills left the page opening on a band of nothing; these margins
|
| 1549 |
+
spend that gap rather than adding to it. */
|
| 1550 |
+
margin:calc(var(--s4)*-1) 0 calc(var(--s2)*-1) !important;
|
| 1551 |
+
min-height:0 !important;}
|
| 1552 |
+
/* The row hugs its controls. Gradio wraps the anchor in a block that keeps a
|
| 1553 |
+
60px minimum, which made a 32px row of pills reserve twice its own height;
|
| 1554 |
+
the wrapper is told to be the size of what it contains. */
|
| 1555 |
+
.c-quicknav>*{min-height:0 !important; margin:0 !important; align-self:center !important;}
|
| 1556 |
+
.c-quicknav .block,.c-quicknav .prose,.c-quicknav nav{min-height:0 !important;
|
| 1557 |
+
padding:0 !important; margin:0 !important; display:flex !important;
|
| 1558 |
+
align-items:center !important;}
|
| 1559 |
+
.c-quicknav .prose p{margin:0 !important;}
|
| 1560 |
+
/* The wrapper keeps a 60px floor that no rule on it reaches, so the row is
|
| 1561 |
+
given the height of its own controls and allowed to overflow it. On a
|
| 1562 |
+
narrow screen the pills wrap, so the height goes back to automatic. */
|
| 1563 |
+
@media (min-width:701px){
|
| 1564 |
+
.c-quicknav{height:34px !important; overflow:visible !important;}
|
| 1565 |
+
}
|
| 1566 |
+
/* The Hugging Face control keeps company with the nav rather than spanning
|
| 1567 |
+
the page as a full-width slab. */
|
| 1568 |
+
.c-shell>.gradio-button.huggingface,
|
| 1569 |
+
.c-shell button.huggingface{width:auto !important; max-width:280px;
|
| 1570 |
+
margin-left:auto !important; margin-top:calc(var(--s3)*-1) !important;}
|
| 1571 |
+
.c-quicknav>*{flex:0 0 auto !important; width:auto !important; min-width:0 !important;}
|
| 1572 |
+
.c-quicknav__link,
|
| 1573 |
+
.c-quicknav .c-quicknav__btn button,
|
| 1574 |
+
.c-quicknav button.c-quicknav__btn{
|
| 1575 |
+
display:inline-flex !important; align-items:center !important;
|
| 1576 |
+
font-size:var(--t-label) !important; text-decoration:none; font-weight:550 !important;
|
| 1577 |
+
color:var(--c-text-2) !important; border:1px solid var(--c-hairline) !important;
|
| 1578 |
+
background:var(--c-surface) !important; padding:5px 14px !important;
|
| 1579 |
+
border-radius:999px !important; min-height:0 !important; height:auto !important;
|
| 1580 |
+
line-height:1.5 !important;
|
| 1581 |
+
transition:border-color .15s ease, color .15s ease;}
|
| 1582 |
+
.c-quicknav__link:hover,
|
| 1583 |
+
.c-quicknav .c-quicknav__btn button:hover,
|
| 1584 |
+
.c-quicknav button.c-quicknav__btn:hover{
|
| 1585 |
+
border-color:var(--c-accent) !important; color:var(--c-sage-deep) !important;}
|
| 1586 |
+
|
| 1587 |
+
/* The library page's own way back, set as a quiet control at the top left. */
|
| 1588 |
+
.c-libpage .c-libpage__backbtn button,
|
| 1589 |
+
.c-libpage button.c-libpage__backbtn{
|
| 1590 |
+
background:transparent !important; border:none !important; padding:0 !important;
|
| 1591 |
+
color:var(--c-text-2) !important; font-size:var(--t-label) !important;
|
| 1592 |
+
font-weight:550 !important; min-height:0 !important;}
|
| 1593 |
+
.c-libpage .c-libpage__backbtn button:hover,
|
| 1594 |
+
.c-libpage button.c-libpage__backbtn:hover{color:var(--c-text) !important;}
|
| 1595 |
+
.c-libpage .c-librarysearch input,
|
| 1596 |
+
.c-libpage .c-librarysearch textarea{max-width:420px;}
|
| 1597 |
+
/* The transport, present in the document and not on the page.
|
| 1598 |
+
``display:none`` rather than the usual clip-to-1px trick: a clipped
|
| 1599 |
+
element still occupies a box the browser hit-tests, so a stray box landed
|
| 1600 |
+
in the corner of the page and could take a click meant for something else.
|
| 1601 |
+
A synthetic ``click()`` — which is how a card forwards its selection —
|
| 1602 |
+
dispatches on a hidden element exactly as it does on a shown one, so
|
| 1603 |
+
nothing is lost by removing it from the layout entirely. It must never
|
| 1604 |
+
become ``visible=False`` in Python: gradio 6 leaves that out of the DOM. */
|
| 1605 |
+
.c-hiddenfield{display:none !important;}
|
| 1606 |
|
| 1607 |
/* ---- The no-agents veil ----------------------------------------------- */
|
| 1608 |
/* Shown only while somebody is signed in (the identity span has text) and
|
|
|
|
| 1611 |
.c-conversation{position:relative;}
|
| 1612 |
.c-shell:has(.c-identity:not(:empty)):has(.c-noworker-hook) .c-veil{
|
| 1613 |
display:flex; position:absolute; inset:0; z-index:12;
|
| 1614 |
+
/* Aligned to the top of the column rather than its centre. Centred, the
|
| 1615 |
+
panel sat across the privacy notice above the conversation and read as
|
| 1616 |
+
a modal over the whole page instead of an explanation of this column. */
|
| 1617 |
+
align-items:flex-start; justify-content:center;
|
| 1618 |
+
padding:var(--s7) var(--s5) var(--s5);
|
| 1619 |
+
background:color-mix(in srgb, var(--c-canvas) 72%, transparent);
|
| 1620 |
+
backdrop-filter:blur(2px); border-radius:var(--r-lg);
|
| 1621 |
/* The veil informs; it does not imprison. Pointer events pass through
|
| 1622 |
everywhere except its own panel, so a transient no-worker blip (a poll
|
| 1623 |
gap, a mode change) can never trap a click mid-flow. */
|
|
|
|
| 1628 |
.c-veil__panel{max-width:380px; text-align:center; background:var(--c-surface);
|
| 1629 |
border:1px solid var(--c-hairline); border-radius:var(--r-lg);
|
| 1630 |
box-shadow:var(--e2); padding:var(--s5);}
|
| 1631 |
+
@media (max-width:700px){
|
| 1632 |
+
.c-shell:has(.c-identity:not(:empty)):has(.c-noworker-hook) .c-veil{
|
| 1633 |
+
padding:var(--s5) var(--s4);}
|
| 1634 |
+
.c-veil__panel{padding:var(--s4);}
|
| 1635 |
+
}
|
| 1636 |
.c-veil__title{margin:0 0 6px; font-weight:650; font-size:var(--t-lg); color:var(--c-text);}
|
| 1637 |
.c-veil__body{margin:0 0 var(--s4); color:var(--c-text-2); line-height:1.55;}
|
| 1638 |
+
.c-veil__action{display:inline-block; text-decoration:none; background:var(--c-accent);
|
| 1639 |
+
color:#fff; padding:10px 22px; border-radius:var(--r-md); font-weight:600;}
|
| 1640 |
+
.c-veil__action:hover{background:var(--c-accent-hover);}
|
| 1641 |
|
| 1642 |
/* ---- Professional polish pass ----------------------------------------- */
|
| 1643 |
/* Calmer sections: the tail accordions read as pages, not widgets. */
|
|
|
|
| 1650 |
/* Inputs: quiet until focused. */
|
| 1651 |
.gradio-container input[type="text"], .gradio-container textarea{
|
| 1652 |
border-radius:var(--r-md) !important;}
|
| 1653 |
+
/* Buttons: one radius, one accent. The pill-shaped navy is gone; a primary
|
| 1654 |
+
action is the accent green, a secondary is paper with a hairline, and the
|
| 1655 |
+
Hugging Face sign-in follows the secondary language rather than bringing a
|
| 1656 |
+
fourth colour to the page. */
|
| 1657 |
+
.gradio-container button{border-radius:var(--r-md) !important; font-weight:600 !important;
|
| 1658 |
+
letter-spacing:0 !important; transition:background .15s ease, border-color .15s ease !important;}
|
| 1659 |
+
.gradio-container button.primary{background:var(--c-accent) !important; color:#fff !important;
|
| 1660 |
+
border:1px solid var(--c-accent) !important;}
|
| 1661 |
+
.gradio-container button.primary:hover{background:var(--c-accent-hover) !important;
|
| 1662 |
+
border-color:var(--c-accent-hover) !important;}
|
| 1663 |
+
.gradio-container button.secondary{background:var(--c-surface) !important;
|
| 1664 |
+
color:var(--c-text) !important; border:1px solid var(--c-border) !important;}
|
| 1665 |
+
.gradio-container button.secondary:hover{border-color:var(--c-accent) !important;
|
| 1666 |
+
color:var(--c-sage-deep) !important;}
|
| 1667 |
+
.gradio-container button.huggingface{background:var(--c-surface) !important;
|
| 1668 |
+
color:var(--c-text) !important; border:1px solid var(--c-border) !important;
|
| 1669 |
+
border-radius:var(--r-md) !important;}
|
| 1670 |
+
.gradio-container button.huggingface:hover{border-color:var(--c-accent) !important;}
|
| 1671 |
+
/* Focus is the accent, everywhere, and only on focus. */
|
| 1672 |
+
.gradio-container :is(button,a,input,textarea,select,[role="button"]):focus-visible{
|
| 1673 |
+
outline:3px solid rgba(30,110,75,.4) !important; outline-offset:2px !important;}
|
| 1674 |
+
/* Gradio's multipage navbar duplicates the quick nav; the page carries its
|
| 1675 |
+
own way back. Belt and braces beside gr.Navbar(visible=False). */
|
| 1676 |
+
nav.navbar, .gradio-container .navbar{display:none !important;}
|
| 1677 |
+
|
| 1678 |
+
/* ---- Answer artifacts: show the thing that came out -------------------- */
|
| 1679 |
+
/* A run that produced a file shows the file's own content, styled as the
|
| 1680 |
+
kind of thing it is, inside the answer. The GIF demos end on this block,
|
| 1681 |
+
because "generate a PDF" is only demonstrated by a PDF appearing. */
|
| 1682 |
+
.c-made{margin:var(--s3) 0 0; display:flex; flex-direction:column; gap:var(--s3);}
|
| 1683 |
+
.c-madecard{background:var(--c-surface); border:1px solid var(--c-hairline);
|
| 1684 |
+
border-radius:var(--r-md); overflow:hidden; max-width:520px;
|
| 1685 |
+
box-shadow:var(--e1);}
|
| 1686 |
+
.c-madecard__bar{display:flex; align-items:center; gap:var(--s2);
|
| 1687 |
+
padding:8px var(--s3); border-bottom:1px solid var(--c-hairline);
|
| 1688 |
+
background:var(--c-fill);}
|
| 1689 |
+
.c-madecard__dot{width:8px; height:8px; border-radius:50%; background:var(--c-accent); flex:none;}
|
| 1690 |
+
.c-madecard__name{font-family:var(--mono); font-size:12px; color:var(--c-text);
|
| 1691 |
+
overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
|
| 1692 |
+
.c-madecard__kind{margin-left:auto; flex:none; font-size:var(--t-micro); color:var(--c-muted);
|
| 1693 |
+
letter-spacing:.05em; text-transform:uppercase;}
|
| 1694 |
+
/* A glance, not a document viewer. The preview sits inside a conversation
|
| 1695 |
+
and has to read as one object at one glance; at 340px it was a scrolling
|
| 1696 |
+
panel taller than most of the answers around it. */
|
| 1697 |
+
.c-madecard__body{padding:var(--s3) var(--s4); max-height:210px; overflow:hidden;
|
| 1698 |
+
position:relative;}
|
| 1699 |
+
/* What is cut off is said with a fade rather than left as a hard edge, so a
|
| 1700 |
+
truncated preview reads as "there is more in the file" instead of as a
|
| 1701 |
+
rendering fault. The file itself is complete in Outputs. */
|
| 1702 |
+
.c-madecard__body::after{content:""; position:absolute; left:0; right:0; bottom:0;
|
| 1703 |
+
height:34px; pointer-events:none;
|
| 1704 |
+
background:linear-gradient(to bottom, transparent, var(--c-surface));}
|
| 1705 |
+
/* A document page: a white sheet with real margins and the actual text. */
|
| 1706 |
+
.c-made--doc .c-madecard__body{font-family:Georgia,'Times New Roman',serif;
|
| 1707 |
+
color:#26241F; line-height:1.6; font-size:13.5px;}
|
| 1708 |
+
.c-made--doc .c-madecard__body h4{margin:0 0 8px; font-size:16px; font-weight:700;}
|
| 1709 |
+
.c-made--doc .c-madecard__body p{margin:0 0 8px;}
|
| 1710 |
+
/* A sheet: a real grid of the actual cells. */
|
| 1711 |
+
.c-madegrid{border-collapse:collapse; width:100%; font-size:12px; font-family:var(--font);}
|
| 1712 |
+
.c-madegrid th{background:var(--c-fill); font-weight:650; text-align:left;}
|
| 1713 |
+
.c-madegrid th,.c-madegrid td{border:1px solid var(--c-hairline); padding:4px 8px;
|
| 1714 |
+
white-space:nowrap; max-width:180px; overflow:hidden; text-overflow:ellipsis;}
|
| 1715 |
+
/* A deck: each slide a 16:9 miniature with its actual title. */
|
| 1716 |
+
.c-madeslides{display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr));
|
| 1717 |
+
gap:var(--s2);}
|
| 1718 |
+
.c-madeslide{aspect-ratio:16/9; border:1px solid var(--c-hairline); border-radius:6px;
|
| 1719 |
+
background:#fff; padding:8px; display:flex; flex-direction:column; gap:3px; overflow:hidden;}
|
| 1720 |
+
.c-madeslide__no{font-size:9px; color:var(--c-muted);}
|
| 1721 |
+
.c-madeslide__title{font-size:11px; font-weight:650; color:var(--c-text); line-height:1.25;}
|
| 1722 |
+
.c-madeslide__line{height:3px; border-radius:2px; background:var(--c-fill); width:86%;}
|
| 1723 |
+
.c-madeslide__line+.c-madeslide__line{width:70%;}
|
| 1724 |
+
/* Code or plain text: the content itself, monospaced. */
|
| 1725 |
+
.c-made--text .c-madecard__body{padding:0;}
|
| 1726 |
+
.c-made--text .c-madecard__body::after{height:30px;}
|
| 1727 |
+
/* One height for every preview, whatever is inside it. The code preview kept
|
| 1728 |
+
its own taller cap, which meant a stylesheet came back twice the height of
|
| 1729 |
+
a document and the shelf of results had no common measure. */
|
| 1730 |
+
.c-made--text pre{margin:0; padding:var(--s3) var(--s4); font-family:var(--mono);
|
| 1731 |
+
font-size:12px; line-height:1.55; color:var(--c-text); overflow:hidden; max-height:210px;
|
| 1732 |
+
white-space:pre-wrap; overflow-wrap:anywhere;}
|
| 1733 |
+
.c-made__foot{padding:6px var(--s3); border-top:1px solid var(--c-hairline);
|
| 1734 |
+
font-size:var(--t-micro); color:var(--c-muted);}
|
| 1735 |
+
|
| 1736 |
@media (max-width:700px){
|
| 1737 |
+
.c-libgrid{grid-template-columns:1fr; gap:var(--s3);}
|
| 1738 |
.c-quicknav{justify-content:flex-start;}
|
| 1739 |
+
.c-libpage{padding:var(--s4) var(--s4) var(--s7);}
|
| 1740 |
+
.c-madecard{max-width:none;}
|
|
|
|
| 1741 |
}
|
| 1742 |
"""
|
distinct_server/render.py
CHANGED
|
@@ -37,6 +37,8 @@ from typing import Optional
|
|
| 37 |
|
| 38 |
__all__ = [
|
| 39 |
"activity",
|
|
|
|
|
|
|
| 40 |
"chip",
|
| 41 |
"comparator",
|
| 42 |
"credit",
|
|
@@ -44,20 +46,18 @@ __all__ = [
|
|
| 44 |
"empty_state",
|
| 45 |
"energy_headline",
|
| 46 |
"energy_panel",
|
| 47 |
-
"format_joules",
|
| 48 |
"esc",
|
|
|
|
| 49 |
"footer",
|
| 50 |
-
"
|
| 51 |
"header",
|
| 52 |
"join_this_server",
|
| 53 |
"library_help",
|
| 54 |
"library_summary",
|
| 55 |
"live_steps",
|
| 56 |
-
"
|
| 57 |
"no_tools_note",
|
| 58 |
"notice",
|
| 59 |
-
"rubric_legend",
|
| 60 |
-
"rubric_section",
|
| 61 |
"run_receipts",
|
| 62 |
"section_heading",
|
| 63 |
"spinner",
|
|
@@ -221,7 +221,7 @@ def join_this_server(*, addresses, code: str, qr: str = "", tools: str = "local"
|
|
| 221 |
# into every shell anybody actually uses.
|
| 222 |
command = (
|
| 223 |
f"python -m distinct_agent --server {first} "
|
| 224 |
-
f"--pair {code or 'YOUR-CODE'} --models
|
| 225 |
)
|
| 226 |
picture = f'<div class="c-join__qr">{qr}</div>' if qr else ""
|
| 227 |
return (
|
|
@@ -261,14 +261,13 @@ def library_summary(*, shown: int, matched: int, total: int, chosen: int) -> str
|
|
| 261 |
else:
|
| 262 |
body = f"All {total} members."
|
| 263 |
kept = (
|
| 264 |
-
"
|
| 265 |
if not chosen
|
| 266 |
-
else f"{chosen}
|
| 267 |
)
|
| 268 |
return (
|
| 269 |
-
'<
|
| 270 |
-
f"{esc(body)} {
|
| 271 |
-
"offers it, and can be unticked for any single run.</span></p>"
|
| 272 |
)
|
| 273 |
|
| 274 |
|
|
@@ -845,6 +844,369 @@ STEP_LEAD = {
|
|
| 845 |
}
|
| 846 |
|
| 847 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 848 |
def run_steps(steps: Sequence[Mapping[str, object]]) -> str:
|
| 849 |
"""The agent's turns, in order, kept after the run that took them.
|
| 850 |
|
|
@@ -891,11 +1253,12 @@ def run_steps(steps: Sequence[Mapping[str, object]]) -> str:
|
|
| 891 |
|
| 892 |
#: The wash each conversation state gets in the rail. Faint on purpose: see
|
| 893 |
#: the note in presentation.py. A state with no entry gets no wash, which is
|
| 894 |
-
#: how "idle" and "completed" are drawn.
|
|
|
|
| 895 |
CONVERSATION_TONES = {
|
| 896 |
-
"waiting": "#
|
| 897 |
-
"generating": "#
|
| 898 |
-
"failed": "#
|
| 899 |
}
|
| 900 |
|
| 901 |
|
|
@@ -1185,18 +1548,28 @@ _DEMO_DIR = (Path(__file__).resolve().parent.parent / "assets" / "library-demos"
|
|
| 1185 |
_DEMO_BASE = f"/gradio_api/file={_DEMO_DIR.as_posix()}"
|
| 1186 |
|
| 1187 |
|
| 1188 |
-
def
|
| 1189 |
-
"""
|
| 1190 |
|
| 1191 |
-
|
| 1192 |
demonstration the repository does not carry. Slug: the ref with ``@`` and
|
| 1193 |
``.`` flattened, which is how the recorder names them.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1194 |
"""
|
| 1195 |
|
| 1196 |
slug = ref.replace("@", "-").replace(".", "-")
|
| 1197 |
-
if (_DEMO_DIR / f"{slug}.
|
| 1198 |
-
|
| 1199 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1200 |
|
| 1201 |
|
| 1202 |
def library_cards(rows: Sequence[Mapping[str, object]], chosen: Sequence[str]) -> str:
|
|
@@ -1222,24 +1595,37 @@ def library_cards(rows: Sequence[Mapping[str, object]], chosen: Sequence[str]) -
|
|
| 1222 |
name = str(row.get("name", ref))
|
| 1223 |
author = str(row.get("author", "distinct"))
|
| 1224 |
description = str(row.get("description", ""))
|
| 1225 |
-
gif =
|
| 1226 |
-
media =
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
| 1230 |
-
|
| 1231 |
-
|
| 1232 |
-
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
|
| 1236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1237 |
cards.append(
|
| 1238 |
-
f'<article class="c-libcard c-libcard--{esc(kind)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1239 |
f"{media}"
|
| 1240 |
'<div class="c-libcard__head">'
|
| 1241 |
f'<span class="c-libcard__kind c-libcard__kind--{esc(kind)}">{esc(kind)}</span>'
|
| 1242 |
-
f"{default_mark}"
|
| 1243 |
"</div>"
|
| 1244 |
f'<h3 class="c-libcard__name">{esc(name)}</h3>'
|
| 1245 |
f'<p class="c-libcard__author">by {esc(author)}</p>'
|
|
@@ -1501,253 +1887,231 @@ def _safe_url(value: object) -> str:
|
|
| 1501 |
#: reader who conflates them draws exactly the wrong conclusion, so each token
|
| 1502 |
#: carries its own scale name inside it rather than relying on a column header
|
| 1503 |
#: that may be scrolled away, screenshotted off, or read past.
|
| 1504 |
-
|
| 1505 |
-
|
| 1506 |
-
|
| 1507 |
-
|
| 1508 |
-
|
| 1509 |
-
|
|
|
|
| 1510 |
}
|
| 1511 |
|
| 1512 |
|
| 1513 |
-
def
|
| 1514 |
-
letter: Optional[str],
|
| 1515 |
*,
|
| 1516 |
-
|
| 1517 |
-
|
| 1518 |
-
|
| 1519 |
-
absent_word: str = "
|
| 1520 |
) -> str:
|
| 1521 |
-
"""One
|
| 1522 |
|
| 1523 |
-
|
|
|
|
|
|
|
|
|
|
| 1524 |
|
| 1525 |
-
**
|
| 1526 |
-
|
| 1527 |
-
|
| 1528 |
-
asserts a poor result that nobody measured.
|
| 1529 |
|
| 1530 |
-
**A
|
| 1531 |
-
|
| 1532 |
-
|
| 1533 |
-
|
| 1534 |
-
impossible to separate.
|
| 1535 |
|
| 1536 |
-
**
|
| 1537 |
-
|
| 1538 |
-
outlined; and both name their own scale inside the token.
|
| 1539 |
"""
|
| 1540 |
|
| 1541 |
-
|
| 1542 |
-
|
| 1543 |
-
|
| 1544 |
-
|
| 1545 |
-
if letter is None or not str(letter).strip():
|
| 1546 |
-
# ``absent_word`` distinguishes the two absences the rubric names:
|
| 1547 |
-
# "not assessed" (nothing published) and "withheld" (published, but
|
| 1548 |
-
# coverage too thin for an overall letter). Both are absences, never
|
| 1549 |
-
# letters, and a withheld overall still carries its coverage so the
|
| 1550 |
-
# reader can see why it was withheld.
|
| 1551 |
-
word = esc(absent_word if str(absent_word).strip() else "not assessed")
|
| 1552 |
-
coverage = ""
|
| 1553 |
-
if assessed is not None and total is not None:
|
| 1554 |
-
coverage = (
|
| 1555 |
-
f'<span class="c-score__coverage">{esc(assessed)} of {esc(total)}</span>'
|
| 1556 |
-
)
|
| 1557 |
return (
|
| 1558 |
-
|
| 1559 |
-
f'
|
| 1560 |
-
)
|
| 1561 |
-
|
| 1562 |
-
body = f'<span class="c-score__letter">{esc(letter)}</span>'
|
| 1563 |
-
if assessed is not None and total is not None:
|
| 1564 |
-
body += (
|
| 1565 |
-
f'<span class="c-score__coverage">{esc(assessed)} of {esc(total)}</span>'
|
| 1566 |
)
|
| 1567 |
-
return f'<span class="c-score c-score--{esc(scale_key)}">{tag}{body}</span>'
|
| 1568 |
-
|
| 1569 |
-
|
| 1570 |
-
def rubric_legend() -> str:
|
| 1571 |
-
"""Two scales, what each one answers, and the case where they disagree.
|
| 1572 |
-
|
| 1573 |
-
The worked example is the load-bearing part. Both misreadings this guards
|
| 1574 |
-
against are the first reading most people take, so the legend shows them
|
| 1575 |
-
happening rather than only warning against them.
|
| 1576 |
-
"""
|
| 1577 |
|
|
|
|
|
|
|
|
|
|
| 1578 |
return (
|
| 1579 |
-
'<
|
| 1580 |
-
'<
|
| 1581 |
-
'<
|
| 1582 |
-
|
| 1583 |
-
+ grade_token("A", scale=PERFORMANCE, assessed=6, total=6)
|
| 1584 |
-
+ '<p class="c-legend__scale-body"><strong>Impact.</strong> How heavily the release '
|
| 1585 |
-
"weighed on energy, water, land and the rest. A is the lightest. The coverage inside "
|
| 1586 |
-
"the token is part of the score: a letter drawn from two areas out of six describes "
|
| 1587 |
-
"two areas out of six, and the other four are unknown rather than fine.</p>"
|
| 1588 |
-
"</div>"
|
| 1589 |
-
'<div class="c-legend__scale">'
|
| 1590 |
-
+ grade_token("A", scale=EVIDENCE)
|
| 1591 |
-
+ '<p class="c-legend__scale-body"><strong>Evidence.</strong> How good the published '
|
| 1592 |
-
"working is: method, boundary, primary sources. It says nothing about the size of "
|
| 1593 |
-
"the impact, only about how much you can rely on the figure beside it.</p>"
|
| 1594 |
-
"</div>"
|
| 1595 |
-
"</div>"
|
| 1596 |
-
'<p class="c-legend__example"><span class="c-legend__example-mark" '
|
| 1597 |
-
'aria-hidden="true">?</span><span><strong>The two come apart, and that is the '
|
| 1598 |
-
"point.</strong> Lucie-7B has the best method quality of anything reviewed here and "
|
| 1599 |
-
"still carries no impact letter, because too few areas have a published result to "
|
| 1600 |
-
"score. A smaller model can show a B on the strength of a single measurement. The "
|
| 1601 |
-
"high-evidence model is the better-documented one; the B is the thinner claim."
|
| 1602 |
-
"</span></p>"
|
| 1603 |
-
'<p class="c-legend__never">Cradle to release. Never added to, and never compared '
|
| 1604 |
-
"with, the use-phase energy this network measures per run.</p>"
|
| 1605 |
-
"</section>"
|
| 1606 |
)
|
| 1607 |
|
| 1608 |
|
| 1609 |
-
def
|
| 1610 |
-
"""
|
| 1611 |
|
| 1612 |
-
|
| 1613 |
-
|
| 1614 |
-
|
| 1615 |
-
|
| 1616 |
-
|
| 1617 |
-
|
| 1618 |
-
|
| 1619 |
-
|
| 1620 |
-
|
| 1621 |
-
|
| 1622 |
-
|
| 1623 |
-
|
| 1624 |
-
|
| 1625 |
-
|
| 1626 |
-
token = grade_token(str(letter), scale=PERFORMANCE)
|
| 1627 |
-
if isinstance(value, str) and value.strip():
|
| 1628 |
-
token += f'<span class="c-grade-row__value">{esc(value)}</span>'
|
| 1629 |
-
return token
|
| 1630 |
-
if state == "reported" and isinstance(value, str) and value.strip():
|
| 1631 |
-
return (
|
| 1632 |
-
f'<span class="c-score c-score--{PERFORMANCE} c-score--reported">'
|
| 1633 |
-
'<span class="c-score__scale">impact</span>'
|
| 1634 |
-
f'<span class="c-score__word">{esc(value)} · reported, no letter</span>'
|
| 1635 |
-
"</span>"
|
| 1636 |
-
)
|
| 1637 |
-
return grade_token(None, scale=PERFORMANCE)
|
| 1638 |
-
return grade_token(entry, scale=PERFORMANCE)
|
| 1639 |
|
| 1640 |
|
| 1641 |
-
def
|
| 1642 |
*,
|
| 1643 |
name: str,
|
| 1644 |
-
|
| 1645 |
-
|
| 1646 |
-
|
| 1647 |
-
|
| 1648 |
-
|
| 1649 |
-
categories: Sequence[object] = (),
|
| 1650 |
-
download_url: str = "",
|
| 1651 |
-
download_label: str = "",
|
| 1652 |
note: str = "",
|
| 1653 |
-
impact_absent_word: str = "not assessed",
|
| 1654 |
) -> str:
|
| 1655 |
-
"""One model release,
|
| 1656 |
-
|
| 1657 |
-
``impact`` and ``evidence`` are passed straight through and are **never
|
| 1658 |
-
derived here**. When the catalogue withholds one, this renders an explicit
|
| 1659 |
-
absence. Computing a letter from partial categories is exactly the
|
| 1660 |
-
assessor-created estimate the rubric prohibits, so there is no code path
|
| 1661 |
-
that could, and the coverage that caused the absence travels inside the
|
| 1662 |
-
token that reports it.
|
| 1663 |
-
|
| 1664 |
-
``categories`` entries are either legacy ``(label, letter)`` tuples or
|
| 1665 |
-
mappings ``{"label", "state", "letter", "value"}`` following the display
|
| 1666 |
-
contract in ``model_assessments.json``: read ``state`` before rendering
|
| 1667 |
-
anything, and never render a letter for a category whose state is not
|
| 1668 |
-
``grade``.
|
| 1669 |
-
"""
|
| 1670 |
|
| 1671 |
-
|
| 1672 |
-
|
| 1673 |
-
|
| 1674 |
-
if isinstance(entry, Sequence) and not isinstance(entry, str) and entry:
|
| 1675 |
-
return str(entry[0])
|
| 1676 |
-
return ""
|
| 1677 |
|
| 1678 |
-
|
| 1679 |
-
|
| 1680 |
-
|
| 1681 |
-
|
| 1682 |
-
return _category_cell(entry[1])
|
| 1683 |
-
return _category_cell(None)
|
| 1684 |
|
| 1685 |
rows = "".join(
|
| 1686 |
-
|
| 1687 |
-
f"{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1688 |
for entry in categories
|
| 1689 |
)
|
| 1690 |
|
| 1691 |
-
|
| 1692 |
-
link = (
|
| 1693 |
f'<a class="c-grade-card__link" href="{esc(href)}" target="_blank" '
|
| 1694 |
-
f'rel="noopener noreferrer">{esc(
|
| 1695 |
-
|
| 1696 |
-
|
| 1697 |
)
|
| 1698 |
-
reason = f'<p class="c-grade-card__note">{esc(note)}</p>' if note else ""
|
| 1699 |
|
| 1700 |
-
|
| 1701 |
-
|
| 1702 |
-
|
|
|
|
|
|
|
|
|
|
| 1703 |
else ""
|
| 1704 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1705 |
return (
|
| 1706 |
'<article class="c-grade-card">'
|
| 1707 |
'<p class="c-grade-card__head">'
|
| 1708 |
-
f'<span class="c-grade-card__name">{esc(name)}</span>{
|
| 1709 |
-
'<
|
| 1710 |
-
+ grade_token(
|
| 1711 |
-
impact,
|
| 1712 |
-
scale=PERFORMANCE,
|
| 1713 |
-
assessed=assessed,
|
| 1714 |
-
total=total,
|
| 1715 |
-
absent_word=impact_absent_word,
|
| 1716 |
-
)
|
| 1717 |
-
+ grade_token(evidence, scale=EVIDENCE)
|
| 1718 |
-
+ evidence_note
|
| 1719 |
-
+ "</div>"
|
| 1720 |
+ (f'<div class="c-grade-rows">{rows}</div>' if rows else "")
|
| 1721 |
-
+
|
|
|
|
|
|
|
|
|
|
| 1722 |
+ "</article>"
|
| 1723 |
)
|
| 1724 |
|
| 1725 |
|
| 1726 |
-
def
|
| 1727 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1728 |
|
| 1729 |
-
``warning`` is the data file's
|
| 1730 |
-
|
| 1731 |
"""
|
| 1732 |
|
| 1733 |
body = "".join(cards)
|
| 1734 |
if not body:
|
| 1735 |
body = empty_state(
|
| 1736 |
-
glyph="
|
| 1737 |
title="No assessed releases",
|
| 1738 |
body=(
|
| 1739 |
"No model in this catalogue has a published, model-specific assessment "
|
| 1740 |
-
"recorded here yet. Nothing is
|
| 1741 |
),
|
| 1742 |
)
|
| 1743 |
-
caution = (
|
| 1744 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1745 |
)
|
| 1746 |
return (
|
| 1747 |
'<div class="c-rubric">'
|
| 1748 |
-
+
|
| 1749 |
+ caution
|
| 1750 |
+ f'<div class="c-grade-cards">{body}</div>'
|
|
|
|
| 1751 |
+ "</div>"
|
| 1752 |
)
|
| 1753 |
|
|
|
|
| 37 |
|
| 38 |
__all__ = [
|
| 39 |
"activity",
|
| 40 |
+
"assessment_legend",
|
| 41 |
+
"assessment_section",
|
| 42 |
"chip",
|
| 43 |
"comparator",
|
| 44 |
"credit",
|
|
|
|
| 46 |
"empty_state",
|
| 47 |
"energy_headline",
|
| 48 |
"energy_panel",
|
|
|
|
| 49 |
"esc",
|
| 50 |
+
"figure_token",
|
| 51 |
"footer",
|
| 52 |
+
"format_joules",
|
| 53 |
"header",
|
| 54 |
"join_this_server",
|
| 55 |
"library_help",
|
| 56 |
"library_summary",
|
| 57 |
"live_steps",
|
| 58 |
+
"model_evidence_card",
|
| 59 |
"no_tools_note",
|
| 60 |
"notice",
|
|
|
|
|
|
|
| 61 |
"run_receipts",
|
| 62 |
"section_heading",
|
| 63 |
"spinner",
|
|
|
|
| 221 |
# into every shell anybody actually uses.
|
| 222 |
command = (
|
| 223 |
f"python -m distinct_agent --server {first} "
|
| 224 |
+
f"--pair {code or 'YOUR-CODE'} --models olmoe-1b-7b-0924-instruct --tools {tools or 'local'}"
|
| 225 |
)
|
| 226 |
picture = f'<div class="c-join__qr">{qr}</div>' if qr else ""
|
| 227 |
return (
|
|
|
|
| 261 |
else:
|
| 262 |
body = f"All {total} members."
|
| 263 |
kept = (
|
| 264 |
+
"Tap a card to make it a default — it saves at once."
|
| 265 |
if not chosen
|
| 266 |
+
else f"<strong>{chosen}</strong> saved as {'a default' if chosen == 1 else 'defaults'}."
|
| 267 |
)
|
| 268 |
return (
|
| 269 |
+
'<div class="c-libsave"><span class="c-libsave__count">'
|
| 270 |
+
f"{esc(body)} {kept}</span></div>"
|
|
|
|
| 271 |
)
|
| 272 |
|
| 273 |
|
|
|
|
| 844 |
}
|
| 845 |
|
| 846 |
|
| 847 |
+
# --------------------------------------------------------------------------
|
| 848 |
+
# What the run made: the artifact's own content, in the answer
|
| 849 |
+
# --------------------------------------------------------------------------
|
| 850 |
+
#
|
| 851 |
+
# A run that produced a file used to say so with a count in the receipt and a
|
| 852 |
+
# row in the Outputs panel. Both are true and neither shows the thing. These
|
| 853 |
+
# two functions close that gap: `artifact_preview_data` reads the stored file
|
| 854 |
+
# once, at the moment the answer is claimed, and reduces it to a small plain
|
| 855 |
+
# record; `made_things` renders those records as the kind of object each one
|
| 856 |
+
# is — a document page, a sheet of cells, a fan of slides, the text itself.
|
| 857 |
+
#
|
| 858 |
+
# The split matters. Derivation happens once and the record rides in browser
|
| 859 |
+
# state beside the answer, so the transcript can re-render every two seconds
|
| 860 |
+
# without re-opening zip files. And because the record is data assembled here
|
| 861 |
+
# from bytes the worker sent, rendering it is the same trust exercise as the
|
| 862 |
+
# rest of this file: every string is escaped, structure comes from this
|
| 863 |
+
# module, and a file that cannot be parsed degrades to its name and size
|
| 864 |
+
# rather than to an error.
|
| 865 |
+
|
| 866 |
+
#: Reading cap per artifact. Files are small (the job budget bounds them);
|
| 867 |
+
#: this is the backstop that keeps a surprise out of the render path.
|
| 868 |
+
_PREVIEW_READ_CAP = 400_000
|
| 869 |
+
|
| 870 |
+
_TEXT_SUFFIXES = {
|
| 871 |
+
".txt", ".css", ".json", ".mermaid", ".py", ".js", ".html", ".svg",
|
| 872 |
+
".yaml", ".yml", ".toml", ".xml",
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
|
| 876 |
+
def _xml_texts(blob: bytes, pattern: str) -> list[str]:
|
| 877 |
+
import re as _re
|
| 878 |
+
|
| 879 |
+
return [
|
| 880 |
+
escape_entities(match)
|
| 881 |
+
for match in _re.findall(pattern, blob.decode("utf-8", "replace"), _re.S)
|
| 882 |
+
]
|
| 883 |
+
|
| 884 |
+
|
| 885 |
+
def escape_entities(text: str) -> str:
|
| 886 |
+
"""Resolve the five XML entities OOXML writes; nothing else."""
|
| 887 |
+
|
| 888 |
+
return (
|
| 889 |
+
text.replace("<", "<").replace(">", ">").replace(""", '"')
|
| 890 |
+
.replace("'", "'").replace("&", "&")
|
| 891 |
+
)
|
| 892 |
+
|
| 893 |
+
|
| 894 |
+
def _docx_preview(blob: bytes) -> Optional[Mapping[str, object]]:
|
| 895 |
+
import io as _io
|
| 896 |
+
import re as _re
|
| 897 |
+
import zipfile as _zipfile
|
| 898 |
+
|
| 899 |
+
try:
|
| 900 |
+
with _zipfile.ZipFile(_io.BytesIO(blob)) as archive:
|
| 901 |
+
document = archive.read("word/document.xml")
|
| 902 |
+
except Exception:
|
| 903 |
+
return None
|
| 904 |
+
paragraphs: list[str] = []
|
| 905 |
+
for paragraph in _re.findall(rb"<w:p[ >].*?</w:p>", document, _re.S):
|
| 906 |
+
runs = _xml_texts(paragraph, r"<w:t[^>]*>(.*?)</w:t>")
|
| 907 |
+
text = "".join(runs).strip()
|
| 908 |
+
if text:
|
| 909 |
+
paragraphs.append(text)
|
| 910 |
+
if not paragraphs:
|
| 911 |
+
return None
|
| 912 |
+
return {"kind": "doc", "title": paragraphs[0][:160], "paras": paragraphs[1:5]}
|
| 913 |
+
|
| 914 |
+
|
| 915 |
+
def _xlsx_preview(blob: bytes) -> Optional[Mapping[str, object]]:
|
| 916 |
+
import io as _io
|
| 917 |
+
import re as _re
|
| 918 |
+
import zipfile as _zipfile
|
| 919 |
+
|
| 920 |
+
try:
|
| 921 |
+
with _zipfile.ZipFile(_io.BytesIO(blob)) as archive:
|
| 922 |
+
sheet = archive.read("xl/worksheets/sheet1.xml")
|
| 923 |
+
try:
|
| 924 |
+
shared = archive.read("xl/sharedStrings.xml")
|
| 925 |
+
except KeyError:
|
| 926 |
+
shared = b""
|
| 927 |
+
except Exception:
|
| 928 |
+
return None
|
| 929 |
+
strings = _xml_texts(shared, r"<t[^>]*>(.*?)</t>") if shared else []
|
| 930 |
+
rows: list[list[str]] = []
|
| 931 |
+
# CELLS IN DOCUMENT ORDER, WHATEVER KIND THEY ARE.
|
| 932 |
+
#
|
| 933 |
+
# The first version of this pulled the numbers out with one pattern and
|
| 934 |
+
# the inline strings with another, then concatenated the two lists. Every
|
| 935 |
+
# mixed row came out rotated — "Widget | 4 | 9.50" rendered as
|
| 936 |
+
# "4 | 9.50 | Widget" — because the text cells were appended after the
|
| 937 |
+
# numeric ones rather than kept in their columns. A preview that reorders
|
| 938 |
+
# somebody's spreadsheet is worse than no preview, so the cells are now
|
| 939 |
+
# walked once, in order, and each is read according to its own type.
|
| 940 |
+
for row in _re.findall(rb"<row[ >].*?</row>", sheet, _re.S)[:8]:
|
| 941 |
+
cells: list[str] = []
|
| 942 |
+
for cell in _re.findall(rb"<c[ >].*?(?:</c>|/>)", row, _re.S):
|
| 943 |
+
kind = _re.search(rb'\st="(\w+)"', cell)
|
| 944 |
+
kind = kind.group(1).decode() if kind else "n"
|
| 945 |
+
inline = _xml_texts(cell, r"<t[^>]*>(.*?)</t>")
|
| 946 |
+
if inline:
|
| 947 |
+
cells.append(inline[0])
|
| 948 |
+
continue
|
| 949 |
+
value = _re.search(rb"<v>(.*?)</v>", cell, _re.S)
|
| 950 |
+
if value is None:
|
| 951 |
+
cells.append("")
|
| 952 |
+
continue
|
| 953 |
+
raw = escape_entities(value.group(1).decode("utf-8", "replace"))
|
| 954 |
+
if kind == "s":
|
| 955 |
+
try:
|
| 956 |
+
raw = strings[int(raw)]
|
| 957 |
+
except (ValueError, IndexError):
|
| 958 |
+
pass
|
| 959 |
+
cells.append(raw)
|
| 960 |
+
while cells and cells[-1] == "":
|
| 961 |
+
cells.pop()
|
| 962 |
+
if cells:
|
| 963 |
+
rows.append(cells[:8])
|
| 964 |
+
if not rows:
|
| 965 |
+
return None
|
| 966 |
+
return {"kind": "sheet", "rows": rows}
|
| 967 |
+
|
| 968 |
+
|
| 969 |
+
def _pptx_preview(blob: bytes) -> Optional[Mapping[str, object]]:
|
| 970 |
+
import io as _io
|
| 971 |
+
import re as _re
|
| 972 |
+
import zipfile as _zipfile
|
| 973 |
+
|
| 974 |
+
try:
|
| 975 |
+
with _zipfile.ZipFile(_io.BytesIO(blob)) as archive:
|
| 976 |
+
names = sorted(
|
| 977 |
+
name
|
| 978 |
+
for name in archive.namelist()
|
| 979 |
+
if _re.fullmatch(r"ppt/slides/slide\d+\.xml", name)
|
| 980 |
+
)
|
| 981 |
+
slides: list[Mapping[str, str]] = []
|
| 982 |
+
for name in names[:8]:
|
| 983 |
+
texts = _xml_texts(archive.read(name), r"<a:t>(.*?)</a:t>")
|
| 984 |
+
texts = [text for text in (t.strip() for t in texts) if text]
|
| 985 |
+
if texts:
|
| 986 |
+
slides.append({"title": texts[0][:120]})
|
| 987 |
+
except Exception:
|
| 988 |
+
return None
|
| 989 |
+
if not slides:
|
| 990 |
+
return None
|
| 991 |
+
return {"kind": "deck", "slides": slides}
|
| 992 |
+
|
| 993 |
+
|
| 994 |
+
def _pdf_preview(blob: bytes) -> Optional[Mapping[str, object]]:
|
| 995 |
+
import re as _re
|
| 996 |
+
import zlib as _zlib
|
| 997 |
+
|
| 998 |
+
pages = len(_re.findall(rb"/Type\s*/Page\b(?!s)", blob))
|
| 999 |
+
# Content streams are flate-compressed (the PDF this product writes says so
|
| 1000 |
+
# in its own builder), so the text operators only exist after inflating.
|
| 1001 |
+
# Streams that will not inflate are skipped rather than guessed at, and a
|
| 1002 |
+
# PDF nobody can read still reports its page count, which is a fact.
|
| 1003 |
+
chunks = [blob]
|
| 1004 |
+
for raw in _re.findall(rb"stream\r?\n(.*?)\r?\nendstream", blob, _re.S):
|
| 1005 |
+
try:
|
| 1006 |
+
chunks.append(_zlib.decompress(raw))
|
| 1007 |
+
except Exception:
|
| 1008 |
+
continue
|
| 1009 |
+
lines: list[str] = []
|
| 1010 |
+
seen: set[str] = set()
|
| 1011 |
+
for chunk in chunks:
|
| 1012 |
+
for raw in _re.findall(rb"\(((?:[^()\\]|\\.)*)\)\s*Tj", chunk):
|
| 1013 |
+
text = raw.decode("latin-1", "replace")
|
| 1014 |
+
text = _re.sub(r"\\([()\\])", r"\1", text).strip()
|
| 1015 |
+
if text and text not in seen:
|
| 1016 |
+
seen.add(text)
|
| 1017 |
+
lines.append(text)
|
| 1018 |
+
if len(lines) >= 14:
|
| 1019 |
+
break
|
| 1020 |
+
lines = lines[:14]
|
| 1021 |
+
if not lines and not pages:
|
| 1022 |
+
return None
|
| 1023 |
+
record: dict[str, object] = {"kind": "doc", "note": f"{pages or 1} page PDF"}
|
| 1024 |
+
if lines:
|
| 1025 |
+
record["title"] = lines[0][:160]
|
| 1026 |
+
record["paras"] = lines[1:5]
|
| 1027 |
+
else:
|
| 1028 |
+
record["title"] = "PDF document"
|
| 1029 |
+
record["paras"] = []
|
| 1030 |
+
return record
|
| 1031 |
+
|
| 1032 |
+
|
| 1033 |
+
def _markdown_preview(text: str) -> Optional[Mapping[str, object]]:
|
| 1034 |
+
"""Markdown as the page it describes, not as its source.
|
| 1035 |
+
|
| 1036 |
+
A guide rendered as a wall of hashes and asterisks demonstrates nothing:
|
| 1037 |
+
the person is looking at the thing the run made, and the thing the run
|
| 1038 |
+
made is a document. Headings become the title, bullets keep their bullet,
|
| 1039 |
+
and everything else is a paragraph.
|
| 1040 |
+
"""
|
| 1041 |
+
|
| 1042 |
+
lines = [line.rstrip() for line in text.splitlines()]
|
| 1043 |
+
title = ""
|
| 1044 |
+
paras: list[str] = []
|
| 1045 |
+
for line in lines:
|
| 1046 |
+
stripped = line.strip()
|
| 1047 |
+
if not stripped:
|
| 1048 |
+
continue
|
| 1049 |
+
if stripped.startswith("#"):
|
| 1050 |
+
heading = stripped.lstrip("#").strip()
|
| 1051 |
+
if not title:
|
| 1052 |
+
title = heading[:160]
|
| 1053 |
+
elif len(paras) < 4:
|
| 1054 |
+
paras.append(heading[:200])
|
| 1055 |
+
continue
|
| 1056 |
+
if stripped.startswith(("-", "*", "+")) and len(stripped) > 1:
|
| 1057 |
+
stripped = "• " + stripped[1:].strip()
|
| 1058 |
+
cleaned = stripped.replace("**", "").replace("`", "")
|
| 1059 |
+
if not title:
|
| 1060 |
+
title = cleaned[:160]
|
| 1061 |
+
elif len(paras) < 4:
|
| 1062 |
+
paras.append(cleaned[:200])
|
| 1063 |
+
if len(paras) >= 4:
|
| 1064 |
+
break
|
| 1065 |
+
if not title:
|
| 1066 |
+
return None
|
| 1067 |
+
return {"kind": "doc", "title": title, "paras": paras}
|
| 1068 |
+
|
| 1069 |
+
|
| 1070 |
+
def _table_preview(text: str) -> Optional[Mapping[str, object]]:
|
| 1071 |
+
rows = [line for line in text.splitlines() if line.strip()][:8]
|
| 1072 |
+
if not rows:
|
| 1073 |
+
return None
|
| 1074 |
+
split = [row.split(",") if "," in rows[0] else row.split("|") for row in rows]
|
| 1075 |
+
return {"kind": "sheet", "rows": [[cell.strip() for cell in row][:8] for row in split]}
|
| 1076 |
+
|
| 1077 |
+
|
| 1078 |
+
def artifact_preview_data(paths: Sequence[str]) -> list[Mapping[str, object]]:
|
| 1079 |
+
"""Small, renderable records of what a run's files contain.
|
| 1080 |
+
|
| 1081 |
+
Read once per file, capped, every failure downgraded to name-and-size.
|
| 1082 |
+
The records are plain data so they can live in browser state beside the
|
| 1083 |
+
answer they belong to.
|
| 1084 |
+
"""
|
| 1085 |
+
|
| 1086 |
+
records: list[Mapping[str, object]] = []
|
| 1087 |
+
for item in paths:
|
| 1088 |
+
path = Path(str(item))
|
| 1089 |
+
try:
|
| 1090 |
+
size = path.stat().st_size
|
| 1091 |
+
blob = path.read_bytes()[:_PREVIEW_READ_CAP]
|
| 1092 |
+
except OSError:
|
| 1093 |
+
continue
|
| 1094 |
+
suffix = path.suffix.lower()
|
| 1095 |
+
parsed: Optional[Mapping[str, object]] = None
|
| 1096 |
+
if suffix == ".docx":
|
| 1097 |
+
parsed = _docx_preview(blob)
|
| 1098 |
+
elif suffix == ".xlsx":
|
| 1099 |
+
parsed = _xlsx_preview(blob)
|
| 1100 |
+
elif suffix == ".pptx":
|
| 1101 |
+
parsed = _pptx_preview(blob)
|
| 1102 |
+
elif suffix == ".pdf":
|
| 1103 |
+
parsed = _pdf_preview(blob)
|
| 1104 |
+
elif suffix == ".csv":
|
| 1105 |
+
parsed = _table_preview(blob.decode("utf-8", "replace"))
|
| 1106 |
+
elif suffix == ".md":
|
| 1107 |
+
parsed = _markdown_preview(blob.decode("utf-8", "replace"))
|
| 1108 |
+
elif suffix in _TEXT_SUFFIXES:
|
| 1109 |
+
text = blob.decode("utf-8", "replace").strip()
|
| 1110 |
+
parsed = {"kind": "text", "text": text[:1400]} if text else None
|
| 1111 |
+
record: dict[str, object] = {
|
| 1112 |
+
"name": path.name,
|
| 1113 |
+
"size": size,
|
| 1114 |
+
"kind": "file",
|
| 1115 |
+
}
|
| 1116 |
+
if parsed:
|
| 1117 |
+
record.update(parsed)
|
| 1118 |
+
records.append(record)
|
| 1119 |
+
return records
|
| 1120 |
+
|
| 1121 |
+
|
| 1122 |
+
def _human_size(size: object) -> str:
|
| 1123 |
+
try:
|
| 1124 |
+
value = float(size) # type: ignore[arg-type]
|
| 1125 |
+
except (TypeError, ValueError):
|
| 1126 |
+
return ""
|
| 1127 |
+
if value >= 1_048_576:
|
| 1128 |
+
return f"{value / 1_048_576:.1f} MB"
|
| 1129 |
+
if value >= 1024:
|
| 1130 |
+
return f"{value / 1024:.1f} KB"
|
| 1131 |
+
return f"{int(value)} B"
|
| 1132 |
+
|
| 1133 |
+
|
| 1134 |
+
_MADE_KIND_WORDS = {
|
| 1135 |
+
"doc": "document",
|
| 1136 |
+
"sheet": "spreadsheet",
|
| 1137 |
+
"deck": "slides",
|
| 1138 |
+
"text": "text",
|
| 1139 |
+
"file": "file",
|
| 1140 |
+
}
|
| 1141 |
+
|
| 1142 |
+
|
| 1143 |
+
def made_things(previews: Sequence[Mapping[str, object]]) -> str:
|
| 1144 |
+
"""The artifacts a run produced, rendered as the things they are.
|
| 1145 |
+
|
| 1146 |
+
Structure is fixed here; every string is escaped; a record whose kind is
|
| 1147 |
+
unknown renders as a plain file card. The block sits inside the answer,
|
| 1148 |
+
after the model's words, because "make me a PDF" is answered by the PDF.
|
| 1149 |
+
"""
|
| 1150 |
+
|
| 1151 |
+
if not previews:
|
| 1152 |
+
return ""
|
| 1153 |
+
cards: list[str] = []
|
| 1154 |
+
for record in previews:
|
| 1155 |
+
if not isinstance(record, Mapping):
|
| 1156 |
+
continue
|
| 1157 |
+
name = esc(str(record.get("name") or "file"))
|
| 1158 |
+
kind = str(record.get("kind") or "file")
|
| 1159 |
+
kind_word = _MADE_KIND_WORDS.get(kind, "file")
|
| 1160 |
+
body = ""
|
| 1161 |
+
if kind == "doc":
|
| 1162 |
+
title = esc(str(record.get("title") or ""))
|
| 1163 |
+
paras = "".join(
|
| 1164 |
+
f"<p>{esc(str(para))}</p>" for para in record.get("paras") or ()
|
| 1165 |
+
if isinstance(para, str)
|
| 1166 |
+
)
|
| 1167 |
+
body = f"<h4>{title}</h4>{paras}" if title else paras
|
| 1168 |
+
elif kind == "sheet":
|
| 1169 |
+
rows = [row for row in record.get("rows") or () if isinstance(row, (list, tuple))]
|
| 1170 |
+
if rows:
|
| 1171 |
+
head = "".join(f"<th>{esc(str(cell))}</th>" for cell in rows[0])
|
| 1172 |
+
rest = "".join(
|
| 1173 |
+
"<tr>" + "".join(f"<td>{esc(str(cell))}</td>" for cell in row) + "</tr>"
|
| 1174 |
+
for row in rows[1:]
|
| 1175 |
+
)
|
| 1176 |
+
body = f'<table class="c-madegrid"><tr>{head}</tr>{rest}</table>'
|
| 1177 |
+
elif kind == "deck":
|
| 1178 |
+
slides = [
|
| 1179 |
+
slide for slide in record.get("slides") or () if isinstance(slide, Mapping)
|
| 1180 |
+
]
|
| 1181 |
+
body = '<div class="c-madeslides">' + "".join(
|
| 1182 |
+
f'<div class="c-madeslide"><span class="c-madeslide__no">{index}</span>'
|
| 1183 |
+
f'<span class="c-madeslide__title">{esc(str(slide.get("title") or ""))}</span>'
|
| 1184 |
+
'<span class="c-madeslide__line"></span><span class="c-madeslide__line"></span>'
|
| 1185 |
+
"</div>"
|
| 1186 |
+
for index, slide in enumerate(slides, start=1)
|
| 1187 |
+
) + "</div>"
|
| 1188 |
+
elif kind == "text":
|
| 1189 |
+
body = f"<pre>{esc(str(record.get('text') or ''))}</pre>"
|
| 1190 |
+
note = str(record.get("note") or "")
|
| 1191 |
+
size = _human_size(record.get("size"))
|
| 1192 |
+
foot_parts = [part for part in (note, size, "in Outputs, left panel") if part]
|
| 1193 |
+
modifier = kind if kind in ("doc", "sheet", "deck", "text") else "file"
|
| 1194 |
+
cards.append(
|
| 1195 |
+
f'<figure class="c-madecard c-made--{modifier}">'
|
| 1196 |
+
'<div class="c-madecard__bar">'
|
| 1197 |
+
'<span class="c-madecard__dot" aria-hidden="true"></span>'
|
| 1198 |
+
f'<span class="c-madecard__name">{name}</span>'
|
| 1199 |
+
f'<span class="c-madecard__kind">{esc(kind_word)}</span>'
|
| 1200 |
+
"</div>"
|
| 1201 |
+
+ (f'<div class="c-madecard__body">{body}</div>' if body else "")
|
| 1202 |
+
+ f'<figcaption class="c-made__foot">{esc(" · ".join(foot_parts))}</figcaption>'
|
| 1203 |
+
"</figure>"
|
| 1204 |
+
)
|
| 1205 |
+
if not cards:
|
| 1206 |
+
return ""
|
| 1207 |
+
return '<div class="c-made">' + "".join(cards) + "</div>"
|
| 1208 |
+
|
| 1209 |
+
|
| 1210 |
def run_steps(steps: Sequence[Mapping[str, object]]) -> str:
|
| 1211 |
"""The agent's turns, in order, kept after the run that took them.
|
| 1212 |
|
|
|
|
| 1253 |
|
| 1254 |
#: The wash each conversation state gets in the rail. Faint on purpose: see
|
| 1255 |
#: the note in presentation.py. A state with no entry gets no wash, which is
|
| 1256 |
+
#: how "idle" and "completed" are drawn. Warm washes over the ivory canvas:
|
| 1257 |
+
#: the only saturated green on the page stays the accent.
|
| 1258 |
CONVERSATION_TONES = {
|
| 1259 |
+
"waiting": "#F7F1E1",
|
| 1260 |
+
"generating": "#E8F0EA",
|
| 1261 |
+
"failed": "#F7ECE7",
|
| 1262 |
}
|
| 1263 |
|
| 1264 |
|
|
|
|
| 1548 |
_DEMO_BASE = f"/gradio_api/file={_DEMO_DIR.as_posix()}"
|
| 1549 |
|
| 1550 |
|
| 1551 |
+
def _demo_media(ref: str) -> tuple[str, str]:
|
| 1552 |
+
"""``(poster, gif)`` URLs for a member's demonstration, either may be empty.
|
| 1553 |
|
| 1554 |
+
Both are looked for on disk at render time so a card never promises a
|
| 1555 |
demonstration the repository does not carry. Slug: the ref with ``@`` and
|
| 1556 |
``.`` flattened, which is how the recorder names them.
|
| 1557 |
+
|
| 1558 |
+
The poster is the recording's last frame — the artifact the run produced —
|
| 1559 |
+
so a card at rest already shows what the member makes. That matters most
|
| 1560 |
+
on a phone, where there is no hover and the GIF is a deliberate act.
|
| 1561 |
"""
|
| 1562 |
|
| 1563 |
slug = ref.replace("@", "-").replace(".", "-")
|
| 1564 |
+
poster = f"{_DEMO_BASE}/{slug}.webp" if (_DEMO_DIR / f"{slug}.webp").is_file() else ""
|
| 1565 |
+
gif = f"{_DEMO_BASE}/{slug}.gif" if (_DEMO_DIR / f"{slug}.gif").is_file() else ""
|
| 1566 |
+
return poster, gif
|
| 1567 |
+
|
| 1568 |
+
|
| 1569 |
+
def _demo_gif(ref: str) -> str:
|
| 1570 |
+
"""The demo GIF's URL for a library member, or nothing."""
|
| 1571 |
+
|
| 1572 |
+
return _demo_media(ref)[1]
|
| 1573 |
|
| 1574 |
|
| 1575 |
def library_cards(rows: Sequence[Mapping[str, object]], chosen: Sequence[str]) -> str:
|
|
|
|
| 1595 |
name = str(row.get("name", ref))
|
| 1596 |
author = str(row.get("author", "distinct"))
|
| 1597 |
description = str(row.get("description", ""))
|
| 1598 |
+
poster, gif = _demo_media(ref)
|
| 1599 |
+
media = ""
|
| 1600 |
+
if poster or gif:
|
| 1601 |
+
still = (
|
| 1602 |
+
f'<img class="c-libcard__poster" src="{esc(poster)}" alt="" loading="lazy">'
|
| 1603 |
+
if poster
|
| 1604 |
+
else ""
|
| 1605 |
+
)
|
| 1606 |
+
media = (
|
| 1607 |
+
f'<figure class="c-libcard__media" data-gif="{esc(gif)}">'
|
| 1608 |
+
f"{still}"
|
| 1609 |
+
'<span class="c-libcard__play">watch it work</span>'
|
| 1610 |
+
'<figcaption class="c-visually-hidden">'
|
| 1611 |
+
"Hover, or press and hold, to play this member's demonstration"
|
| 1612 |
+
"</figcaption>"
|
| 1613 |
+
"</figure>"
|
| 1614 |
+
)
|
| 1615 |
+
on = ref in picked
|
| 1616 |
+
# The card itself is the control: role, state and keyboard focus are
|
| 1617 |
+
# its own, and the check mark is drawn by the stylesheet from the
|
| 1618 |
+
# ``is-on`` class so the page script and this renderer cannot
|
| 1619 |
+
# disagree about what selected looks like.
|
| 1620 |
cards.append(
|
| 1621 |
+
f'<article class="c-libcard c-libcard--{esc(kind)}{" is-on" if on else ""}"'
|
| 1622 |
+
f' data-ref="{esc(ref)}" role="button" tabindex="0"'
|
| 1623 |
+
f' aria-pressed="{"true" if on else "false"}"'
|
| 1624 |
+
f' aria-label="{esc(name)}: use as a default">'
|
| 1625 |
+
f'<span class="c-libcard__check" aria-hidden="true"></span>'
|
| 1626 |
f"{media}"
|
| 1627 |
'<div class="c-libcard__head">'
|
| 1628 |
f'<span class="c-libcard__kind c-libcard__kind--{esc(kind)}">{esc(kind)}</span>'
|
|
|
|
| 1629 |
"</div>"
|
| 1630 |
f'<h3 class="c-libcard__name">{esc(name)}</h3>'
|
| 1631 |
f'<p class="c-libcard__author">by {esc(author)}</p>'
|
|
|
|
| 1887 |
#: reader who conflates them draws exactly the wrong conclusion, so each token
|
| 1888 |
#: carries its own scale name inside it rather than relying on a column header
|
| 1889 |
#: that may be scrolled away, screenshotted off, or read past.
|
| 1890 |
+
#: Method words this surface knows, and the modifier each one paints with.
|
| 1891 |
+
#: A word outside this map is rendered verbatim but styled as unknown rather
|
| 1892 |
+
#: than silently promoted into one of the confident states.
|
| 1893 |
+
_METHOD_SLUGS: Mapping[str, str] = {
|
| 1894 |
+
"Measured": "measured",
|
| 1895 |
+
"Modelled": "modelled",
|
| 1896 |
+
"Proxy-based": "proxy",
|
| 1897 |
}
|
| 1898 |
|
| 1899 |
|
| 1900 |
+
def figure_token(
|
|
|
|
| 1901 |
*,
|
| 1902 |
+
value: str = "",
|
| 1903 |
+
unit: str = "",
|
| 1904 |
+
status: str = "",
|
| 1905 |
+
absent_word: str = "Missing",
|
| 1906 |
) -> str:
|
| 1907 |
+
"""One published figure, or one explicit absence, as one indivisible unit.
|
| 1908 |
|
| 1909 |
+
This replaces the letter grade that used to sit here, and the replacement is
|
| 1910 |
+
the point rather than a restyling. A letter was this catalogue's ranking of
|
| 1911 |
+
somebody else's number; a figure is the number. Three rules survive from the
|
| 1912 |
+
grade token because they were never about letters:
|
| 1913 |
|
| 1914 |
+
**An absence is never a low value.** Missing is a dashed lozenge carrying a
|
| 1915 |
+
word, differing from a figure in shape, fill and content. Nobody measured it,
|
| 1916 |
+
so nothing may be drawn that looks like a small result.
|
|
|
|
| 1917 |
|
| 1918 |
+
**A figure never appears without its method.** "54 MWh" measured at the
|
| 1919 |
+
socket and "54 MWh" inferred from a chip's rated wattage are different
|
| 1920 |
+
claims, and a method printed as a caption beside the number can be cropped,
|
| 1921 |
+
skimmed, or read as belonging to the next row. One token, one border.
|
|
|
|
| 1922 |
|
| 1923 |
+
**Nothing is computed here.** Value, unit and method are passed straight
|
| 1924 |
+
through. There is no code path that could derive one from the others.
|
|
|
|
| 1925 |
"""
|
| 1926 |
|
| 1927 |
+
text = str(value).strip()
|
| 1928 |
+
if not text:
|
| 1929 |
+
word = esc(str(absent_word).strip() or "Missing")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1930 |
return (
|
| 1931 |
+
'<span class="c-fig c-fig--none">'
|
| 1932 |
+
f'<span class="c-fig__word">{word}</span></span>'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1933 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1934 |
|
| 1935 |
+
method = str(status).strip()
|
| 1936 |
+
slug = _METHOD_SLUGS.get(method, "unknown")
|
| 1937 |
+
shown = f"{text} {unit}".strip() if str(unit).strip() else text
|
| 1938 |
return (
|
| 1939 |
+
f'<span class="c-fig c-fig--{esc(slug)}">'
|
| 1940 |
+
f'<span class="c-fig__value">{esc(shown)}</span>'
|
| 1941 |
+
f'<span class="c-fig__method">{esc(method or "method not stated")}</span>'
|
| 1942 |
+
"</span>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1943 |
)
|
| 1944 |
|
| 1945 |
|
| 1946 |
+
def _source_row(entry: Mapping[str, object]) -> str:
|
| 1947 |
+
"""One area's working: what the note says, and where the number came from."""
|
| 1948 |
|
| 1949 |
+
label = esc(str(entry.get("label") or ""))
|
| 1950 |
+
note = str(entry.get("note") or "")
|
| 1951 |
+
href = _safe_url(entry.get("source_url"))
|
| 1952 |
+
cite = (
|
| 1953 |
+
f'<a class="c-source__link" href="{esc(href)}" target="_blank" '
|
| 1954 |
+
'rel="noopener noreferrer">primary source</a>'
|
| 1955 |
+
if href
|
| 1956 |
+
else ""
|
| 1957 |
+
)
|
| 1958 |
+
body = esc(note) if note else "No note recorded."
|
| 1959 |
+
return (
|
| 1960 |
+
'<p class="c-source"><span class="c-source__label">'
|
| 1961 |
+
f"{label}</span><span class=\"c-source__body\">{body} {cite}</span></p>"
|
| 1962 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1963 |
|
| 1964 |
|
| 1965 |
+
def model_evidence_card(
|
| 1966 |
*,
|
| 1967 |
name: str,
|
| 1968 |
+
coverage: str = "",
|
| 1969 |
+
summary: str = "",
|
| 1970 |
+
covers: str = "",
|
| 1971 |
+
categories: Sequence[Mapping[str, object]] = (),
|
| 1972 |
+
links: Sequence[Mapping[str, str]] = (),
|
|
|
|
|
|
|
|
|
|
| 1973 |
note: str = "",
|
|
|
|
| 1974 |
) -> str:
|
| 1975 |
+
"""One model release, showing what was published about it and nothing else.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1976 |
|
| 1977 |
+
Every area is always present. An area with no published result renders the
|
| 1978 |
+
word rather than being dropped, because a six-row card missing three rows
|
| 1979 |
+
reads as a model with three areas rather than a model with three unknowns.
|
|
|
|
|
|
|
|
|
|
| 1980 |
|
| 1981 |
+
The workings sit behind a disclosure rather than on the face of the card:
|
| 1982 |
+
six notes and six citations inline would bury the figures, and hiding them
|
| 1983 |
+
entirely would make the figures unverifiable. Complete, one click away.
|
| 1984 |
+
"""
|
|
|
|
|
|
|
| 1985 |
|
| 1986 |
rows = "".join(
|
| 1987 |
+
'<p class="c-grade-row">'
|
| 1988 |
+
f'<span class="c-grade-row__label">{esc(str(entry.get("label") or ""))}</span>'
|
| 1989 |
+
+ figure_token(
|
| 1990 |
+
value=str(entry.get("value") or ""),
|
| 1991 |
+
unit=str(entry.get("unit") or ""),
|
| 1992 |
+
status=str(entry.get("status") or ""),
|
| 1993 |
+
)
|
| 1994 |
+
+ "</p>"
|
| 1995 |
for entry in categories
|
| 1996 |
)
|
| 1997 |
|
| 1998 |
+
link_html = "".join(
|
|
|
|
| 1999 |
f'<a class="c-grade-card__link" href="{esc(href)}" target="_blank" '
|
| 2000 |
+
f'rel="noopener noreferrer">{esc(str(link.get("label") or "Source"))}</a>'
|
| 2001 |
+
for link in links
|
| 2002 |
+
if (href := _safe_url(link.get("url")))
|
| 2003 |
)
|
|
|
|
| 2004 |
|
| 2005 |
+
sources = "".join(_source_row(entry) for entry in categories)
|
| 2006 |
+
workings = (
|
| 2007 |
+
"<details class=\"c-sources\"><summary class=\"c-sources__summary\">"
|
| 2008 |
+
"Where these figures come from</summary>"
|
| 2009 |
+
f'<div class="c-sources__body">{sources}</div></details>'
|
| 2010 |
+
if sources
|
| 2011 |
else ""
|
| 2012 |
)
|
| 2013 |
+
|
| 2014 |
+
head_coverage = (
|
| 2015 |
+
f'<span class="c-grade-card__coverage">{esc(coverage)}</span>' if coverage else ""
|
| 2016 |
+
)
|
| 2017 |
return (
|
| 2018 |
'<article class="c-grade-card">'
|
| 2019 |
'<p class="c-grade-card__head">'
|
| 2020 |
+
f'<span class="c-grade-card__name">{esc(name)}</span>{head_coverage}</p>'
|
| 2021 |
+
+ (f'<p class="c-grade-card__summary">{esc(summary)}</p>' if summary else "")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2022 |
+ (f'<div class="c-grade-rows">{rows}</div>' if rows else "")
|
| 2023 |
+
+ (f'<p class="c-grade-card__covers"><strong>Covers.</strong> {esc(covers)}</p>' if covers else "")
|
| 2024 |
+
+ workings
|
| 2025 |
+
+ (f'<p class="c-grade-card__note">{esc(note)}</p>' if note else "")
|
| 2026 |
+
+ (f'<p class="c-grade-card__links">{link_html}</p>' if link_html else "")
|
| 2027 |
+ "</article>"
|
| 2028 |
)
|
| 2029 |
|
| 2030 |
|
| 2031 |
+
def assessment_legend() -> str:
|
| 2032 |
+
"""What the words mean, and the two readings this surface has to prevent.
|
| 2033 |
+
|
| 2034 |
+
The legend used to explain two letter scales and the case where they
|
| 2035 |
+
disagree. There are no letters now, so it explains the two things a reader
|
| 2036 |
+
can still get wrong: that Missing is a result, and that a small number is
|
| 2037 |
+
a good model.
|
| 2038 |
+
"""
|
| 2039 |
+
|
| 2040 |
+
return (
|
| 2041 |
+
'<section class="c-legend">'
|
| 2042 |
+
'<p class="c-legend__title">How to read these</p>'
|
| 2043 |
+
'<div class="c-legend__pair">'
|
| 2044 |
+
'<div class="c-legend__scale">'
|
| 2045 |
+
+ figure_token(value="54", unit="MWh", status="Measured")
|
| 2046 |
+
+ '<p class="c-legend__scale-body"><strong>A figure and its method.</strong> '
|
| 2047 |
+
"Measured means somebody metered the hardware. Modelled means they computed it "
|
| 2048 |
+
"from something they did meter, or from rated specifications. The number is "
|
| 2049 |
+
"reproduced exactly as published; nothing here is converted, scaled or combined."
|
| 2050 |
+
"</p>"
|
| 2051 |
+
"</div>"
|
| 2052 |
+
'<div class="c-legend__scale">'
|
| 2053 |
+
+ figure_token()
|
| 2054 |
+
+ '<p class="c-legend__scale-body"><strong>Missing is not zero.</strong> '
|
| 2055 |
+
"It means nobody published a usable result for that area. It is not a low score, "
|
| 2056 |
+
"not a failure, and not evidence that the impact was small. Every area is shown "
|
| 2057 |
+
"for every model so an absence has to be stated rather than quietly omitted.</p>"
|
| 2058 |
+
"</div>"
|
| 2059 |
+
"</div>"
|
| 2060 |
+
'<p class="c-legend__example"><span class="c-legend__example-mark" '
|
| 2061 |
+
'aria-hidden="true">?</span><span><strong>A smaller number is not automatically '
|
| 2062 |
+
"a better model.</strong> One OLMo 7B shows zero carbon and zero water because it "
|
| 2063 |
+
"trained on hydroelectric power in Finland, while still drawing more electricity "
|
| 2064 |
+
"than any other 7B in its cohort. Another drank four times the water of its sibling "
|
| 2065 |
+
"for no reason except which state the data centre stood in. Read the figure with "
|
| 2066 |
+
"the area beside it, and read both with where the run happened."
|
| 2067 |
+
"</span></p>"
|
| 2068 |
+
'<p class="c-legend__never">Cradle to release. Never added to, and never compared '
|
| 2069 |
+
"with, the use-phase energy this network measures per run.</p>"
|
| 2070 |
+
"</section>"
|
| 2071 |
+
)
|
| 2072 |
+
|
| 2073 |
+
|
| 2074 |
+
def assessment_section(
|
| 2075 |
+
cards: Iterable[str],
|
| 2076 |
+
*,
|
| 2077 |
+
warning: str = "",
|
| 2078 |
+
further_reading: Sequence[Mapping[str, str]] = (),
|
| 2079 |
+
) -> str:
|
| 2080 |
+
"""The legend, the assessment set's own caveat, the cards, and the reading.
|
| 2081 |
|
| 2082 |
+
``warning`` is the data file's caveat and renders **before** the figures, as
|
| 2083 |
+
its display contract requires, never in a footnote.
|
| 2084 |
"""
|
| 2085 |
|
| 2086 |
body = "".join(cards)
|
| 2087 |
if not body:
|
| 2088 |
body = empty_state(
|
| 2089 |
+
glyph="\u25cb",
|
| 2090 |
title="No assessed releases",
|
| 2091 |
body=(
|
| 2092 |
"No model in this catalogue has a published, model-specific assessment "
|
| 2093 |
+
"recorded here yet. Nothing is shown until one exists."
|
| 2094 |
),
|
| 2095 |
)
|
| 2096 |
+
caution = f'<p class="c-rubric__warning">{esc(warning)}</p>' if warning else ""
|
| 2097 |
+
reading = "".join(
|
| 2098 |
+
f'<a class="c-reading__link" href="{esc(href)}" target="_blank" '
|
| 2099 |
+
f'rel="noopener noreferrer">{esc(str(item.get("label") or "Source"))}</a>'
|
| 2100 |
+
for item in further_reading
|
| 2101 |
+
if (href := _safe_url(item.get("url")))
|
| 2102 |
+
)
|
| 2103 |
+
tail = (
|
| 2104 |
+
'<section class="c-reading"><p class="c-reading__title">Further reading</p>'
|
| 2105 |
+
f'<p class="c-reading__links">{reading}</p></section>'
|
| 2106 |
+
if reading
|
| 2107 |
+
else ""
|
| 2108 |
)
|
| 2109 |
return (
|
| 2110 |
'<div class="c-rubric">'
|
| 2111 |
+
+ assessment_legend()
|
| 2112 |
+ caution
|
| 2113 |
+ f'<div class="c-grade-cards">{body}</div>'
|
| 2114 |
+
+ tail
|
| 2115 |
+ "</div>"
|
| 2116 |
)
|
| 2117 |
|
distinct_server/ui.py
CHANGED
|
@@ -50,6 +50,7 @@ from .catalog import (
|
|
| 50 |
RELEASE_BOUNDARY,
|
| 51 |
RUBRIC_AREAS,
|
| 52 |
USE_PHASE_BOUNDARY,
|
|
|
|
| 53 |
model_choices,
|
| 54 |
)
|
| 55 |
from .control_plane import ControlPlane
|
|
@@ -891,30 +892,31 @@ def _tool_line(spec_tools: Sequence[ToolSelection], calls_reported: Optional[int
|
|
| 891 |
|
| 892 |
|
| 893 |
def _catalogue_markdown() -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 894 |
lines = [
|
| 895 |
"#### Release assessment · cradle to release",
|
| 896 |
"",
|
| 897 |
f"_{RELEASE_BOUNDARY}_",
|
| 898 |
"",
|
| 899 |
-
"
|
| 900 |
-
"
|
| 901 |
-
"
|
|
|
|
|
|
|
|
|
|
| 902 |
"",
|
| 903 |
-
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
f"{AREA_LABELS[area]}: {assessment.areas[area].display}" for area in RUBRIC_AREAS
|
| 908 |
-
)
|
| 909 |
-
lines.append(
|
| 910 |
-
f"- **{manifest.label}** — evidence: {assessment.grade_display} — "
|
| 911 |
-
f"weights identity: {manifest.identity_status} — hardware requirement: "
|
| 912 |
-
f"{manifest.min_ram_gb:g} GB RAM"
|
| 913 |
-
)
|
| 914 |
-
lines.append(f" <br>{areas}")
|
| 915 |
-
if assessment.reason:
|
| 916 |
-
lines.append(f" <br>_{assessment.reason}_")
|
| 917 |
-
lines += [
|
| 918 |
"",
|
| 919 |
"#### Use-phase energy · per run",
|
| 920 |
"",
|
|
@@ -923,7 +925,7 @@ def _catalogue_markdown() -> str:
|
|
| 923 |
"Shown on each completed run and totalled per conversation, partitioned by "
|
| 924 |
"measurement scope. It is never added to a release figure, and never converted "
|
| 925 |
"into CO2e, water, land, materials or pollution — those conversions would be "
|
| 926 |
-
"assessor-created estimates, which
|
| 927 |
"",
|
| 928 |
"Minimum RAM is a disclosed hardware requirement of the file, not an "
|
| 929 |
"environmental result. This catalogue deliberately carries no model-size or "
|
|
@@ -932,29 +934,13 @@ def _catalogue_markdown() -> str:
|
|
| 932 |
return "\n".join(lines)
|
| 933 |
|
| 934 |
|
| 935 |
-
#: Where the catalogue
|
| 936 |
-
#:
|
| 937 |
-
#:
|
| 938 |
-
#:
|
| 939 |
-
#: anyway.
|
| 940 |
ASSESSMENTS_PATH = Path(__file__).resolve().parent.parent / "model_assessments.json"
|
| 941 |
|
| 942 |
|
| 943 |
-
def _letter(value: Any) -> Optional[str]:
|
| 944 |
-
"""A single grade letter, or ``None``. Never a substitute for one.
|
| 945 |
-
|
| 946 |
-
Anything that is not a plausible letter becomes ``None`` and renders as an
|
| 947 |
-
explicit absence. That direction is deliberate and one-way: a malformed
|
| 948 |
-
record must be able to degrade into "not assessed", and must never be able
|
| 949 |
-
to acquire a letter it was not given.
|
| 950 |
-
"""
|
| 951 |
-
|
| 952 |
-
if value is None:
|
| 953 |
-
return None
|
| 954 |
-
text = str(value).strip().upper()
|
| 955 |
-
return text if text in {"A", "B", "C", "D", "E", "F"} else None
|
| 956 |
-
|
| 957 |
-
|
| 958 |
def _rubric_display() -> Mapping[str, Any]:
|
| 959 |
"""The assessment file's ``website_display`` block, or an empty mapping.
|
| 960 |
|
|
@@ -978,71 +964,105 @@ def _rubric_warning() -> str:
|
|
| 978 |
return warning if isinstance(warning, str) else ""
|
| 979 |
|
| 980 |
|
| 981 |
-
def
|
| 982 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 983 |
|
| 984 |
-
|
| 985 |
-
|
| 986 |
-
|
| 987 |
-
|
| 988 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 989 |
"""
|
| 990 |
|
| 991 |
-
overall = record.get("overall") if isinstance(record.get("overall"), Mapping) else {}
|
| 992 |
-
evidence = record.get("evidence") if isinstance(record.get("evidence"), Mapping) else {}
|
| 993 |
categories = record.get("categories")
|
|
|
|
| 994 |
rows: list[Mapping[str, Any]] = []
|
| 995 |
-
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
|
| 1009 |
-
|
| 1010 |
-
|
| 1011 |
-
|
| 1012 |
-
|
| 1013 |
-
|
| 1014 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1015 |
name=str(record.get("name") or record.get("model_id") or "unnamed"),
|
| 1016 |
-
|
| 1017 |
-
|
| 1018 |
-
|
| 1019 |
-
|
| 1020 |
-
|
| 1021 |
-
|
| 1022 |
-
|
| 1023 |
-
|
| 1024 |
-
|
| 1025 |
-
|
| 1026 |
)
|
| 1027 |
|
| 1028 |
|
| 1029 |
-
#: The model selected when a session opens.
|
| 1030 |
-
|
|
|
|
| 1031 |
|
| 1032 |
|
| 1033 |
def _assessment_by_model_id() -> Mapping[str, Mapping[str, Any]]:
|
| 1034 |
-
"""``website_display.models`` keyed by
|
| 1035 |
|
| 1036 |
Deliberately no fuzzy matching, and no alias table invented here. The
|
| 1037 |
-
assessment records name releases ("OLMo 2 7B", "
|
| 1038 |
-
names specific quantised checkpoints ("OLMo 2
|
| 1039 |
-
Those are not the same object, and a
|
| 1040 |
-
|
| 1041 |
-
guessing which
|
| 1042 |
-
|
| 1043 |
-
So a catalogue entry gets
|
| 1044 |
-
|
| 1045 |
-
change to the assessment data, which is where the evidence
|
|
|
|
| 1046 |
"""
|
| 1047 |
|
| 1048 |
records = _rubric_display().get("models")
|
|
@@ -1055,40 +1075,42 @@ def _assessment_by_model_id() -> Mapping[str, Mapping[str, Any]]:
|
|
| 1055 |
}
|
| 1056 |
|
| 1057 |
|
| 1058 |
-
#: Which assessment record covers which catalogue entry, and what it
|
| 1059 |
-
#:
|
| 1060 |
-
#: The rubric's two scales behave differently under this mapping, and the
|
| 1061 |
-
#: difference is the whole reason the table exists rather than a fuzzy match.
|
| 1062 |
#:
|
| 1063 |
-
#:
|
| 1064 |
-
#:
|
| 1065 |
-
#:
|
| 1066 |
-
#:
|
| 1067 |
-
#:
|
| 1068 |
-
#:
|
| 1069 |
-
#: it is the brief's own rule: evidence can always exist, because silence is
|
| 1070 |
-
#: assessable.
|
| 1071 |
#:
|
| 1072 |
-
#:
|
| 1073 |
-
#:
|
| 1074 |
-
#:
|
| 1075 |
-
#:
|
| 1076 |
-
|
| 1077 |
-
|
| 1078 |
-
|
| 1079 |
-
|
| 1080 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1081 |
},
|
| 1082 |
-
"
|
| 1083 |
-
|
| 1084 |
-
"
|
| 1085 |
-
|
| 1086 |
-
|
|
|
|
| 1087 |
},
|
| 1088 |
-
"
|
| 1089 |
-
"record": "
|
| 1090 |
-
"
|
| 1091 |
-
|
|
|
|
|
|
|
| 1092 |
},
|
| 1093 |
}
|
| 1094 |
|
|
@@ -1096,99 +1118,84 @@ RUBRIC_ASSIGNMENT: Mapping[str, Mapping[str, Any]] = {
|
|
| 1096 |
def _assignment(model_id: str) -> tuple[Mapping[str, Any] | None, Mapping[str, Any]]:
|
| 1097 |
"""``(assessment record, assignment rules)`` for one catalogue model."""
|
| 1098 |
|
| 1099 |
-
rules =
|
| 1100 |
if rules is None:
|
| 1101 |
return None, {}
|
| 1102 |
return _assessment_by_model_id().get(str(rules["record"])), rules
|
| 1103 |
|
| 1104 |
|
| 1105 |
-
def
|
| 1106 |
-
"""The
|
| 1107 |
|
| 1108 |
-
|
| 1109 |
-
|
| 1110 |
-
|
| 1111 |
-
|
| 1112 |
"""
|
| 1113 |
|
| 1114 |
-
record,
|
| 1115 |
if record is None:
|
| 1116 |
-
|
| 1117 |
-
|
| 1118 |
-
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
-
|
| 1122 |
-
|
| 1123 |
-
|
| 1124 |
-
|
| 1125 |
-
|
| 1126 |
-
|
| 1127 |
-
|
| 1128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1129 |
else:
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
evidence_part = (
|
| 1133 |
-
f"evidence {evidence_letter}" if evidence_letter else "evidence not assessed"
|
| 1134 |
-
)
|
| 1135 |
-
# Evidence first, because the chooser is 280px wide and the operating
|
| 1136 |
-
# system truncates from the right. With impact leading, every option in
|
| 1137 |
-
# the list read "Qwen3 0.6B · unsloth · impact with..." and the grade this
|
| 1138 |
-
# product exists to show was the part that fell off the end. The order is
|
| 1139 |
-
# a presentation decision about which fact survives a narrow control, not
|
| 1140 |
-
# a claim that one grade outranks the other; both are still here, and the
|
| 1141 |
-
# rubric panel still shows them in full.
|
| 1142 |
-
return " · ".join((evidence_part, impact))
|
| 1143 |
|
| 1144 |
|
| 1145 |
def _short_label(label: str) -> str:
|
| 1146 |
"""The model's name, without the packager that follows it.
|
| 1147 |
|
| 1148 |
-
``model_choices`` yields "
|
| 1149 |
-
separator is the model, and that is what a chooser
|
|
|
|
| 1150 |
"""
|
| 1151 |
|
| 1152 |
return label.split(" · ", 1)[0].strip() or label
|
| 1153 |
|
| 1154 |
|
| 1155 |
-
def
|
| 1156 |
-
"""Model options carrying
|
| 1157 |
|
| 1158 |
-
|
| 1159 |
-
|
| 1160 |
-
|
| 1161 |
-
|
| 1162 |
"""
|
| 1163 |
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
# digest is checked against. In a 280px control it was 9 characters that
|
| 1167 |
-
# pushed the grade out of view.
|
| 1168 |
-
offered = [
|
| 1169 |
-
(f"{_short_label(label)} · {_grade_suffix(model_id)}", model_id)
|
| 1170 |
-
for label, model_id in model_choices()
|
| 1171 |
-
if model_id in RUBRIC_ASSIGNMENT
|
| 1172 |
-
]
|
| 1173 |
-
# A model with no assessment is not offered for selection. That is a
|
| 1174 |
-
# stronger rule than it looks: this product's only claim is about measured
|
| 1175 |
-
# and disclosed environmental cost, so a model nobody can say anything
|
| 1176 |
-
# about is a model it has no business recommending. Such entries stay in
|
| 1177 |
-
# the catalogue, where the rubric panel names them and says what is
|
| 1178 |
-
# missing, rather than disappearing.
|
| 1179 |
-
return offered or [
|
| 1180 |
-
(f"{_short_label(label)} · {_grade_suffix(model_id)}", model_id)
|
| 1181 |
for label, model_id in model_choices()
|
| 1182 |
]
|
| 1183 |
|
| 1184 |
|
| 1185 |
-
def
|
| 1186 |
-
"""Build the
|
| 1187 |
|
| 1188 |
-
|
| 1189 |
-
|
| 1190 |
-
|
| 1191 |
-
scales are read as published or rendered as explicit absences.
|
| 1192 |
"""
|
| 1193 |
|
| 1194 |
display = _rubric_display()
|
|
@@ -1200,41 +1207,51 @@ def _rubric_cards() -> list[str]:
|
|
| 1200 |
for record in records:
|
| 1201 |
if isinstance(record, Mapping) and record.get("model_id"):
|
| 1202 |
by_id[str(record["model_id"])] = record
|
| 1203 |
-
|
| 1204 |
-
|
| 1205 |
-
|
| 1206 |
-
|
| 1207 |
-
|
| 1208 |
-
|
| 1209 |
-
|
| 1210 |
-
|
| 1211 |
-
|
| 1212 |
-
|
| 1213 |
-
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
|
|
|
|
|
|
|
| 1217 |
return cards
|
| 1218 |
|
| 1219 |
-
# Fallback: the assessments
|
| 1220 |
-
# "no data", so
|
| 1221 |
-
#
|
|
|
|
| 1222 |
for model_id, manifest in MODEL_CATALOG.items():
|
| 1223 |
assessment = RELEASE_ASSESSMENT[model_id]
|
| 1224 |
-
|
| 1225 |
-
|
| 1226 |
-
|
| 1227 |
-
|
| 1228 |
-
|
| 1229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1230 |
cards.append(
|
| 1231 |
-
render.
|
| 1232 |
name=manifest.label,
|
| 1233 |
-
|
| 1234 |
-
|
| 1235 |
-
|
| 1236 |
-
evidence=_letter(assessment.evidence_grade),
|
| 1237 |
categories=rows,
|
|
|
|
| 1238 |
note=assessment.reason,
|
| 1239 |
)
|
| 1240 |
)
|
|
@@ -1488,13 +1505,18 @@ class DistinctUI:
|
|
| 1488 |
def _library_page(
|
| 1489 |
self, query: str, defaults: Sequence[str]
|
| 1490 |
) -> tuple[Any, str, str]:
|
| 1491 |
-
"""The page a person picks their defaults on:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1492 |
|
| 1493 |
rows, matched = self._library_rows(query)
|
| 1494 |
total = len(_library_specs())
|
| 1495 |
-
choices = [
|
| 1496 |
-
(f"{row['name']} · {row['kind']}", row["ref"]) for row in rows
|
| 1497 |
-
]
|
| 1498 |
# Defaults outside the current filter are preserved rather than
|
| 1499 |
# dropped. Searching is a way of looking, not a way of deselecting,
|
| 1500 |
# and a search box that quietly unticked everything it hid would be
|
|
@@ -1525,16 +1547,19 @@ class DistinctUI:
|
|
| 1525 |
profile: "gr.OAuthProfile | None" = None,
|
| 1526 |
request: "gr.Request | None" = None,
|
| 1527 |
) -> tuple[Any, Any, str, str, Any, str]:
|
| 1528 |
-
"""Record the defaults
|
| 1529 |
-
|
| 1530 |
-
The
|
| 1531 |
-
|
| 1532 |
-
|
| 1533 |
-
|
| 1534 |
-
|
| 1535 |
-
|
|
|
|
|
|
|
| 1536 |
"""
|
| 1537 |
|
|
|
|
| 1538 |
rows, _ = self._library_rows(query)
|
| 1539 |
on_screen = {row["ref"] for row in rows}
|
| 1540 |
previous = set(_library_defaults(state))
|
|
@@ -1552,8 +1577,13 @@ class DistinctUI:
|
|
| 1552 |
defaults=_library_defaults(updated),
|
| 1553 |
viewer_id=viewer_id,
|
| 1554 |
)
|
| 1555 |
-
|
| 1556 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1557 |
|
| 1558 |
# Outputs ----------------------------------------------------------
|
| 1559 |
|
|
@@ -1866,7 +1896,9 @@ class DistinctUI:
|
|
| 1866 |
library, library_note = self._library_components(
|
| 1867 |
None, defaults=_library_defaults(updated), viewer_id=user_id
|
| 1868 |
)
|
| 1869 |
-
|
|
|
|
|
|
|
| 1870 |
return (
|
| 1871 |
updated,
|
| 1872 |
updated,
|
|
@@ -1882,10 +1914,10 @@ class DistinctUI:
|
|
| 1882 |
library_note,
|
| 1883 |
self._outputs_component(updated),
|
| 1884 |
activity,
|
| 1885 |
-
# The library page is filled on arrival rather than on first
|
| 1886 |
-
#
|
| 1887 |
-
# the moment the
|
| 1888 |
-
|
| 1889 |
page_summary,
|
| 1890 |
page_cards,
|
| 1891 |
)
|
|
@@ -2781,6 +2813,16 @@ class DistinctUI:
|
|
| 2781 |
state["session_id"], job_id, raw_artifacts
|
| 2782 |
)
|
| 2783 |
answer["artifacts"] = [Path(item).name for item in stored]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2784 |
updated = record_answer(updated, job_id=job_id, answer=answer)
|
| 2785 |
|
| 2786 |
if answer is not None:
|
|
@@ -2828,6 +2870,12 @@ class DistinctUI:
|
|
| 2828 |
_step_messages(answer.get("steps") or (), running=False)
|
| 2829 |
)
|
| 2830 |
messages.append({"role": "assistant", "content": str(answer.get("output", ""))})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2831 |
status_label = "completed"
|
| 2832 |
outcome = ""
|
| 2833 |
elif view is None:
|
|
@@ -3109,15 +3157,18 @@ class DistinctUI:
|
|
| 3109 |
# button below is the one sign-in control, so a header link
|
| 3110 |
# would only duplicate it.
|
| 3111 |
identity = gr.HTML(_identity_html(""))
|
| 3112 |
-
# The quick nav sits directly under the identity box
|
| 3113 |
-
#
|
| 3114 |
-
#
|
| 3115 |
-
|
| 3116 |
-
|
| 3117 |
-
|
| 3118 |
-
|
| 3119 |
-
|
| 3120 |
-
|
|
|
|
|
|
|
|
|
|
| 3121 |
|
| 3122 |
# THE SIGN-IN CONTROL, AND WHY IT IS CONDITIONAL.
|
| 3123 |
#
|
|
@@ -3200,7 +3251,7 @@ class DistinctUI:
|
|
| 3200 |
# the model.
|
| 3201 |
model = gr.Dropdown(
|
| 3202 |
label="Model",
|
| 3203 |
-
choices=
|
| 3204 |
value=DEFAULT_MODEL_ID,
|
| 3205 |
container=True,
|
| 3206 |
)
|
|
@@ -3455,57 +3506,91 @@ class DistinctUI:
|
|
| 3455 |
create_code = gr.Button("Generate pairing code")
|
| 3456 |
gr.Markdown()
|
| 3457 |
|
| 3458 |
-
|
| 3459 |
-
#
|
| 3460 |
-
# The composer's picker shows what the chosen worker is
|
| 3461 |
-
# actually offering, which is a handful. This page is the
|
| 3462 |
-
# whole library, which is meant to reach the hundreds, and
|
| 3463 |
-
# a list of hundreds is only usable through search. What a
|
| 3464 |
-
# person does here is choose their defaults once; those
|
| 3465 |
-
# are remembered in this browser and tick themselves on
|
| 3466 |
-
# every run where a worker offers them.
|
| 3467 |
-
with gr.Accordion(
|
| 3468 |
-
"Library", open=True, elem_id="library",
|
| 3469 |
-
elem_classes="c-library-section",
|
| 3470 |
-
):
|
| 3471 |
-
gr.Markdown(
|
| 3472 |
-
"Every tool and skill this server can offer, who wrote "
|
| 3473 |
-
"it, and what it does. Hover a card — or press and hold "
|
| 3474 |
-
"on a phone — to watch its demonstration. Tick the "
|
| 3475 |
-
"members you usually want below: they select themselves "
|
| 3476 |
-
"whenever a worker offers them, and any run can untick "
|
| 3477 |
-
"them without changing what is saved."
|
| 3478 |
-
)
|
| 3479 |
-
library_search = gr.Textbox(
|
| 3480 |
-
label="Search the library",
|
| 3481 |
-
show_label=False,
|
| 3482 |
-
placeholder="Search by name, reference or what it does…",
|
| 3483 |
-
container=False,
|
| 3484 |
-
elem_classes="c-librarysearch",
|
| 3485 |
-
)
|
| 3486 |
-
library_summary = gr.HTML(
|
| 3487 |
-
render.library_summary(shown=0, matched=0, total=0, chosen=0)
|
| 3488 |
-
)
|
| 3489 |
-
library_cards_html = gr.HTML(elem_classes="c-librarycards")
|
| 3490 |
-
gr.Markdown("**Your defaults**", elem_classes="c-librarydefaults-head")
|
| 3491 |
-
library_defaults = gr.CheckboxGroup(
|
| 3492 |
-
label="Your defaults",
|
| 3493 |
-
show_label=False,
|
| 3494 |
-
choices=[],
|
| 3495 |
-
value=[],
|
| 3496 |
-
elem_classes="c-librarypage",
|
| 3497 |
-
)
|
| 3498 |
-
|
| 3499 |
-
with gr.Accordion("Model grades and the rubric", open=False):
|
| 3500 |
gr.HTML(
|
| 3501 |
'<p class="c-panel__head">'
|
| 3502 |
'<span class="c-panel__title">Release assessment</span>'
|
| 3503 |
'<span class="c-panel__boundary">boundary 2 of 2</span></p>'
|
| 3504 |
)
|
| 3505 |
gr.HTML(
|
| 3506 |
-
render.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3507 |
)
|
| 3508 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3509 |
# Hidden component bindings form the machine API consumed by gradio_client.
|
| 3510 |
with gr.Column(visible=False):
|
| 3511 |
api_pair_code = gr.Textbox()
|
|
@@ -3559,6 +3644,28 @@ class DistinctUI:
|
|
| 3559 |
queue=False,
|
| 3560 |
api_visibility="private",
|
| 3561 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3562 |
new_conversation_button.click(
|
| 3563 |
self.new_conversation,
|
| 3564 |
inputs=[session_state],
|
|
|
|
| 50 |
RELEASE_BOUNDARY,
|
| 51 |
RUBRIC_AREAS,
|
| 52 |
USE_PHASE_BOUNDARY,
|
| 53 |
+
AreaStatus,
|
| 54 |
model_choices,
|
| 55 |
)
|
| 56 |
from .control_plane import ControlPlane
|
|
|
|
| 892 |
|
| 893 |
|
| 894 |
def _catalogue_markdown() -> str:
|
| 895 |
+
"""The two boundaries in prose, and where the working is.
|
| 896 |
+
|
| 897 |
+
This used to print the whole assessment inline as a bullet per model. The
|
| 898 |
+
assessment surface now renders the figures, their method, their notes and
|
| 899 |
+
their primary sources as cards, so repeating them here produced two copies
|
| 900 |
+
of the same claims that could drift apart. What stays is the part the cards
|
| 901 |
+
cannot carry: what the two boundaries are, and why they never meet.
|
| 902 |
+
"""
|
| 903 |
+
|
| 904 |
lines = [
|
| 905 |
"#### Release assessment · cradle to release",
|
| 906 |
"",
|
| 907 |
f"_{RELEASE_BOUNDARY}_",
|
| 908 |
"",
|
| 909 |
+
"Every model offered here has a published, model-specific assessment of its "
|
| 910 |
+
"training. Each figure is shown exactly as its publisher stated it, with the "
|
| 911 |
+
"method that produced it and a link to the document it came from, so you can "
|
| 912 |
+
"check the claim rather than take ours for it. Nothing on this surface is "
|
| 913 |
+
"ranked: a figure and an absence are not two points on one scale, and `Missing` "
|
| 914 |
+
"is neither zero nor a low score.",
|
| 915 |
"",
|
| 916 |
+
"Models with no published assessment are not listed. That is a stronger rule "
|
| 917 |
+
"than it looks — this project's only claim is about disclosed and measured "
|
| 918 |
+
"environmental cost, so a release nobody has published anything about is one "
|
| 919 |
+
"it has no business recommending.",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 920 |
"",
|
| 921 |
"#### Use-phase energy · per run",
|
| 922 |
"",
|
|
|
|
| 925 |
"Shown on each completed run and totalled per conversation, partitioned by "
|
| 926 |
"measurement scope. It is never added to a release figure, and never converted "
|
| 927 |
"into CO2e, water, land, materials or pollution — those conversions would be "
|
| 928 |
+
"assessor-created estimates, which this catalogue does not make.",
|
| 929 |
"",
|
| 930 |
"Minimum RAM is a disclosed hardware requirement of the file, not an "
|
| 931 |
"environmental result. This catalogue deliberately carries no model-size or "
|
|
|
|
| 934 |
return "\n".join(lines)
|
| 935 |
|
| 936 |
|
| 937 |
+
#: Where the catalogue publishes the assessment set. Owned by the catalogue,
|
| 938 |
+
#: read here. Absent is handled rather than guarded against: the fallback below
|
| 939 |
+
#: reads the assessments in catalog.py, which now carry real published figures,
|
| 940 |
+
#: so an absent file degrades to a smaller surface rather than an empty one.
|
|
|
|
| 941 |
ASSESSMENTS_PATH = Path(__file__).resolve().parent.parent / "model_assessments.json"
|
| 942 |
|
| 943 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 944 |
def _rubric_display() -> Mapping[str, Any]:
|
| 945 |
"""The assessment file's ``website_display`` block, or an empty mapping.
|
| 946 |
|
|
|
|
| 964 |
return warning if isinstance(warning, str) else ""
|
| 965 |
|
| 966 |
|
| 967 |
+
def _further_reading() -> list[Mapping[str, str]]:
|
| 968 |
+
items = _rubric_display().get("further_reading")
|
| 969 |
+
if not isinstance(items, (list, tuple)):
|
| 970 |
+
return []
|
| 971 |
+
return [
|
| 972 |
+
{"label": str(item.get("label") or ""), "url": str(item.get("url") or "")}
|
| 973 |
+
for item in items
|
| 974 |
+
if isinstance(item, Mapping) and item.get("url")
|
| 975 |
+
]
|
| 976 |
|
| 977 |
+
|
| 978 |
+
#: The published method words this surface will display. Anything else is shown
|
| 979 |
+
#: as stated but not painted as one of the confident states, and an area with no
|
| 980 |
+
#: value renders as an absence whatever its status field says.
|
| 981 |
+
_METHOD_WORDS = frozenset({"Measured", "Modelled", "Proxy-based"})
|
| 982 |
+
|
| 983 |
+
|
| 984 |
+
def _category_rows(record: Mapping[str, Any]) -> list[Mapping[str, Any]]:
|
| 985 |
+
"""The six areas of one record, in the catalogue's order, always all six.
|
| 986 |
+
|
| 987 |
+
State is read before value, per the assessment file's own rendering rules.
|
| 988 |
+
A record that omits an area entirely gets an explicit absence rather than a
|
| 989 |
+
missing row, because a card with four rows reads as a model with four areas.
|
| 990 |
"""
|
| 991 |
|
|
|
|
|
|
|
| 992 |
categories = record.get("categories")
|
| 993 |
+
categories = categories if isinstance(categories, Mapping) else {}
|
| 994 |
rows: list[Mapping[str, Any]] = []
|
| 995 |
+
for area in RUBRIC_AREAS:
|
| 996 |
+
cell = categories.get(area)
|
| 997 |
+
cell = cell if isinstance(cell, Mapping) else {}
|
| 998 |
+
reported = str(cell.get("state") or "missing") == "reported"
|
| 999 |
+
value = cell.get("value")
|
| 1000 |
+
rows.append(
|
| 1001 |
+
{
|
| 1002 |
+
"label": AREA_LABELS.get(area, area),
|
| 1003 |
+
"status": str(cell.get("status") or "") if reported else "",
|
| 1004 |
+
"value": str(value) if reported and isinstance(value, (str, int, float)) else "",
|
| 1005 |
+
"unit": str(cell.get("unit") or "") if reported else "",
|
| 1006 |
+
"note": str(cell.get("note") or ""),
|
| 1007 |
+
"source_url": str(cell.get("source_url") or "") if reported else "",
|
| 1008 |
+
}
|
| 1009 |
+
)
|
| 1010 |
+
return rows
|
| 1011 |
+
|
| 1012 |
+
|
| 1013 |
+
def _evidence_card(record: Mapping[str, Any], *, note: str = "") -> str:
|
| 1014 |
+
"""One ``website_display.models`` record as an evidence card.
|
| 1015 |
+
|
| 1016 |
+
No letter is computed, because there are no letters. Values, units and
|
| 1017 |
+
method words are passed through exactly as the file states them; a cell
|
| 1018 |
+
whose state is not ``reported`` renders as an absence regardless of what
|
| 1019 |
+
else it carries, so a malformed record can only ever lose a figure, never
|
| 1020 |
+
acquire one.
|
| 1021 |
+
"""
|
| 1022 |
+
|
| 1023 |
+
assessed = sum(1 for row in _category_rows(record) if row["value"])
|
| 1024 |
+
coverage = str(record.get("coverage") or "").strip()
|
| 1025 |
+
coverage_text = (
|
| 1026 |
+
f"{coverage.lower()} · {assessed} of {len(RUBRIC_AREAS)} areas published"
|
| 1027 |
+
if coverage and assessed
|
| 1028 |
+
else "no published result"
|
| 1029 |
+
)
|
| 1030 |
+
links = record.get("links")
|
| 1031 |
+
links = links if isinstance(links, (list, tuple)) else ()
|
| 1032 |
+
return render.model_evidence_card(
|
| 1033 |
name=str(record.get("name") or record.get("model_id") or "unnamed"),
|
| 1034 |
+
coverage=coverage_text,
|
| 1035 |
+
summary=str(record.get("summary") or ""),
|
| 1036 |
+
covers=str(record.get("covers") or ""),
|
| 1037 |
+
categories=_category_rows(record),
|
| 1038 |
+
links=[
|
| 1039 |
+
{"label": str(item.get("label") or ""), "url": str(item.get("url") or "")}
|
| 1040 |
+
for item in links
|
| 1041 |
+
if isinstance(item, Mapping) and item.get("url")
|
| 1042 |
+
],
|
| 1043 |
+
note=note or str(record.get("boundary") or ""),
|
| 1044 |
)
|
| 1045 |
|
| 1046 |
|
| 1047 |
+
#: The model selected when a session opens. The lowest published figures of any
|
| 1048 |
+
#: assessed release this network can run; see model_assessments.json.
|
| 1049 |
+
DEFAULT_MODEL_ID = "olmoe-1b-7b-0924-instruct"
|
| 1050 |
|
| 1051 |
|
| 1052 |
def _assessment_by_model_id() -> Mapping[str, Mapping[str, Any]]:
|
| 1053 |
+
"""``website_display.models`` keyed by record id, exact matches only.
|
| 1054 |
|
| 1055 |
Deliberately no fuzzy matching, and no alias table invented here. The
|
| 1056 |
+
assessment records name releases ("OLMo 2 7B", "OLMoE 1B-7B 0924"); the
|
| 1057 |
+
catalogue names specific quantised checkpoints ("OLMo 2 1124 7B Instruct,
|
| 1058 |
+
Q4_K_M"). Those are not the same object, and a surface whose first rule is
|
| 1059 |
+
that a figure belongs to the thing that was assessed cannot have its own
|
| 1060 |
+
renderer guessing which figure goes with which file.
|
| 1061 |
+
|
| 1062 |
+
So a catalogue entry gets an assessment when ``ASSESSMENT_ASSIGNMENT`` says
|
| 1063 |
+
which record covers it, and renders as not assessed otherwise. Extending the
|
| 1064 |
+
coverage is a change to the assessment data, which is where the evidence
|
| 1065 |
+
lives.
|
| 1066 |
"""
|
| 1067 |
|
| 1068 |
records = _rubric_display().get("models")
|
|
|
|
| 1075 |
}
|
| 1076 |
|
| 1077 |
|
| 1078 |
+
#: Which assessment record covers which catalogue entry, and what it leaves out.
|
|
|
|
|
|
|
|
|
|
| 1079 |
#:
|
| 1080 |
+
#: This table used to carry an ``impact`` boolean, because the surface had two
|
| 1081 |
+
#: ordinal scales and one of them could transfer between checkpoints while the
|
| 1082 |
+
#: other could not. Both scales are gone, and with them the reason for that
|
| 1083 |
+
#: flag: a published figure either covers the checkpoint being offered or it
|
| 1084 |
+
#: does not, and where it does not the card says so in words rather than
|
| 1085 |
+
#: withholding a letter.
|
|
|
|
|
|
|
| 1086 |
#:
|
| 1087 |
+
#: The mapping itself stays, and stays explicit, for the reason it always
|
| 1088 |
+
#: existed. Every entry below is a *pretraining* result being shown beside an
|
| 1089 |
+
#: *instruction-tuned* checkpoint built on that pretraining run. That is a
|
| 1090 |
+
#: partial coverage claim, not a complete one, and it is one substitution away
|
| 1091 |
+
#: from the thing this catalogue refuses — quietly transferring a figure from
|
| 1092 |
+
#: one release to another. Writing it down is what keeps the two apart.
|
| 1093 |
+
ASSESSMENT_ASSIGNMENT: Mapping[str, Mapping[str, Any]] = {
|
| 1094 |
+
"olmoe-1b-7b-0924-instruct": {
|
| 1095 |
+
"record": "olmoe-1b-7b-0924",
|
| 1096 |
+
"note": (
|
| 1097 |
+
"Figures cover the 0924 pretraining run; the tuning stage that produced this "
|
| 1098 |
+
"checkpoint is not separately costed in the source."
|
| 1099 |
+
),
|
| 1100 |
},
|
| 1101 |
+
"olmo-2-1124-7b-instruct": {
|
| 1102 |
+
"record": "olmo-2-1124-7b",
|
| 1103 |
+
"note": (
|
| 1104 |
+
"Figures cover the 1124 pretraining run; the tuning stage that produced this "
|
| 1105 |
+
"checkpoint is not separately costed in the source."
|
| 1106 |
+
),
|
| 1107 |
},
|
| 1108 |
+
"llama-2-7b-chat": {
|
| 1109 |
+
"record": "llama-2-7b",
|
| 1110 |
+
"note": (
|
| 1111 |
+
"Figures cover Llama 2 7B pretraining; Meta report fine-tuning compute inside "
|
| 1112 |
+
"the family total without breaking it out per checkpoint."
|
| 1113 |
+
),
|
| 1114 |
},
|
| 1115 |
}
|
| 1116 |
|
|
|
|
| 1118 |
def _assignment(model_id: str) -> tuple[Mapping[str, Any] | None, Mapping[str, Any]]:
|
| 1119 |
"""``(assessment record, assignment rules)`` for one catalogue model."""
|
| 1120 |
|
| 1121 |
+
rules = ASSESSMENT_ASSIGNMENT.get(model_id)
|
| 1122 |
if rules is None:
|
| 1123 |
return None, {}
|
| 1124 |
return _assessment_by_model_id().get(str(rules["record"])), rules
|
| 1125 |
|
| 1126 |
|
| 1127 |
+
def _evidence_suffix(model_id: str) -> str:
|
| 1128 |
+
"""The fragment appended to a model's name in the chooser.
|
| 1129 |
|
| 1130 |
+
A letter used to go here. What replaced it is the fact the letter was
|
| 1131 |
+
standing in for: which areas somebody actually published, and how. That is
|
| 1132 |
+
longer, and it is the thing a person choosing a model can act on -- "energy,
|
| 1133 |
+
climate, water · measured" says what is known; "B" said what we thought of it.
|
| 1134 |
"""
|
| 1135 |
|
| 1136 |
+
record, _ = _assignment(model_id)
|
| 1137 |
if record is None:
|
| 1138 |
+
assessment = RELEASE_ASSESSMENT.get(model_id)
|
| 1139 |
+
if assessment is None or not assessment.has_any_result:
|
| 1140 |
+
return "no published assessment"
|
| 1141 |
+
published = [
|
| 1142 |
+
AREA_LABELS[area].split(" /", 1)[0].lower()
|
| 1143 |
+
for area in RUBRIC_AREAS
|
| 1144 |
+
if assessment.areas[area].status is not AreaStatus.MISSING
|
| 1145 |
+
]
|
| 1146 |
+
return ", ".join(published) + " published"
|
| 1147 |
+
|
| 1148 |
+
rows = _category_rows(record)
|
| 1149 |
+
published = [row["label"].split(" /", 1)[0].lower() for row in rows if row["value"]]
|
| 1150 |
+
if not published:
|
| 1151 |
+
return "no published assessment"
|
| 1152 |
+
methods = {row["status"] for row in rows if row["value"] and row["status"] in _METHOD_WORDS}
|
| 1153 |
+
if methods == {"Measured"}:
|
| 1154 |
+
method = "measured"
|
| 1155 |
+
elif "Measured" in methods:
|
| 1156 |
+
# Not "partly measured", which reads as a hedge about the measuring.
|
| 1157 |
+
# Some of these figures were metered and some were calculated from the
|
| 1158 |
+
# metered ones, and both halves of that belong in the phrase.
|
| 1159 |
+
method = "measured and modelled"
|
| 1160 |
+
elif methods:
|
| 1161 |
+
method = "modelled"
|
| 1162 |
else:
|
| 1163 |
+
method = "method not stated"
|
| 1164 |
+
return f"{', '.join(published)} · {method}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1165 |
|
| 1166 |
|
| 1167 |
def _short_label(label: str) -> str:
|
| 1168 |
"""The model's name, without the packager that follows it.
|
| 1169 |
|
| 1170 |
+
``model_choices`` yields "OLMoE 1B-7B 0924 Instruct · Ai2 first-party GGUF";
|
| 1171 |
+
the part before the first separator is the model, and that is what a chooser
|
| 1172 |
+
needs.
|
| 1173 |
"""
|
| 1174 |
|
| 1175 |
return label.split(" · ", 1)[0].strip() or label
|
| 1176 |
|
| 1177 |
|
| 1178 |
+
def model_choices_with_evidence() -> list[tuple[str, str]]:
|
| 1179 |
+
"""Model options carrying what was published about them, not their RAM.
|
| 1180 |
|
| 1181 |
+
The publisher is dropped from the option text and not from the product: it
|
| 1182 |
+
is on the worker card, on the assessment card and in the manifest the digest
|
| 1183 |
+
is checked against. In a 280px control it was 9 characters that pushed the
|
| 1184 |
+
disclosure out of view.
|
| 1185 |
"""
|
| 1186 |
|
| 1187 |
+
return [
|
| 1188 |
+
(f"{_short_label(label)} · {_evidence_suffix(model_id)}", model_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1189 |
for label, model_id in model_choices()
|
| 1190 |
]
|
| 1191 |
|
| 1192 |
|
| 1193 |
+
def _assessment_cards() -> list[str]:
|
| 1194 |
+
"""Build the evidence cards from the assessment file's display block.
|
| 1195 |
|
| 1196 |
+
Ordering follows the catalogue, and no ordering here implies a ranking:
|
| 1197 |
+
these are not scores, and two models with published figures in different
|
| 1198 |
+
areas are not on one scale.
|
|
|
|
| 1199 |
"""
|
| 1200 |
|
| 1201 |
display = _rubric_display()
|
|
|
|
| 1207 |
for record in records:
|
| 1208 |
if isinstance(record, Mapping) and record.get("model_id"):
|
| 1209 |
by_id[str(record["model_id"])] = record
|
| 1210 |
+
# Catalogue order first, so the surface matches the chooser; anything the
|
| 1211 |
+
# file carries that the catalogue does not is appended rather than
|
| 1212 |
+
# dropped, because a record for a model we no longer ship is still a
|
| 1213 |
+
# published result somebody may be looking for.
|
| 1214 |
+
seen: set[str] = set()
|
| 1215 |
+
for model_id in MODEL_CATALOG:
|
| 1216 |
+
rules = ASSESSMENT_ASSIGNMENT.get(model_id) or {}
|
| 1217 |
+
record_id = str(rules.get("record") or "")
|
| 1218 |
+
record = by_id.get(record_id)
|
| 1219 |
+
if record is None:
|
| 1220 |
+
continue
|
| 1221 |
+
seen.add(record_id)
|
| 1222 |
+
cards.append(_evidence_card(record, note=str(rules.get("note") or "")))
|
| 1223 |
+
for record_id, record in by_id.items():
|
| 1224 |
+
if record_id not in seen:
|
| 1225 |
+
cards.append(_evidence_card(record))
|
| 1226 |
return cards
|
| 1227 |
|
| 1228 |
+
# Fallback: the assessments in the catalogue itself. These now carry real
|
| 1229 |
+
# published figures rather than a uniform "no data", so an absent or
|
| 1230 |
+
# unreadable assessment file degrades to a smaller surface rather than an
|
| 1231 |
+
# empty one.
|
| 1232 |
for model_id, manifest in MODEL_CATALOG.items():
|
| 1233 |
assessment = RELEASE_ASSESSMENT[model_id]
|
| 1234 |
+
rows = [
|
| 1235 |
+
{
|
| 1236 |
+
"label": AREA_LABELS[area],
|
| 1237 |
+
"status": assessment.areas[area].status.value
|
| 1238 |
+
if assessment.areas[area].status is not AreaStatus.MISSING
|
| 1239 |
+
else "",
|
| 1240 |
+
"value": assessment.areas[area].value or "",
|
| 1241 |
+
"unit": assessment.areas[area].unit or "",
|
| 1242 |
+
"note": assessment.areas[area].note,
|
| 1243 |
+
"source_url": assessment.areas[area].source_url or "",
|
| 1244 |
+
}
|
| 1245 |
+
for area in RUBRIC_AREAS
|
| 1246 |
+
]
|
| 1247 |
cards.append(
|
| 1248 |
+
render.model_evidence_card(
|
| 1249 |
name=manifest.label,
|
| 1250 |
+
coverage=assessment.coverage_display,
|
| 1251 |
+
summary=assessment.summary,
|
| 1252 |
+
covers=assessment.covers,
|
|
|
|
| 1253 |
categories=rows,
|
| 1254 |
+
links=list(assessment.links),
|
| 1255 |
note=assessment.reason,
|
| 1256 |
)
|
| 1257 |
)
|
|
|
|
| 1505 |
def _library_page(
|
| 1506 |
self, query: str, defaults: Sequence[str]
|
| 1507 |
) -> tuple[Any, str, str]:
|
| 1508 |
+
"""The page a person picks their defaults on: the transport, then what is drawn.
|
| 1509 |
+
|
| 1510 |
+
The checkbox group is not a second way to choose; it is the same
|
| 1511 |
+
choice, off the screen, because the framework only reports its own
|
| 1512 |
+
controls. Every box is labelled with the bare reference so the card
|
| 1513 |
+
that forwards a click to it can find it by an exact string rather than
|
| 1514 |
+
by its position in a list that a filter can reorder.
|
| 1515 |
+
"""
|
| 1516 |
|
| 1517 |
rows, matched = self._library_rows(query)
|
| 1518 |
total = len(_library_specs())
|
| 1519 |
+
choices = [(row["ref"], row["ref"]) for row in rows]
|
|
|
|
|
|
|
| 1520 |
# Defaults outside the current filter are preserved rather than
|
| 1521 |
# dropped. Searching is a way of looking, not a way of deselecting,
|
| 1522 |
# and a search box that quietly unticked everything it hid would be
|
|
|
|
| 1547 |
profile: "gr.OAuthProfile | None" = None,
|
| 1548 |
request: "gr.Request | None" = None,
|
| 1549 |
) -> tuple[Any, Any, str, str, Any, str]:
|
| 1550 |
+
"""Record the defaults the page's cards are currently showing as on.
|
| 1551 |
+
|
| 1552 |
+
The merge only ever replaces members currently on screen. Somebody who
|
| 1553 |
+
searches "pdf", drops one member and then searches "plan" has changed
|
| 1554 |
+
their mind about one member, not about every member the filter was
|
| 1555 |
+
hiding, and a page whose whole job is to remember a choice must not
|
| 1556 |
+
forget one because it was scrolled out of a filter.
|
| 1557 |
+
|
| 1558 |
+
Values arrive from the page's own hidden group and are still filtered
|
| 1559 |
+
against the library, because a control in a browser is a suggestion.
|
| 1560 |
"""
|
| 1561 |
|
| 1562 |
+
visible_choice = [item for item in visible_choice or () if isinstance(item, str)]
|
| 1563 |
rows, _ = self._library_rows(query)
|
| 1564 |
on_screen = {row["ref"] for row in rows}
|
| 1565 |
previous = set(_library_defaults(state))
|
|
|
|
| 1577 |
defaults=_library_defaults(updated),
|
| 1578 |
viewer_id=viewer_id,
|
| 1579 |
)
|
| 1580 |
+
_group, summary, _cards = self._library_page(query, _library_defaults(updated))
|
| 1581 |
+
# The cards are NOT re-rendered here. The click already moved the card
|
| 1582 |
+
# in the browser, and pushing fresh markup back would rebuild the grid
|
| 1583 |
+
# under the user's cursor — losing a hover preview mid-play and, on a
|
| 1584 |
+
# phone, moving the thing they just tapped. The summary updates
|
| 1585 |
+
# because it is the count, which is the feedback that matters.
|
| 1586 |
+
return updated, updated, summary, gr.skip(), selector, note
|
| 1587 |
|
| 1588 |
# Outputs ----------------------------------------------------------
|
| 1589 |
|
|
|
|
| 1896 |
library, library_note = self._library_components(
|
| 1897 |
None, defaults=_library_defaults(updated), viewer_id=user_id
|
| 1898 |
)
|
| 1899 |
+
page_group, page_summary, page_cards = self._library_page(
|
| 1900 |
+
"", _library_defaults(updated)
|
| 1901 |
+
)
|
| 1902 |
return (
|
| 1903 |
updated,
|
| 1904 |
updated,
|
|
|
|
| 1914 |
library_note,
|
| 1915 |
self._outputs_component(updated),
|
| 1916 |
activity,
|
| 1917 |
+
# The library page is filled on arrival rather than on first open,
|
| 1918 |
+
# so a browser that already has defaults shows those cards already
|
| 1919 |
+
# selected the moment the page is opened.
|
| 1920 |
+
page_group,
|
| 1921 |
page_summary,
|
| 1922 |
page_cards,
|
| 1923 |
)
|
|
|
|
| 2813 |
state["session_id"], job_id, raw_artifacts
|
| 2814 |
)
|
| 2815 |
answer["artifacts"] = [Path(item).name for item in stored]
|
| 2816 |
+
# WHAT THE RUN MADE, READ ONCE.
|
| 2817 |
+
#
|
| 2818 |
+
# A file the run produced is the answer to "make me a
|
| 2819 |
+
# PDF", and until now the transcript said "1 file" and
|
| 2820 |
+
# left the thing itself in a panel. The preview is
|
| 2821 |
+
# derived here, at claim time, and travels in browser
|
| 2822 |
+
# state with the answer: the transcript re-renders
|
| 2823 |
+
# every two seconds and must never re-open a zip to
|
| 2824 |
+
# do it.
|
| 2825 |
+
answer["made"] = render.artifact_preview_data(stored)
|
| 2826 |
updated = record_answer(updated, job_id=job_id, answer=answer)
|
| 2827 |
|
| 2828 |
if answer is not None:
|
|
|
|
| 2870 |
_step_messages(answer.get("steps") or (), running=False)
|
| 2871 |
)
|
| 2872 |
messages.append({"role": "assistant", "content": str(answer.get("output", ""))})
|
| 2873 |
+
# The artifact, immediately under the words that announced it.
|
| 2874 |
+
# A run whose whole purpose was to produce a file ends on the
|
| 2875 |
+
# file, not on a sentence about a file.
|
| 2876 |
+
made = render.made_things(answer.get("made") or ())
|
| 2877 |
+
if made:
|
| 2878 |
+
messages.append({"role": "assistant", "content": made})
|
| 2879 |
status_label = "completed"
|
| 2880 |
outcome = ""
|
| 2881 |
elif view is None:
|
|
|
|
| 3157 |
# button below is the one sign-in control, so a header link
|
| 3158 |
# would only duplicate it.
|
| 3159 |
identity = gr.HTML(_identity_html(""))
|
| 3160 |
+
# The quick nav sits directly under the identity box. The
|
| 3161 |
+
# library is a destination rather than a section, so its
|
| 3162 |
+
# control is a button that swaps the view; "Run an agent" is
|
| 3163 |
+
# still a section of this page, so it stays an anchor.
|
| 3164 |
+
with gr.Row(elem_classes="c-quicknav"):
|
| 3165 |
+
open_library = gr.Button(
|
| 3166 |
+
"Library", size="sm", variant="secondary",
|
| 3167 |
+
elem_classes="c-quicknav__btn", scale=0,
|
| 3168 |
+
)
|
| 3169 |
+
gr.HTML(
|
| 3170 |
+
'<a class="c-quicknav__link" href="#join-agent">Run an agent</a>'
|
| 3171 |
+
)
|
| 3172 |
|
| 3173 |
# THE SIGN-IN CONTROL, AND WHY IT IS CONDITIONAL.
|
| 3174 |
#
|
|
|
|
| 3251 |
# the model.
|
| 3252 |
model = gr.Dropdown(
|
| 3253 |
label="Model",
|
| 3254 |
+
choices=model_choices_with_evidence(),
|
| 3255 |
value=DEFAULT_MODEL_ID,
|
| 3256 |
container=True,
|
| 3257 |
)
|
|
|
|
| 3506 |
create_code = gr.Button("Generate pairing code")
|
| 3507 |
gr.Markdown()
|
| 3508 |
|
| 3509 |
+
with gr.Accordion("Model assessments and their sources", open=False):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3510 |
gr.HTML(
|
| 3511 |
'<p class="c-panel__head">'
|
| 3512 |
'<span class="c-panel__title">Release assessment</span>'
|
| 3513 |
'<span class="c-panel__boundary">boundary 2 of 2</span></p>'
|
| 3514 |
)
|
| 3515 |
gr.HTML(
|
| 3516 |
+
render.assessment_section(
|
| 3517 |
+
_assessment_cards(),
|
| 3518 |
+
warning=_rubric_warning(),
|
| 3519 |
+
further_reading=_further_reading(),
|
| 3520 |
+
)
|
| 3521 |
)
|
| 3522 |
|
| 3523 |
+
# THE LIBRARY IS A PAGE, NOT A SECTION.
|
| 3524 |
+
#
|
| 3525 |
+
# It used to be an accordion at the bottom of the chat page, which
|
| 3526 |
+
# is where a person found it after scrolling past the conversation,
|
| 3527 |
+
# the composer and the agent panel — that is a footnote, not a
|
| 3528 |
+
# destination. It is now a full view of its own, reached from the
|
| 3529 |
+
# control under the sign-in box and leaving by the same route.
|
| 3530 |
+
#
|
| 3531 |
+
# A view rather than a Gradio route, deliberately. A second route
|
| 3532 |
+
# is a second Blocks with its own state, and the defaults live in
|
| 3533 |
+
# this browser's own storage beside the transcript; two pages
|
| 3534 |
+
# writing that one key is how a person loses their history to a
|
| 3535 |
+
# visit to the library. One Blocks, two views, one copy of the
|
| 3536 |
+
# state.
|
| 3537 |
+
with gr.Column(elem_classes="c-libpage", visible=False) as library_view:
|
| 3538 |
+
close_library = gr.Button(
|
| 3539 |
+
"\u2190 Back to the conversation", size="sm",
|
| 3540 |
+
variant="secondary", elem_classes="c-libpage__backbtn", scale=0,
|
| 3541 |
+
)
|
| 3542 |
+
gr.HTML(
|
| 3543 |
+
'<h1 class="c-libpage__title">Library</h1>'
|
| 3544 |
+
'<p class="c-libpage__lede">Every tool and skill this server can '
|
| 3545 |
+
"offer, who wrote it, and what it does. Hover a card — or press "
|
| 3546 |
+
"and hold on a phone — to watch it work. Tap a card to keep it as "
|
| 3547 |
+
"a default: it selects itself whenever a worker offers it, and any "
|
| 3548 |
+
"single run can drop it without changing what is saved.</p>"
|
| 3549 |
+
)
|
| 3550 |
+
library_search = gr.Textbox(
|
| 3551 |
+
label="Search the library",
|
| 3552 |
+
show_label=False,
|
| 3553 |
+
placeholder="Search by name, reference or what it does…",
|
| 3554 |
+
container=False,
|
| 3555 |
+
elem_classes="c-librarysearch",
|
| 3556 |
+
)
|
| 3557 |
+
library_summary = gr.HTML(
|
| 3558 |
+
render.library_summary(shown=0, matched=0, total=0, chosen=0)
|
| 3559 |
+
)
|
| 3560 |
+
library_cards_html = gr.HTML(elem_classes="c-librarycards")
|
| 3561 |
+
# THE CARDS ARE THE CONTROL; THIS IS HOW THEY REACH PYTHON.
|
| 3562 |
+
#
|
| 3563 |
+
# The page used to carry a grid of cards *and* a visible list
|
| 3564 |
+
# of tick boxes naming the same members again: two controls for
|
| 3565 |
+
# one decision, and the reason the page was unreadable on a
|
| 3566 |
+
# phone. The grid is the only control a person sees now. This
|
| 3567 |
+
# group is its transport, off the screen, and the click handler
|
| 3568 |
+
# forwards a card's click to the box that belongs to it.
|
| 3569 |
+
#
|
| 3570 |
+
# Forwarding a real click rather than writing a value is the
|
| 3571 |
+
# whole trick, and it was arrived at the hard way: setting a
|
| 3572 |
+
# hidden field's ``value`` and dispatching ``input`` looks
|
| 3573 |
+
# right, changes the DOM, and never reaches the server, because
|
| 3574 |
+
# the framework's own binding is what it listens to. Clicking
|
| 3575 |
+
# the framework's own control cannot drift from it.
|
| 3576 |
+
#
|
| 3577 |
+
# Each box is labelled with its bare reference so the mapping
|
| 3578 |
+
# from card to box is an exact string match rather than a
|
| 3579 |
+
# position, which would silently mis-tick the moment a filter
|
| 3580 |
+
# reordered one list and not the other. Hidden in CSS, never
|
| 3581 |
+
# with ``visible=False``: gradio 6 leaves an invisible block
|
| 3582 |
+
# out of the document altogether, and a transport the page
|
| 3583 |
+
# cannot find is a page that silently never saves.
|
| 3584 |
+
library_defaults = gr.CheckboxGroup(
|
| 3585 |
+
label="Saved defaults",
|
| 3586 |
+
show_label=False,
|
| 3587 |
+
choices=[],
|
| 3588 |
+
value=[],
|
| 3589 |
+
container=False,
|
| 3590 |
+
elem_id="library-choice",
|
| 3591 |
+
elem_classes="c-hiddenfield",
|
| 3592 |
+
)
|
| 3593 |
+
|
| 3594 |
# Hidden component bindings form the machine API consumed by gradio_client.
|
| 3595 |
with gr.Column(visible=False):
|
| 3596 |
api_pair_code = gr.Textbox()
|
|
|
|
| 3644 |
queue=False,
|
| 3645 |
api_visibility="private",
|
| 3646 |
)
|
| 3647 |
+
# THE LIBRARY VIEW SWAP.
|
| 3648 |
+
#
|
| 3649 |
+
# Two columns, one visible at a time, and the scroll position reset
|
| 3650 |
+
# on arrival: a page that opens halfway down is the single clearest
|
| 3651 |
+
# sign that nothing really navigated. The transition is instant
|
| 3652 |
+
# because both views are already in the document; nothing is
|
| 3653 |
+
# fetched to change page.
|
| 3654 |
+
_scroll_top = "() => { window.scrollTo({top: 0, behavior: 'instant'}); }"
|
| 3655 |
+
open_library.click(
|
| 3656 |
+
lambda: (gr.Column(visible=False), gr.Column(visible=True)),
|
| 3657 |
+
outputs=[app_view, library_view],
|
| 3658 |
+
queue=False,
|
| 3659 |
+
api_visibility="private",
|
| 3660 |
+
js=_scroll_top,
|
| 3661 |
+
)
|
| 3662 |
+
close_library.click(
|
| 3663 |
+
lambda: (gr.Column(visible=True), gr.Column(visible=False)),
|
| 3664 |
+
outputs=[app_view, library_view],
|
| 3665 |
+
queue=False,
|
| 3666 |
+
api_visibility="private",
|
| 3667 |
+
js=_scroll_top,
|
| 3668 |
+
)
|
| 3669 |
new_conversation_button.click(
|
| 3670 |
self.new_conversation,
|
| 3671 |
inputs=[session_state],
|
distinct_skills/manifest.py
CHANGED
|
@@ -44,25 +44,25 @@ PACKAGED_ROOT = Path(__file__).resolve().parent / "skills"
|
|
| 44 |
#: expect the review to ask why the digest changed.
|
| 45 |
PINNED_DIGESTS: Mapping[str, str] = MappingProxyType(
|
| 46 |
{
|
| 47 |
-
"academy-guide": "
|
| 48 |
-
"algorithmic-art": "
|
| 49 |
-
"brand-guidelines": "
|
| 50 |
-
"canvas-design": "
|
| 51 |
-
"claude-api": "
|
| 52 |
"create-deck": "e7c9a709f4609af0e5560544ecd8b05cb32fe5e52c147a23690f700700ec5b88",
|
| 53 |
"create-docx": "b1e950ab46f324bca84f6aade1d6772f13090e1fb1cb57df761c41bcb4764b7d",
|
| 54 |
"create-xlsx": "73325b2bd0d99ec781610ed9da1af59fef2655fb6e7b3766a29e2915d5ec449d",
|
| 55 |
"csv-table": "ff87a44fe03901f0cfb61f46209b6cc7138acf07d87279c936cd8711b0a5e455",
|
| 56 |
-
"discernment-nudge": "
|
| 57 |
"frontend-design": "283205e755626aae7c517f6a3b0f9b8d16b2d30f32d24822080b58393eae689a",
|
| 58 |
-
"mcp-builder": "
|
| 59 |
"review-checklist": "98af818e3e4c178021bb87bcf355934b5effca7240b738f48ee344f7c6b6686f",
|
| 60 |
"skill-scaffold": "158d1d1ff1ff3ad83865537708cd4464cdd114f420912136917b9c143c32e18e",
|
| 61 |
-
"slack-gif-creator": "
|
| 62 |
"status-update": "48b7b1914de88b70e0ff9d19262987aca01696f6ebce061d0793543cbacc309e",
|
| 63 |
"theme-factory": "1b5d9800d869e902757d1b1733f98f3936319ee090035ffe9a82603662ccebe8",
|
| 64 |
-
"web-artifacts-builder": "
|
| 65 |
-
"webapp-testing": "
|
| 66 |
}
|
| 67 |
)
|
| 68 |
|
|
|
|
| 44 |
#: expect the review to ask why the digest changed.
|
| 45 |
PINNED_DIGESTS: Mapping[str, str] = MappingProxyType(
|
| 46 |
{
|
| 47 |
+
"academy-guide": "47c88cbeb129c2edcb68176bc09621df72557200d253c2a5795e8f76603d6b45",
|
| 48 |
+
"algorithmic-art": "15adcdf6e2f9a51d1a2cf9a0cfa636970c53c5f464fe6ef96b5144a72cc95dbd",
|
| 49 |
+
"brand-guidelines": "d4443542e29d6b91234dffd31a65ed7df578adea5f58dfc70af068ad82dae1e5",
|
| 50 |
+
"canvas-design": "fc44c8a8552c1c6bfc5f92f115d07082a9ae3a1a174333b9689abf1d6b8d3a69",
|
| 51 |
+
"claude-api": "23a386a66bce1123f0765779966b802279c23eff956932d3283cc9ba60ecea9e",
|
| 52 |
"create-deck": "e7c9a709f4609af0e5560544ecd8b05cb32fe5e52c147a23690f700700ec5b88",
|
| 53 |
"create-docx": "b1e950ab46f324bca84f6aade1d6772f13090e1fb1cb57df761c41bcb4764b7d",
|
| 54 |
"create-xlsx": "73325b2bd0d99ec781610ed9da1af59fef2655fb6e7b3766a29e2915d5ec449d",
|
| 55 |
"csv-table": "ff87a44fe03901f0cfb61f46209b6cc7138acf07d87279c936cd8711b0a5e455",
|
| 56 |
+
"discernment-nudge": "d83200e87cae43adbd61ff7277fc08e14c1f032f11590fb5a04bfbf55eb16fdd",
|
| 57 |
"frontend-design": "283205e755626aae7c517f6a3b0f9b8d16b2d30f32d24822080b58393eae689a",
|
| 58 |
+
"mcp-builder": "0c714adae4963be9411e061647f4efa3820b06d2974a2b319aa93330afc8eb82",
|
| 59 |
"review-checklist": "98af818e3e4c178021bb87bcf355934b5effca7240b738f48ee344f7c6b6686f",
|
| 60 |
"skill-scaffold": "158d1d1ff1ff3ad83865537708cd4464cdd114f420912136917b9c143c32e18e",
|
| 61 |
+
"slack-gif-creator": "d1c7506e4c0bb3dfb17608e7e2909a91083d6f7323702a2b70bd5d3efc98c6b9",
|
| 62 |
"status-update": "48b7b1914de88b70e0ff9d19262987aca01696f6ebce061d0793543cbacc309e",
|
| 63 |
"theme-factory": "1b5d9800d869e902757d1b1733f98f3936319ee090035ffe9a82603662ccebe8",
|
| 64 |
+
"web-artifacts-builder": "c57043ce13ad02df16ce717da8572fc59ec309bf9326a1e7d8b2f4f6cbc7e962",
|
| 65 |
+
"webapp-testing": "c2202ffb51483464e7a485ffa704899f20bcb2feb71073689ed678af7b55e7a4",
|
| 66 |
}
|
| 67 |
)
|
| 68 |
|