As noted in https://github.com/cloudflare/workerd/issues/2470 - the response type from env.AI.run with (in my case) @cf/bytedance/stable-diffusion-xl-lightning claims it should return a UInt8Array, but actually returns a ReadableStream.
This is fine when feeding it into a new Response() and returning, but is problematic when trying to use the data in other ways.
You can replicate this with the example model usage here
As noted in https://github.com/cloudflare/workerd/issues/2470 - the response type from
env.AI.run
with (in my case)@cf/bytedance/stable-diffusion-xl-lightning
claims it should return a UInt8Array, but actually returns a ReadableStream.This is fine when feeding it into a
new Response()
and returning, but is problematic when trying to use the data in other ways.You can replicate this with the example model usage here