MCPcopy Create free account
hub / github.com/Noumena-Network/code / getRecentActivity

Function getRecentActivity

src/utils/logoV2Utils.ts:190–220  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188 * Preloads recent conversations for display in Logo v2
189 */
190export async function getRecentActivity(): Promise<LogOption[]> {
191 // Return existing promise if already loading
192 if (cachePromise) {
193 return cachePromise
194 }
195
196 const currentSessionId = getSessionId()
197 cachePromise = loadMessageLogs(10)
198 .then(logs => {
199 cachedActivity = logs
200 .filter(log => {
201 if (log.isSidechain) return false
202 if (log.sessionId === currentSessionId) return false
203 if (log.summary?.includes('I apologize')) return false
204
205 // Filter out sessions where both summary and firstPrompt are "No prompt" or missing
206 const hasSummary = log.summary && log.summary !== 'No prompt'
207 const hasFirstPrompt =
208 log.firstPrompt && log.firstPrompt !== 'No prompt'
209 return hasSummary || hasFirstPrompt
210 })
211 .slice(0, 3)
212 return cachedActivity
213 })
214 .catch(() => {
215 cachedActivity = []
216 return cachedActivity
217 })
218
219 return cachePromise
220}
221
222/**
223 * Gets cached activity synchronously

Callers 1

setupFunction · 0.85

Calls 2

getSessionIdFunction · 0.85
loadMessageLogsFunction · 0.85

Tested by

no test coverage detected