From c06fff01cd370521a23bbc47c0c9d308ae8c5482 Mon Sep 17 00:00:00 2001 From: Youzini-afk <13153778771cx@gmail.com> Date: Fri, 27 Mar 2026 14:27:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8F=90=E7=A4=BA=E7=AA=97=E6=B5=81?= =?UTF-8?q?=E5=BC=8F=E9=A2=84=E8=A7=88=E6=94=B9=E4=B8=BA=E5=8D=95=E8=A1=8C?= =?UTF-8?q?marquee=E6=BB=9A=E5=8A=A8=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 22 +++++++++++++--------- notice.js | 16 ++++++++++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/index.js b/index.js index f6e377f..5402714 100644 --- a/index.js +++ b/index.js @@ -493,6 +493,7 @@ function updateStageNotice( level: noticeLevel, busy, persist, + marquee: options.noticeMarquee ?? false, duration_ms: options.duration_ms ?? getStageNoticeDuration(noticeLevel), action: options.action === undefined @@ -1085,7 +1086,7 @@ function setLastExtractionStatus( text, meta, level = "info", - { syncRuntime = true, toastKind = "", toastTitle = "ST-BME 提取" } = {}, + { syncRuntime = true, toastKind = "", toastTitle = "ST-BME 提取", noticeMarquee = false } = {}, ) { lastExtractionStatus = createUiStatus(text, meta, level); if (syncRuntime) { @@ -1095,6 +1096,7 @@ function setLastExtractionStatus( } updateStageNotice("extraction", text, meta, level, { title: toastTitle, + noticeMarquee, }); if (toastKind) { notifyStatusToast( @@ -1135,7 +1137,7 @@ function setLastRecallStatus( text, meta, level = "info", - { syncRuntime = true, toastKind = "", toastTitle = "ST-BME 召回" } = {}, + { syncRuntime = true, toastKind = "", toastTitle = "ST-BME 召回", noticeMarquee = false } = {}, ) { lastRecallStatus = createUiStatus(text, meta, level); if (syncRuntime) { @@ -1145,6 +1147,7 @@ function setLastRecallStatus( } updateStageNotice("recall", text, meta, level, { title: toastTitle, + noticeMarquee, }); if (toastKind) { notifyStatusToast( @@ -2968,13 +2971,14 @@ async function executeExtractionBatch({ settings, signal, onStreamProgress: ({ previewText, receivedChars }) => { - const preview = previewText?.length > 80 - ? "…" + previewText.slice(-80) + const preview = previewText?.length > 60 + ? "…" + previewText.slice(-60) : previewText || ""; setLastExtractionStatus( "AI 生成中", - `${preview}\n已接收 ${receivedChars} 字符`, + `${preview} [${receivedChars}字]`, "running", + { noticeMarquee: true }, ); }, }); @@ -3748,14 +3752,14 @@ async function runRecall(options = {}) { signal: recallSignal, settings, onStreamProgress: ({ previewText, receivedChars }) => { - const preview = previewText?.length > 80 - ? "…" + previewText.slice(-80) + const preview = previewText?.length > 60 + ? "…" + previewText.slice(-60) : previewText || ""; setLastRecallStatus( "AI 生成中", - `${preview}\n已接收 ${receivedChars} 字符`, + `${preview} [${receivedChars}字]`, "running", - { syncRuntime: true }, + { syncRuntime: true, noticeMarquee: true }, ); }, options: { diff --git a/notice.js b/notice.js index 8df3e78..19e7e20 100644 --- a/notice.js +++ b/notice.js @@ -115,6 +115,17 @@ function ensureStyle(doc) { word-break: break-word; } + .st-bme-notice__message--marquee { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace; + font-size: 12.5px; + color: rgba(240, 246, 255, 0.72); + mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 88%, transparent 100%); + -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 88%, transparent 100%); + } + .st-bme-notice__actions { display: flex; gap: 8px; @@ -285,6 +296,11 @@ function applyNoticeState(item, input, progress) { const message = item.querySelector(".st-bme-notice__message"); if (message) { message.textContent = input.message || ""; + if (input.marquee) { + message.classList.add("st-bme-notice__message--marquee"); + } else { + message.classList.remove("st-bme-notice__message--marquee"); + } } const actionWrap = item.querySelector(".st-bme-notice__actions");