ai
ai copied to clipboard
Reject non-image chat file parts in workers-ai-provider
Summary
- validate Workers AI chat
fileparts have animage/*media type before converting them toimage_url - preserve the provided image media type instead of defaulting missing media types to
image/png - add regression tests and a changeset for the published provider
Fixes #541.
Testing
COREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack pnpm --filter workers-ai-provider exec vitest test/convert-to-workersai-chat-messages.test.ts --runCOREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack pnpm --filter workers-ai-provider run type-checkCOREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack pnpm --filter workers-ai-provider run buildCOREPACK_ENABLE_DOWNLOAD_PROMPT=0 corepack pnpm lint
🦋 Changeset detected
Latest commit: 7fd870bcc1ad0900cc409e46c89d4f2afd755612
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| workers-ai-provider | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
npx https://pkg.pr.new/cloudflare/ai/ai-gateway-provider@563
npx https://pkg.pr.new/cloudflare/ai/@cloudflare/tanstack-ai@563
npx https://pkg.pr.new/cloudflare/ai/workers-ai-provider@563
commit: 7fd870b