fix: AI reference tab includes all selected chapters regardless of position

This commit is contained in:
YuanShiJiLoong committed 2026-02-26 01:59:49 +09:00
1 parent bdd553a457
commit b5fcf1f17b
2 files changed
+3 -6

No files matched your search

+2 -5
View File
@@ -611,12 +611,9 @@ function buildPreviousContext(chapters, currentIndex) {
}).join('\n\n');
}
// 按 selectedIds 过滤的前文上下文
// 按 selectedIds 过滤的章节上下文(包含用户手动勾选的所有章节,不限前后)
function buildPreviousContextFiltered(chapters, currentIndex, selectedIds) {
if (currentIndex <= 0) return '';
const prevChapters = chapters.slice(0, currentIndex);
const selected = prevChapters.filter(ch => selectedIds.has(`chapter-${ch.id}`));
const selected = chapters.filter((ch, i) => i !== currentIndex && selectedIds.has(`chapter-${ch.id}`));
if (selected.length === 0) return '';
return selected.map((ch) => {
+1 -1
View File
@@ -161,7 +161,7 @@ export default function Home() {
};
loadContext();
}, [activeChapterId, settingsVersion, chatHistory.length]);
}, [activeChapterId, settingsVersion, chatHistory.length, chapters.length]);
// 定时自动存档 (每 15 分钟)
useEffect(() => {