MCPcopy Create free account
hub / github.com/SamuelZ12/longcut / createFallbackSegment

Function createFallbackSegment

lib/topic-utils.ts:261–292  ·  view source on GitHub ↗
(transcript: TranscriptSegment[])

Source from the content-addressed store, hash-verified

259}
260
261function createFallbackSegment(transcript: TranscriptSegment[]): TopicSegment | null {
262 if (!transcript.length) return null;
263
264 const startSegment = transcript[0];
265 let endIdx = 0;
266 let endTime = startSegment.start;
267
268 for (let i = 0; i < transcript.length; i++) {
269 endIdx = i;
270 endTime = transcript[i].start + transcript[i].duration;
271 if (endTime - startSegment.start >= 60) {
272 break;
273 }
274 }
275
276 const combinedText = transcript
277 .slice(0, endIdx + 1)
278 .map((segment) => segment.text)
279 .join(' ')
280 .trim();
281
282 return {
283 start: startSegment.start,
284 end: endTime,
285 text: combinedText,
286 startSegmentIdx: 0,
287 endSegmentIdx: endIdx,
288 startCharOffset: 0,
289 endCharOffset: transcript[endIdx].text.length,
290 hasCompleteSentences: false,
291 };
292}
293
294function ensureTranscriptIndex(
295 existingIndex: TranscriptIndex | null,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected