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

Function finishRenderOnlyToolResultBlocks

src/stores/aiChatChartBlocks.ts:206–221  ·  view source on GitHub ↗
(
  blocks: readonly T[],
  toolName: string | undefined,
  toolCallId: string | undefined,
  charts: ChartPayload[],
  errorBlock: RenderOnlyToolErrorBlock | null
)

Source from the content-addressed store, hash-verified

204}
205
206export function finishRenderOnlyToolResultBlocks<T>(
207 blocks: readonly T[],
208 toolName: string | undefined,
209 toolCallId: string | undefined,
210 charts: ChartPayload[],
211 errorBlock: RenderOnlyToolErrorBlock | null
212): Array<T | ChartContentBlock | RenderOnlyToolErrorBlock> {
213 // render-only 工具的 pending 行只用于流式占位;如果没有生成图表,也没有需要展示的错误,就应直接移除。
214 if (charts.length > 0) {
215 return replaceRenderOnlyToolPendingBlockWithCharts(blocks, toolName, toolCallId, charts)
216 }
217
218 const withoutPending = removeRenderOnlyToolPendingBlock(blocks, toolName, toolCallId)
219 if (errorBlock) return [...withoutPending, errorBlock]
220 return withoutPending
221}
222
223export function shouldHideRecoverableChartError(
224 blocks: readonly unknown[],

Callers 2

Tested by

no test coverage detected