Giter Club home page Giter Club logo

Comments (5)

dqzboy avatar dqzboy commented on July 17, 2024

ChatGPT error 400: {"error":{"code":"json: cannot unmarshal array into Go struct field api_message.messages.content of type string","message":"Request must be proper JSON","param":null,"type":"invalid_request_error"}} image

大佬这个咋处理

发现问题了 不支持携带上下文,关闭上下文就正常了

from aurora.

lingoox avatar lingoox commented on July 17, 2024

你的messages格式错误了,把请求的json贴一下

from aurora.

dqzboy avatar dqzboy commented on July 17, 2024

你的messages格式错误了,把请求的json贴一下

Apr 04 13:29:57 chatgpt pnpm[8996]: sendMessage (70 tokens) {
Apr 04 13:29:57 chatgpt pnpm[8996]:   max_tokens: 1024,
Apr 04 13:29:57 chatgpt pnpm[8996]:   model: 'gpt-3.5-turbo',
Apr 04 13:29:57 chatgpt pnpm[8996]:   temperature: 0.8,
Apr 04 13:29:57 chatgpt pnpm[8996]:   top_p: 1,
Apr 04 13:29:57 chatgpt pnpm[8996]:   presence_penalty: 1,
Apr 04 13:29:57 chatgpt pnpm[8996]:   messages: [
Apr 04 13:29:57 chatgpt pnpm[8996]:     {
Apr 04 13:29:57 chatgpt pnpm[8996]:       role: 'system',
Apr 04 13:29:57 chatgpt pnpm[8996]:       content: 'You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible.\n' +
Apr 04 13:29:57 chatgpt pnpm[8996]:         'Knowledge cutoff: 2021-09-01\n' +
Apr 04 13:29:57 chatgpt pnpm[8996]:         'Current date: 2024-04-04'
Apr 04 13:29:57 chatgpt pnpm[8996]:     },
Apr 04 13:29:57 chatgpt pnpm[8996]:     { role: 'user', content: [ { type: 'text', text: 'hello' } ] },
Apr 04 13:29:57 chatgpt pnpm[8996]:     {
Apr 04 13:29:57 chatgpt pnpm[8996]:       role: 'assistant',
Apr 04 13:29:57 chatgpt pnpm[8996]:       content: 'Hi there! How can I assist you today?'
Apr 04 13:29:57 chatgpt pnpm[8996]:     },
Apr 04 13:29:57 chatgpt pnpm[8996]:     { role: 'user', content: 'hello' }
Apr 04 13:29:57 chatgpt pnpm[8996]:   ],
Apr 04 13:29:57 chatgpt pnpm[8996]:   stream: true
Apr 04 13:29:57 chatgpt pnpm[8996]: }
Apr 04 13:29:57 chatgpt pnpm[8996]: ChatGPTError: ChatGPT error 400: {"error":{"code":"json: cannot unmarshal array into Go struct field api_message.messages.content of type string","message":"Request must be proper JSON","param":null,"type":"invalid_request_error"}}
Apr 04 13:29:57 chatgpt pnpm[8996]:     at fetchSSE (/usr/share/nginx/html/service/node_modules/.pnpm/@[email protected]/node_modules/@chatgptweb/chatgpt-api/src/fetch-sse.ts:27:19)
Apr 04 13:29:57 chatgpt pnpm[8996]:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
Apr 04 13:29:57 chatgpt pnpm[8996]:   statusCode: 400,
Apr 04 13:29:57 chatgpt pnpm[8996]:   statusText: 'Bad Request',
Apr 04 13:29:57 chatgpt pnpm[8996]:   [cause]: Response {
Apr 04 13:29:57 chatgpt pnpm[8996]:     [Symbol(realm)]: null,
Apr 04 13:29:57 chatgpt pnpm[8996]:     [Symbol(state)]: {
Apr 04 13:29:57 chatgpt pnpm[8996]:       aborted: false,
Apr 04 13:29:57 chatgpt pnpm[8996]:       rangeRequested: false,
Apr 04 13:29:57 chatgpt pnpm[8996]:       timingAllowPassed: true,
Apr 04 13:29:57 chatgpt pnpm[8996]:       requestIncludesCredentials: true,
Apr 04 13:29:57 chatgpt pnpm[8996]:       type: 'default',
Apr 04 13:29:57 chatgpt pnpm[8996]:       status: 400,
Apr 04 13:29:57 chatgpt pnpm[8996]:       timingInfo: [Object],
Apr 04 13:29:57 chatgpt pnpm[8996]:       cacheState: '',
Apr 04 13:29:57 chatgpt pnpm[8996]:       statusText: 'Bad Request',
Apr 04 13:29:57 chatgpt pnpm[8996]:       headersList: [HeadersList],
Apr 04 13:29:57 chatgpt pnpm[8996]:       urlList: [Array],
Apr 04 13:29:57 chatgpt pnpm[8996]:       body: [Object]
Apr 04 13:29:57 chatgpt pnpm[8996]:     },
Apr 04 13:29:57 chatgpt pnpm[8996]:     [Symbol(headers)]: HeadersList {
Apr 04 13:29:57 chatgpt pnpm[8996]:       cookies: null,
Apr 04 13:29:57 chatgpt pnpm[8996]:       [Symbol(headers map)]: [Map],
Apr 04 13:29:57 chatgpt pnpm[8996]:       [Symbol(headers map sorted)]: null
Apr 04 13:29:57 chatgpt pnpm[8996]:     }
Apr 04 13:29:57 chatgpt pnpm[8996]:   }
Apr 04 13:29:57 chatgpt pnpm[8996]: }

使用的第三方客户端是 https://github.com/chatgpt-web-dev/chatgpt-web

from aurora.

lingoox avatar lingoox commented on July 17, 2024

{ role: 'user', content: [ { type: 'text', text: 'hello' } ] },你这个不是错误了吗? 字符串你传了数组

from aurora.

dqzboy avatar dqzboy commented on July 17, 2024

{ role: 'user', content: [ { type: 'text', text: 'hello' } ] },你这个不是错误了吗? 字符串你传了数组

这个是那个客户端默认就是这样的,不是我去传的;

from aurora.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.