MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / topicDivider

Function topicDivider

graph-ui/src/browser-ai/chat-context.ts:35–41  ·  view source on GitHub ↗
(turns: readonly BrowserChatTurn[], index: number)

Source from the content-addressed store, hash-verified

33/** The divider above turn `index`: "new" for the first turn about another topic, "back" for
34 * a topic that has earlier turns, nothing within a topic (B4). */
35export function topicDivider(turns: readonly BrowserChatTurn[], index: number): 'new' | 'back' | undefined {
36 const topic = turns[index]?.topic;
37 if (!topic || index === 0) return undefined;
38 const earlier = turns.slice(0, index);
39 if ([...earlier].reverse().find(item => item.topic)?.topic?.key === topic.key) return undefined;
40 return earlier.some(item => item.topic?.key === topic.key) ? 'back' : 'new';
41}
42
43/** Follow-ups that ask nothing of their own: they continue the answer before (B4). */
44const FOLLOW_UPS = new Set(['und', 'and', 'mehr', 'more', 'noch mehr', 'und mehr', 'and more', 'mehr davon', 'more of that', 'mehr details', 'more details', 'details',

Callers 2

BrowserChatDockFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected