transitive-bullshit / chatgpt-api

Node.js client for the official ChatGPT API. 🔥

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why does the returned content often contain '�'

walker-peng22 opened this issue · comments

Verify latest release

  • I verified that the issue exists in the latest chatgpt release

Verify webapp is working

  • I verify that the ChatGPT webapp is working properly for this account.

Environment details

chatgpt: "^5.2.4"
node: v18.15.0
macos

Describe the Bug

I use onProgress to return a stream, but the content often contains '�'. Is the encoding format incorrect?

image

 const res = await this.chatGPTProvider.sendMessage(searchDto.content, {
      systemMessage: '首选用中文回复',
      parentMessageId,
      onProgress: (partialResponse) => {
        if (partialResponse.delta) {
          response.write(partialResponse.delta);
        }
      },
    });