MCPcopy
hub / github.com/HKUDS/DeepTutor / SmoothStreamOptions

Interface SmoothStreamOptions

web/hooks/useSmoothStreamText.ts:5–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import { useEffect, useRef, useState } from "react";
4
5interface SmoothStreamOptions {
6 /**
7 * Cap on visible chars revealed per rAF frame.
8 * The reveal speed adapts to the current backlog so a long pause that
9 * suddenly delivers a 2KB chunk doesn't take 30 seconds to type out:
10 * each frame reveals max(MIN_CHARS_PER_FRAME, backlog / catchUpDivisor),
11 * up to ``maxCharsPerFrame``.
12 */
13 maxCharsPerFrame?: number;
14 /** Minimum chars revealed per frame so the cursor always advances. */
15 minCharsPerFrame?: number;
16 /** Larger = slower reveal relative to backlog. ~5 feels natural. */
17 catchUpDivisor?: number;
18 /**
19 * When ``false``, the hook is a pass-through: the smoother is disabled
20 * and ``displayContent`` always equals ``content``. Useful so callers
21 * can keep the same render path for both streaming and idle messages.
22 */
23 enabled?: boolean;
24}
25
26/**
27 * Decouples the visible markdown growth rate from the WebSocket delta

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected