MCPcopy Create free account
hub / github.com/agegr/pi-web / extractMessageText

Function extractMessageText

hooks/useAgentSession.ts:243–256  ·  view source on GitHub ↗
(message: Partial<AgentMessage>)

Source from the content-addressed store, hash-verified

241}
242
243function extractMessageText(message: Partial<AgentMessage>): string {
244 const content = (message as { content?: unknown }).content;
245 if (typeof content === "string") return content;
246 if (!Array.isArray(content)) return "";
247 return content
248 .map((block) =>
249 block && typeof block === "object"
250 && (block as { type?: string }).type === "text"
251 && typeof (block as { text?: unknown }).text === "string"
252 ? (block as { text: string }).text
253 : "")
254 .filter(Boolean)
255 .join("\n");
256}
257
258function imageSignature(block: unknown): string {
259 if (!block || typeof block !== "object" || (block as { type?: unknown }).type !== "image") return "";

Callers 1

userMessageKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected