mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 19:43:15 +00:00
11 lines
321 B
TypeScript
11 lines
321 B
TypeScript
|
|
import { MessageContent } from "@langchain/core/messages";
|
||
|
|
|
||
|
|
export function getMessageContentString(content: MessageContent): string {
|
||
|
|
if (typeof content === "string") return content;
|
||
|
|
|
||
|
|
return content
|
||
|
|
.filter((c): c is { type: "text"; text: string } => c.type === "text")
|
||
|
|
.map((c) => c.text)
|
||
|
|
.join(" ");
|
||
|
|
}
|