Download ui/web/src/components/AboutTab.svelte from localailb/assistant: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/spaces/localailb/assistant/resolve/main/ui/web/src/components/AboutTab.svelte
- Command line
-
hf download hf://spaces/localailb/assistant/ui/web/src/components/AboutTab.svelte
-
curl -L -o AboutTab.svelte https://huggingface.co/spaces/localailb/assistant/resolve/main/ui/web/src/components/AboutTab.svelte
2.01 kB
| <script> | |
| import { app, t } from "../lib/stores.svelte.js"; | |
| import { fetchAbout, openReports } from "../lib/api.js"; | |
| import { renderMarkdown } from "../lib/enhance.js"; | |
| import "./chat/MessageList.css"; | |
| let content = $state(""); | |
| let flash = $state(""); | |
| let flashErr = $state(false); | |
| async function load() { | |
| try { | |
| const r = await fetchAbout(app.lang); | |
| content = r.content || ""; | |
| } catch { /* keep last */ } | |
| } | |
| // Load on mount, and reload the about text when the language switches. | |
| let loadedLang = ""; | |
| $effect(() => { | |
| if (app.lang !== loadedLang) { | |
| loadedLang = app.lang; | |
| load(); | |
| } | |
| }); | |
| async function doOpen() { | |
| try { | |
| const r = await openReports(); | |
| flash = r.ok ? (r.path ? t("web_opened_path").replace("{path}", r.path) : t("web_opened")) : t("web_open_failed"); | |
| flashErr = !r.ok; | |
| } catch (err) { | |
| flash = err.message; | |
| flashErr = true; | |
| } | |
| } | |
| async function copyAbout() { | |
| if (!content) return; | |
| // Strip HTML tags from the rendered about text for clean clipboard copy. | |
| const text = content.replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/&/g, "&").trim(); | |
| try { | |
| await navigator.clipboard.writeText(text); | |
| flash = t("web_copied"); | |
| flashErr = false; | |
| } catch { | |
| flash = t("web_copy_fail"); | |
| flashErr = true; | |
| } | |
| } | |
| </script> | |
| <div class="tab-scroll"> | |
| <div class="card about-box"> | |
| <div class="rich">{@html renderMarkdown(content)}</div> | |
| </div> | |
| <div class="card"> | |
| <div class="tool-row"> | |
| <button class="btn" onclick={doOpen} data-tooltip={t("info_open_reports")}>{t("btn_open_reports")}</button> | |
| <button class="btn" onclick={copyAbout} disabled={!content} data-tooltip={t("web_tt_copy_all")}>{t("btn_copy_all")}</button> | |
| </div> | |
| <div class="reports-path">📂 {app.meta?.reportBaseDir || ""}</div> | |
| {#if flash} | |
| <div class="tool-flash" class:err={flashErr}>{flash}</div> | |
| {/if} | |
| </div> | |
| </div> | |