0

我正在尝试参考https://beta.openai.com/docs/api-reference/files/upload将文件上传到 openai 服务器。

根据curl的例子,流程是:

    curl https://api.openai.com/v1/files \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -F purpose="answers" \
      -F file='@puppy.jsonl'

当我尝试使用它上传 jsonl 文件“test.jsonl”以在基于 Web 的聊天机器人上发出 HTTP 请求时,

我填写了下面的空白:

    Request URL: https://api.openai.com/v1/files
    Method :POST
    Content Type : Form 
    
    Data
    purpose: answers
    file: @/C:/users/annie/Desktop/test.jsonl

    Headers
    Authorization:Bearer MY_OWN_API_KEY_WRITTEN_HERE

但是,当我测试聊天机器人控制台时,我不断收到如下错误消息:

Status Code
400
Body
{
  "error": {
    "code": null,
    "message": "The browser (or proxy) sent a request that this server could not understand.",
    "param": null,
    "type": "server_error"
  }
}
Data
{
  "error": {
    "code": null,
    "message": "The browser (or proxy) sent a request that this server could not understand.",
    "param": null,
    "type": "server_error"
  }
}

我想知道如何修改http请求以从我的本地计算机/在线成功上传文件。谢谢

4

0 回答 0