fujohnwang / afoo.me.comments

2 stars 0 forks source link

如何构建OpenAI API代理? - 扶墙老师说:一个架构士的思考与沉淀 #136

Open fujohnwang opened 1 year ago

fujohnwang commented 1 year ago

https://afoo.me/posts/2023-03-06-proxy-openai.html

如何构建OpenAI API代理? - 扶墙老师说,王福强的个人博客, 一个架构士的思考与沉淀

nogeek-cn commented 1 year ago

用的 cloudflare worker 的服务器,完完全全的 copy 进去, 现在发现调用的时候出错了。


  "max_tokens": 150,
  "top_p": 1,
  "frequency_penalty": 0.0,
  "presence_penalty": 0.6,
  "stop": [" Human:", " AI:"]
}'
TypeError: Request with a GET or HEAD method cannot have a body.
    at Object.fetch (worker.js:5:20)%    

这个是什么原因导致的,知道吗???

fujohnwang commented 1 year ago

@Darian1996 用的 cloudflare worker 的服务器,完完全全的 copy 进去, 现在发现调用的时候出错了。


  "max_tokens": 150,
  "top_p": 1,
  "frequency_penalty": 0.0,
  "presence_penalty": 0.6,
  "stop": [" Human:", " AI:"]
}'
TypeError: Request with a GET or HEAD method cannot have a body.
    at Object.fetch (worker.js:5:20)%    

这个是什么原因导致的,知道吗???

面试的时候,基础技能扣分,哈哈哈 报错信息写的挺清楚了,你调用的时候请求格式不对

nogeek-cn commented 1 year ago

这里已经是 POST 请求了。还是报错了。。。

image

fujohnwang commented 1 year ago

@Darian1996 这里已经是 POST 请求了。还是报错了。。。

image

哈哈,我这给你在线trouble shooting呢 我不知道你用的什么工具,也有可能是工具的问题,我习惯用curl测试这些东西,你换个工具试试。

BTW. GET和HEAD请求是没有Body的,这是HTTP协议的基本常识。