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

Function setMessages

src/session/applyLocalQueryEvent.test.ts:278–293  ·  view source on GitHub ↗
(action: SetStateAction<unknown[]>)

Source from the content-addressed store, hash-verified

276 let state: Snapshot = { messages: [], streamingText: null }
277
278 const setMessages = (action: SetStateAction<unknown[]>) => {
279 const nextMessages =
280 typeof action === 'function'
281 ? (action as (prev: unknown[]) => unknown[])(state.messages)
282 : action
283
284 const messagesChanged = nextMessages !== state.messages
285 const nextStreamingText =
286 messagesChanged && state.streamingText !== null ? null : state.streamingText
287
288 state = {
289 messages: nextMessages,
290 streamingText: nextStreamingText,
291 }
292 history.push({ ...state })
293 }
294
295 const onStreamingText = (f: (current: string | null) => string | null) => {
296 const next = f(state.streamingText)

Callers 8

onDoneFunction · 0.70
applyLocalQueryEventFunction · 0.70
REPLFunction · 0.50
appendStdoutFunction · 0.50
handleSpeculationAcceptFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected