mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Make clear hide unhide the full chat
This commit is contained in:
@@ -246,10 +246,13 @@ function buildResult({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unhideCurrentRange(runtime = {}, version = null) {
|
async function unhideCurrentRange(runtime = {}, version = null, options = {}) {
|
||||||
const { chat } = getCurrentChatInfo(runtime);
|
const { chat } = getCurrentChatInfo(runtime);
|
||||||
const chatLength = Array.isArray(chat) ? chat.length : 0;
|
const chatLength = Array.isArray(chat) ? chat.length : 0;
|
||||||
const previousEnd = Math.min(hideState.hiddenRangeEnd, chatLength - 1);
|
const full = Boolean(options.full);
|
||||||
|
const previousEnd = full
|
||||||
|
? Math.max(-1, chatLength - 1)
|
||||||
|
: Math.min(hideState.hiddenRangeEnd, chatLength - 1);
|
||||||
if (previousEnd < 0) {
|
if (previousEnd < 0) {
|
||||||
return { shownCount: 0, chatLength };
|
return { shownCount: 0, chatLength };
|
||||||
}
|
}
|
||||||
@@ -425,14 +428,16 @@ export async function unhideAll(runtime = {}) {
|
|||||||
const chatInfo = getCurrentChatInfo(runtime);
|
const chatInfo = getCurrentChatInfo(runtime);
|
||||||
const chatLength = Array.isArray(chatInfo.chat) ? chatInfo.chat.length : 0;
|
const chatLength = Array.isArray(chatInfo.chat) ? chatInfo.chat.length : 0;
|
||||||
|
|
||||||
if (chatLength === 0 || hideState.hiddenRangeEnd < 0) {
|
if (chatLength === 0) {
|
||||||
hideState.lastProcessedLength = chatLength;
|
hideState.lastProcessedLength = chatLength;
|
||||||
hideState.hiddenRangeEnd = -1;
|
hideState.hiddenRangeEnd = -1;
|
||||||
hideState.managedChatKey = getCurrentChatKey(runtime);
|
hideState.managedChatKey = getCurrentChatKey(runtime);
|
||||||
return buildResult({ chatLength });
|
return buildResult({ chatLength });
|
||||||
}
|
}
|
||||||
|
|
||||||
const { shownCount } = await unhideCurrentRange(runtime, version);
|
const { shownCount } = await unhideCurrentRange(runtime, version, {
|
||||||
|
full: true,
|
||||||
|
});
|
||||||
if (!isOperationCurrent(version)) {
|
if (!isOperationCurrent(version)) {
|
||||||
return buildResult({ chatLength, shownCount, stale: true });
|
return buildResult({ chatLength, shownCount, stale: true });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ async function testDisableUnhidesManagedRange() {
|
|||||||
|
|
||||||
const result = await unhideAll(runtime);
|
const result = await unhideAll(runtime);
|
||||||
assert.equal(result.active, false);
|
assert.equal(result.active, false);
|
||||||
assert.equal(result.shownCount, 3);
|
assert.equal(result.shownCount, 4);
|
||||||
assert.deepEqual(runtime.commands, ["/unhide 0-2"]);
|
assert.deepEqual(runtime.commands, ["/unhide 0-3"]);
|
||||||
assert.equal(chat[0].is_system, true);
|
assert.equal(chat[0].is_system, true);
|
||||||
assert.equal(chat[1].is_system, false);
|
assert.equal(chat[1].is_system, false);
|
||||||
assert.equal(chat[2].is_system, false);
|
assert.equal(chat[2].is_system, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user