mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
feat: 提示窗流式预览改为单行marquee滚动显示
This commit is contained in:
22
index.js
22
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: {
|
||||
|
||||
16
notice.js
16
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");
|
||||
|
||||
Reference in New Issue
Block a user