Fix: incremental space summary

This commit is contained in:
Manoj 2025-09-04 10:19:35 +05:30
parent ba53605572
commit 5b8f13558c

View File

@ -292,7 +292,7 @@ async function generateSpaceSummary(
spaceId: space.uuid,
spaceName: space.name,
spaceDescription: space.description as string,
statementCount: statements.length,
statementCount: existingSummary?.statementCount ? existingSummary?.statementCount + statements.length : statements.length,
summary: summaryResult.summary,
keyEntities: summaryResult.keyEntities || [],
themes: summaryResult.themes,
@ -485,6 +485,7 @@ async function getExistingSummary(spaceId: string): Promise<{
summary: string;
themes: string[];
lastUpdated: Date;
statementCount: number;
} | null> {
try {
const existingSummary = await getSpace(spaceId);
@ -493,7 +494,8 @@ async function getExistingSummary(spaceId: string): Promise<{
return {
summary: existingSummary.summary,
themes: existingSummary.themes,
lastUpdated: existingSummary.updatedAt,
lastUpdated: existingSummary.lastPatternTrigger,
statementCount: existingSummary.statementCount,
};
}