partykit/partykit-nextjs-chat-template

first run report

Opened this issue · 2 comments

jchris commented

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

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", _);
  }

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