transitive-bullshit / agentic

AI agent stdlib that works with any LLM and TypeScript AI SDK.
https://agentic.so
MIT License
16.22k stars 2.12k forks source link

Why does the returned content often contain '�' #573

Closed ShingWalker closed 3 months ago

ShingWalker commented 1 year ago

Verify latest release

Verify webapp is working

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);
        }
      },
    });
transitive-bullshit commented 3 months ago

This project is undergoing a major revamp; closing out old issues as part of the prep process.

The chatgpt package is pretty outdated at this point. I recommend that you use the openai package or the openai-fetch package instead.