Elliott-Chong / chatpdf-yt

https://chatpdf-elliott.vercel.app
641 stars 263 forks source link

Error: failed to pipe response #35

Open JordyBrian04 opened 7 months ago

JordyBrian04 commented 7 months ago

When i ask any question to my pdf doc i got this error :

Error: aborted at connResetException (node:internal/errors:720:14) at abortIncoming (node:_http_server:793:17) at socketOnClose (node:_http_server:787:3) at Socket.emit (node:events:526:35) at TCP. (node:net:337:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ECONNRESET' } ⨯ uncaughtException: Error: aborted at connResetException (node:internal/errors:720:14) at abortIncoming (node:_http_server:793:17) at socketOnClose (node:_http_server:787:3) at Socket.emit (node:events:526:35) at TCP. (node:net:337:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ECONNRESET' } ⨯ uncaughtException: Error: aborted at connResetException (node:internal/errors:720:14) at abortIncoming (node:_http_server:793:17) at socketOnClose (node:_http_server:787:3) at Socket.emit (node:events:526:35) at TCP. (node:net:337:12) at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { code: 'ECONNRESET' } ⨯ Error: failed to pipe response at pipeToNodeResponse (/Users/jordy/Desktop/chat-pdf/node_modules/next/dist/server/pipe-readable.js:106:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async DevServer.runEdgeFunction (/Users/jordy/Desktop/chat-pdf/node_modules/next/dist/server/next-server.js:1214:13) at async NextNodeServer.handleCatchallRenderRequest (/Users/jordy/Desktop/chat-pdf/node_modules/next/dist/server/next-server.js:242:37) at async DevServer.handleRequestImpl (/Users/jordy/Desktop/chat-pdf/node_modules/next/dist/server/base-server.js:751:17) { [cause]: Error: Response error: { "error": { "message": "{'0': {'role': 'user', 'content': 'De quoi parle le document ?'}, 'prompt': {'role': 'system', 'content': 'AI assistant is a brand new, powerful, human-like artificial intelligence.\n The traits of AI include expert knowledge, helpfulness, cleverness, and articulateness.\n AI is a wel at Object.start (webpack-internal:///(rsc)/./node_modules/ai/dist/index.mjs:100:42) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) }

Can you help me please?

questmapping commented 3 months ago

the error is listed here:

"error": { "message": "{'0': {'role': 'user', 'content': 'De quoi parle le document ?'}, 'prompt': {'role': 'system', 'content': 'AI assistant is a brand new, powerful, human-like artificial intelligence.\n The traits of AI include expert knowledge, helpfulness, cleverness, and articulateness.\n AI is a wel

It is because Completion API expects an array of messages and not an object.

It could be a typo in your code inside src>app>api>chat>route.ts


                model: 'gpt-3.5-turbo',
                messages: [ // use square brackets, not curly braces
                    prompt, 
                    ...messages.filter((message: Message) => message.role === 'user'),
                ],
                stream: true,
            });

Let me know if this solve your issue