feat: 提示窗流式预览改为单行marquee滚动显示

This commit is contained in:
Youzini-afk
2026-03-27 14:27:18 +08:00
parent b1c9a5221f
commit c06fff01cd
2 changed files with 29 additions and 9 deletions

View File

@@ -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: {

View File

@@ -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");