Skip to content

fix(tools): read text parts from OpenAI array message content - #1465

Open
su6u wants to merge 1 commit into
supermemoryai:mainfrom
su6u:fix/openai-array-content
Open

fix(tools): read text parts from OpenAI array message content#1465
su6u wants to merge 1 commit into
supermemoryai:mainfrom
su6u:fix/openai-array-content

Conversation

@su6u

@su6u su6u commented Aug 13, 2026

Copy link
Copy Markdown

Summary

OpenAI chat content can be a string or an array of parts (text, image, etc). The middleware only treated strings as a real user message, so anything like:

[{ type: "text", text: "I prefer bun" }, { type: "image_url", ... }]

came through as empty.

That meant query/full skipped memory search, and addMemory: "always" skipped saving the turn. String-only chats were fine.

Same file already unwraps text parts when posting to /v4/conversations. Vercel and VoltAgent already do this too. This just does the same for the OpenAI chat path.

Test plan

  • unit tests in packages/tools/src/openai/middleware.test.ts (string, array+image, multiple text parts, image-only, save path)
  • biome on the two changed files

No breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant