diff --git a/.gitignore b/.gitignore index accfb257..16f92c6b 100644 --- a/.gitignore +++ b/.gitignore @@ -47,5 +47,3 @@ build-vision.bat *.done /third_party/*.zip -# the web app's fonts (GT Walsheim Pro, commercial licence): local only, never published -serve/web/fonts/ diff --git a/docs/DETAILS.md b/docs/DETAILS.md index ceadcd97..39b96d25 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -367,3 +367,5 @@ The full story, with measurements, bottlenecks and what comes next: **[docs/pape `third_party/ggml/LICENSE`. - Ideas from [Splash](https://github.com/incoai/splash), [ninfer](https://github.com/Neroued/ninfer) and [HyperQwen](https://github.com/syv-ai/HyperQwen); references in the paper. +- The web app's font: [Outfit](https://github.com/Outfitio/Outfit-Fonts) (SIL Open Font License 1.1, see + `serve/web/fonts/OFL.txt`). Its Monitor tab started from @code-martin's dashboard idea (PR #22). diff --git a/serve/server.py b/serve/server.py index c0e12dc0..86b0e483 100644 --- a/serve/server.py +++ b/serve/server.py @@ -781,8 +781,7 @@ def make_handler(svc: Service): def do_GET(self): path = self.path.split("?")[0].rstrip("/") if path.startswith("/fonts/"): - # the web app's fonts, only if they are installed locally (serve/web/fonts); the page falls back - # to the system font without them + # the web app's font (Outfit, OFL: serve/web/fonts); the page falls back to the system font name = path[len("/fonts/"):] f = ROOT / "serve" / "web" / "fonts" / name if "/" in name or "\\" in name or not name.endswith(".woff2") or not f.is_file(): diff --git a/serve/web/app.js b/serve/web/app.js index f225188e..64f546ee 100644 --- a/serve/web/app.js +++ b/serve/web/app.js @@ -54,15 +54,22 @@ async function copyText(text, btn) { } // ------------------------------------------------------------------ theme and tabs -function setTheme(t) { +// the system's theme until the user picks one (only a click is saved) +function setTheme(t, save) { document.documentElement.dataset.theme = t; - try { localStorage.setItem("strata.theme", t); } catch (e) { /* ignore */ } + if (save) try { localStorage.setItem("strata.theme", t); } catch (e) { /* ignore */ } $("theme-icon").setAttribute("href", `${SPRITE}#i-${t === "dark" ? "sun" : "moon"}`); $("dark-toggle").setAttribute("aria-checked", String(t === "dark")); } -$("theme-btn").onclick = () => setTheme(document.documentElement.dataset.theme === "dark" ? "light" : "dark"); -$("dark-toggle").onclick = () => setTheme(document.documentElement.dataset.theme === "dark" ? "light" : "dark"); -setTheme(document.documentElement.dataset.theme || "light"); +const flipTheme = () => setTheme(document.documentElement.dataset.theme === "dark" ? "light" : "dark", true); +$("theme-btn").onclick = flipTheme; +$("dark-toggle").onclick = flipTheme; +setTheme(document.documentElement.dataset.theme || "light", false); +matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (e) => { + let saved = null; + try { saved = localStorage.getItem("strata.theme"); } catch (err) { /* ignore */ } + if (!saved) setTheme(e.matches ? "dark" : "light", false); +}); let tab = "chat"; function showTab(name) { diff --git a/serve/web/fonts/OFL.txt b/serve/web/fonts/OFL.txt new file mode 100644 index 00000000..723cd447 --- /dev/null +++ b/serve/web/fonts/OFL.txt @@ -0,0 +1,93 @@ +Copyright 2021 The Outfit Project Authors (https://github.com/Outfitio/Outfit-Fonts) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/serve/web/fonts/outfit-latin-ext-wght.woff2 b/serve/web/fonts/outfit-latin-ext-wght.woff2 new file mode 100644 index 00000000..c54ceec8 Binary files /dev/null and b/serve/web/fonts/outfit-latin-ext-wght.woff2 differ diff --git a/serve/web/fonts/outfit-latin-wght.woff2 b/serve/web/fonts/outfit-latin-wght.woff2 new file mode 100644 index 00000000..85e3332e Binary files /dev/null and b/serve/web/fonts/outfit-latin-wght.woff2 differ diff --git a/serve/web/tokens.css b/serve/web/tokens.css index 310cfee2..a96ce6c5 100644 --- a/serve/web/tokens.css +++ b/serve/web/tokens.css @@ -2,14 +2,13 @@ Light is default; dark via . Values marked (derived) are not in the Gainsty source and were added for the app. */ -@font-face{font-family:"GT Walsheim Pro";src:url("/fonts/GTWalsheimPro-Regular.woff2") format("woff2");font-weight:400;font-display:swap} -@font-face{font-family:"GT Walsheim Pro";src:url("/fonts/GTWalsheimPro-Medium.woff2") format("woff2");font-weight:500;font-display:swap} -@font-face{font-family:"GT Walsheim Pro";src:url("/fonts/GTWalsheimPro-Bold.woff2") format("woff2");font-weight:700;font-display:swap} -@font-face{font-family:"GT Walsheim Pro";src:url("/fonts/GTWalsheimPro-Black.woff2") format("woff2");font-weight:900;font-display:swap} +/* Outfit (SIL Open Font License 1.1, serve/web/fonts/OFL.txt): one variable font, weights 100-900 */ +@font-face{font-family:"Outfit";src:url("/fonts/outfit-latin-wght.woff2") format("woff2-variations");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD} +@font-face{font-family:"Outfit";src:url("/fonts/outfit-latin-ext-wght.woff2") format("woff2-variations");font-weight:100 900;font-display:swap;unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF} :root{ /* type */ - --st-font:"GT Walsheim Pro",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; + --st-font:"Outfit",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; --st-font-mono:ui-monospace,"SF Mono","Cascadia Code",Consolas,"Liberation Mono",monospace; /* (derived) */ --st-fs-xs:12px; --st-fs-sm:13px; --st-fs-md:14px; --st-fs-base:16px; --st-fs-lg:18px; --st-fs-xl:24px; --st-fs-stat:32px; --st-fs-display:40px; diff --git a/setup.py b/setup.py index 0e9f8394..7111b41d 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ PREBUILT_ASSET = "strata-windows-x64.zip" if WIN else "strata-linux-x64.zip" # the CUDA libraries the ready-made engine loads (the same CUDA 13.0 it is built with), from NVIDIA's pip packages CUDA_WHEELS = ["nvidia-cublas==13.0.2.14", "nvidia-cuda-runtime==13.0.96"] MIN_DRIVER = 580 # CUDA 13.0 -MIN_ENGINE = (0, 1, 7) # per-request sampling on the GEN line (the server sends it), v0.1.7 +MIN_ENGINE = (0, 1, 8) # --kv q4_0 and the INFO line (the web app's Monitor), v0.1.8 PY_PACKAGES = ["numpy", "jinja2", "regex", "pyyaml", "tqdm", "requests", "cmake", "ninja", "pillow", "psutil"] MODELS = {