3

0319 - 小程序中实现 ChatGPT 的流式响应

 1 year ago
source link: https://atjason.com/daily/2023-03-19.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

0319 - 小程序中实现 ChatGPT 的流式响应

2023-03-19

| 每天写一点

要在小程序中实现 ChatGPT 的流式响应,还挺麻烦,涉及的环节比较多:

  • 小程序 wx.request 中开启 enableChunked;

  • 请求 OpenAI 接口时,开启 stream;

  • Axios 指定返回类型为 stream;

  • nginx 服务器配置中,开启 chunked_transfer_encoding,关闭 proxy_buffering


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK