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

Function formatTranscriptWithSummarization

src/commands/insights.ts:912–945  ·  view source on GitHub ↗
(
  log: LogOption,
)

Source from the content-addressed store, hash-verified

910}
911
912async function formatTranscriptWithSummarization(
913 log: LogOption,
914): Promise<string> {
915 const fullTranscript = formatTranscriptForFacets(log)
916
917 // If under 30k chars, use as-is
918 if (fullTranscript.length <= 30000) {
919 return fullTranscript
920 }
921
922 // For long transcripts, split into chunks and summarize in parallel
923 const CHUNK_SIZE = 25000
924 const chunks: string[] = []
925
926 for (let i = 0; i < fullTranscript.length; i += CHUNK_SIZE) {
927 chunks.push(fullTranscript.slice(i, i + CHUNK_SIZE))
928 }
929
930 // Summarize all chunks in parallel
931 const summaries = await Promise.all(chunks.map(summarizeTranscriptChunk))
932
933 // Combine summaries with session header
934 const meta = logToSessionMeta(log)
935 const header = [
936 `Session: ${meta.session_id.slice(0, 8)}`,
937 `Date: ${meta.start_time}`,
938 `Project: ${meta.project_path}`,
939 `Duration: ${meta.duration_minutes} min`,
940 `[Long session - ${chunks.length} parts summarized]`,
941 '',
942 ].join('\n')
943
944 return header + summaries.join('\n\n---\n\n')
945}
946
947async function loadCachedFacets(
948 sessionId: string,

Callers 1

extractFacetsFromAPIFunction · 0.85

Calls 2

logToSessionMetaFunction · 0.85

Tested by

no test coverage detected