open-swe/packages/shared/src/messages.ts
Brace Sproul df182b676b
fix: bug with checking out the branch during followups (#679)
* fix: bug with checking out the branch during followups

* cr

* cr

* cr

* cr
2025-08-06 16:41:11 +00:00

16 lines
487 B
TypeScript

import { MessageContent } from "@langchain/core/messages";
export function getMessageContentString(content: MessageContent): string {
try {
if (typeof content === "string") return content;
return content
.filter((c): c is { type: "text"; text: string } => c.type === "text")
.map((c) => c.text)
.join(" ");
} catch (error) {
// eslint-disable-next-line no-console
console.error("Failed to get message content string", error);
return "";
}
}