fix: patch image typing in new SDK (#36)

This commit is contained in:
Charles Packer
2025-10-29 18:00:41 -07:00
committed by GitHub
parent ab609b682b
commit 5eab6ed648
3 changed files with 4 additions and 3 deletions

View File

@@ -842,6 +842,7 @@ export default function App({
// Start the conversation loop
await processConversation([
{
type: "message",
role: "user",
content: messageContent as unknown as MessageCreate["content"],
},

View File

@@ -106,7 +106,7 @@ export function clearPlaceholdersInText(text: string): void {
// Convert display text (with placeholders) into Letta content parts
// Text placeholders are resolved; image placeholders become image content
type Base64ImageSource = { type: "base64"; mediaType: string; data: string };
type Base64ImageSource = { type: "base64"; media_type: string; data: string };
type ContentPart =
| { type: "text"; text: string }
| { type: "image"; source: Base64ImageSource };
@@ -144,7 +144,7 @@ export function buildMessageContentFromDisplay(text: string): ContentPart[] {
type: "image",
source: {
type: "base64",
mediaType: img.mediaType || "image/jpeg",
media_type: img.mediaType || "image/jpeg",
data: img.data,
},
});

View File

@@ -56,7 +56,7 @@ test("buildMessageContentFromDisplay handles image placeholders", () => {
type: "image",
source: {
type: "base64",
mediaType: "image/png",
media_type: "image/png",
data: "abc123",
},
});