MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / appendPlanDraftDelta

Function appendPlanDraftDelta

src/services/ai/planBlocks.ts:49–61  ·  view source on GitHub ↗
(
  blocks: readonly T[],
  delta: string
)

Source from the content-addressed store, hash-verified

47}
48
49export function appendPlanDraftDelta<T extends BlockWithType>(
50 blocks: readonly T[],
51 delta: string
52): Array<T | PlanDraftContentBlock> {
53 const nextBlocks = blocks.map(cloneBlock) as Array<T | PlanDraftContentBlock>
54 const lastBlock = nextBlocks[nextBlocks.length - 1]
55 if (isPlanDraftBlock(lastBlock)) {
56 lastBlock.text += delta
57 } else {
58 nextBlocks.push({ type: 'plan_draft', version: 1, status: 'streaming', text: delta })
59 }
60 return nextBlocks
61}
62
63export function replacePlanDraftWithPlan<T extends BlockWithType>(
64 blocks: readonly T[],

Callers 2

appendPlanDraftToBlocksFunction · 0.90
planBlocks.test.tsFile · 0.90

Calls 1

isPlanDraftBlockFunction · 0.85

Tested by

no test coverage detected