10 lines
333 B
TypeScript
10 lines
333 B
TypeScript
import type { Message } from "@langchain/langgraph-sdk";
|
|
|
|
export function getContentString(content: Message["content"]): string {
|
|
if (typeof content === "string") return content;
|
|
const texts = content
|
|
.filter((c): c is { type: "text"; text: string } => c.type === "text")
|
|
.map((c) => c.text);
|
|
return texts.join(" ");
|
|
}
|