MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / createCachedStreamResponse

Function createCachedStreamResponse

frontend/app/api/chat/route.ts:128–155  ·  view source on GitHub ↗
(xml: string)

Source from the content-addressed store, hash-verified

126
127// Helper function to create cached stream response
128function createCachedStreamResponse(xml: string): Response {
129 const toolCallId = `cached-${Date.now()}`
130
131 const stream = createUIMessageStream({
132 execute: async ({ writer }) => {
133 writer.write({ type: "start" })
134 writer.write({
135 type: "tool-input-start",
136 toolCallId,
137 toolName: "display_diagram",
138 })
139 writer.write({
140 type: "tool-input-delta",
141 toolCallId,
142 inputTextDelta: xml,
143 })
144 writer.write({
145 type: "tool-input-available",
146 toolCallId,
147 toolName: "display_diagram",
148 input: { xml },
149 })
150 writer.write({ type: "finish" })
151 },
152 })
153
154 return createUIMessageStreamResponse({ stream })
155}
156
157// Inner handler function
158async function handleChatRequest(req: Request): Promise<Response> {

Callers 1

handleChatRequestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected