MCPcopy Create free account
hub / github.com/astercloud/aster / handleTextChunk

Function handleTextChunk

ui/src/stores/chat.ts:136–149  ·  view source on GitHub ↗
(messageId: string, delta: string)

Source from the content-addressed store, hash-verified

134 * 处理文本块(高频事件,使用 RAF 批量更新)
135 */
136 const handleTextChunk = (messageId: string, delta: string) => {
137 // 累积文本块
138 const chunks = pendingTextChunks.value.get(messageId) || [];
139 chunks.push(delta);
140 pendingTextChunks.value.set(messageId, chunks);
141
142 // 批量更新(每帧一次)
143 if (rafId === null) {
144 rafId = requestAnimationFrame(() => {
145 flushTextChunks();
146 rafId = null;
147 });
148 }
149 };
150
151 /**
152 * 刷新文本块(批量更新到消息)

Callers

nothing calls this directly

Calls 3

flushTextChunksFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected