标题: ChatGPT API连续对话的原理是每次都发送完整的历史记录给服务器
时间: 2023-03-09发布,2023-03-09修改
所以实际上可以伪造对话过程,它也能据此给出最终的“正确答案”。
『回复列表(16|隐藏机器人聊天)』
API也是传一个会话ID,我是从这个库 https://github.com/transitive-bullshit/chatgpt-api 猜测的,因为这个库需要上下文对话则传parentMessageId,  根据 https://www.v2ex.com/t/921809 贴,即使使用parentMessageId也会导致token倍增,所以如果要对接api则需要为token设置上限和定时清理。
红米K30 Pro(变焦版)
{
   "id":"chatcmpl-abc123",
   "object":"chat.completion",
   "created":1677858242,
   "model":"gpt-3.5-turbo-0301",
   "usage":{
      "prompt_tokens":13,
      "completion_tokens":7,
      "total_tokens":20
   },
   "choices":[
      {
         "message":{
            "role":"assistant",
            "content":"\n\nThis is a test!"
         },
         "finish_reason":"stop",
         "index":0
      }
   ]
}