tiktoken icon indicating copy to clipboard operation
tiktoken copied to clipboard

Raise error when concurrent to call new Tiktoken

Open qkxie opened this issue 1 year ago • 2 comments

The context code is https://github.com/mckaywrigley/chatbot-ui/blob/main/pages/api/chat.ts#L21

The key problem is here:

image

In my frontend, I use promise.all to send 3 requests simultaneously to this backend API. I have noticed the following phenomena:

  1. When running this backend with "npm run dev", everything works fine.
  2. When running with "npm run build" and then "npm run start":
  3. If I make a separate request to this API after the backend is started, and then the frontend sends concurrent requests, everything works fine.
  4. If the frontend immediately sends concurrent requests to this backend API after it is started, it will result in the error shown in the image below.

2b5fa8a7d35d5eb70f80a5c261bf0fdb

qkxie avatar Sep 12 '23 05:09 qkxie