partykit / partykit-nextjs-chat-template

Next.js template for building a real-time chat application using PartyKit
https://partykit-nextjs-chat-template.vercel.app
MIT License
72 stars 26 forks source link

first run report #9

Open jchris opened 8 months ago

jchris commented 8 months ago

I just picked this up for a potential project and hit a couple of rough spots, thought it better to share:

A promise rejection was handled asynchronously. This warning occurs when attaching a catch handler to a promise after it rejected. (rejection #1)
A promise rejection was handled asynchronously. This warning occurs when attaching a catch handler to a promise after it rejected. (rejection #4)

User chat messages work, so I guess this is an AI integration thing. After another user message I see:

A promise rejection was handled asynchronously. This warning occurs when attaching a catch handler to a promise after it rejected. (rejection #5)
A promise rejection was handled asynchronously. This warning occurs when attaching a catch handler to a promise after it rejected. (rejection #8)

Sorry there's no pull request. The thing I'm building might make more sense to do partykit init on my existing UI anyway.

jchris commented 8 months ago

I chased the anonymous promise failure down to

  const stream = OpenAIStream(openaiResponse, {
    onStart: async () => onStartCallback(),
    onToken: async (token) => onTokenCallback(token),
  });

and neither of those callbacks get called. also this doesn't log:

  // @ts-ignore
  for await (const _ of stream) {
    // no-op, just read the stream, onToken callback above will handle the tokens
    console.log("stream", _);
  }
threepointone commented 8 months ago

great catch, thank you! I'll have a look later this week.