Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm loading a couple pieces like this in my frontend, mostly to use .fromReadableStream. It works when in dev mode (nextjs) but when I build I get an error about Audio already being declared in the app console. I'm not using anything with "audio" so I'm going to guess it's the way I'm loading them that's either causing it to load twice or there's something else going on. #552

Open
a2thek26 opened this issue Dec 5, 2023 · 2 comments

Comments

@a2thek26
Copy link

a2thek26 commented Dec 5, 2023

I'm loading a couple pieces like this in my frontend, mostly to use .fromReadableStream. It works when in dev mode (nextjs) but when I build I get an error about Audio already being declared in the app console. I'm not using anything with "audio" so I'm going to guess it's the way I'm loading them that's either causing it to load twice or there's something else going on.

import { APIUserAbortError } from 'openai';
import { ChatCompletionStream } from 'openai/lib/ChatCompletionStream';

I'm loading the abort error to handle when the stream gets aborted.

Originally posted by @a2thek26 in #182 (comment)

@rattrayalex
Copy link
Collaborator

rattrayalex commented Dec 5, 2023

Thanks.

As a workaround, can you try importing the error class directly from the file it's declared in, or just checking error.name === 'APIUserAbortError'?

@rattrayalex
Copy link
Collaborator

cc @kenjam97 who reported:

Also seeing this same error when I build (nextjs), no issues in dev mode at all, only in production

Could you try either workaround?

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

No branches or pull requests

2 participants