chore: update story summary and lint fixes
This commit is contained in:
@@ -90,7 +90,7 @@ import { exportVectors, importVectors } from "./vector/storage/vector-io.js";
|
||||
const MODULE_ID = "storySummary";
|
||||
const SUMMARY_CONFIG_KEY = "storySummaryPanelConfig";
|
||||
const iframePath = `${extensionFolderPath}/modules/story-summary/story-summary.html`;
|
||||
const VALID_SECTIONS = ["keywords", "events", "characters", "arcs", "world"];
|
||||
const VALID_SECTIONS = ["keywords", "events", "characters", "arcs", "facts"];
|
||||
const MESSAGE_EVENT = "message";
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
@@ -236,7 +236,6 @@ async function sendVectorStatsToFrame() {
|
||||
const stats = await getStorageStats(chatId);
|
||||
const chunkStatus = await getChunkBuildStatus();
|
||||
const totalMessages = chat?.length || 0;
|
||||
const stateAtomsCount = getStateAtomsCount();
|
||||
const stateVectorsCount = await getStateVectorsCount(chatId);
|
||||
|
||||
const cfg = getVectorConfig();
|
||||
@@ -256,7 +255,6 @@ async function sendVectorStatsToFrame() {
|
||||
builtFloors: chunkStatus.builtFloors,
|
||||
totalFloors: chunkStatus.totalFloors,
|
||||
totalMessages,
|
||||
stateAtoms: stateAtomsCount,
|
||||
stateVectors: stateVectorsCount,
|
||||
},
|
||||
mismatch,
|
||||
@@ -265,7 +263,8 @@ async function sendVectorStatsToFrame() {
|
||||
|
||||
async function sendAnchorStatsToFrame() {
|
||||
const stats = await getAnchorStats();
|
||||
postToFrame({ type: "ANCHOR_STATS", stats });
|
||||
const atomsCount = getStateAtomsCount();
|
||||
postToFrame({ type: "ANCHOR_STATS", stats: { ...stats, atomsCount } });
|
||||
}
|
||||
|
||||
async function handleAnchorGenerate() {
|
||||
@@ -290,10 +289,15 @@ async function handleAnchorGenerate() {
|
||||
postToFrame({ type: "ANCHOR_GEN_PROGRESS", current: 0, total: 1, message: "分析中..." });
|
||||
|
||||
try {
|
||||
// Phase 1: L0 提取 + Phase 2: L0 向量化(在 incrementalExtractAtoms 内部完成)
|
||||
await incrementalExtractAtoms(chatId, chat, (message, current, total) => {
|
||||
postToFrame({ type: "ANCHOR_GEN_PROGRESS", current, total, message });
|
||||
});
|
||||
|
||||
// Phase 3: 处理 pending L1 Chunks
|
||||
postToFrame({ type: "ANCHOR_GEN_PROGRESS", current: 0, total: 1, message: "向量化 L1..." });
|
||||
await buildIncrementalChunks({ vectorConfig: vectorCfg });
|
||||
|
||||
await sendAnchorStatsToFrame();
|
||||
await sendVectorStatsToFrame();
|
||||
|
||||
@@ -1212,9 +1216,11 @@ async function handleChatChanged() {
|
||||
if (frameReady) {
|
||||
await sendFrameBaseData(store, newLength);
|
||||
sendFrameFullData(store, newLength);
|
||||
|
||||
sendAnchorStatsToFrame();
|
||||
sendVectorStatsToFrame();
|
||||
}
|
||||
|
||||
// 检测向量完整性并提醒(仅提醒,不自动操作)
|
||||
setTimeout(() => checkVectorIntegrityAndWarn(), 2000);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user