postor / chatpdf-minimal-demo

a minimal viable project of chatpdf
MIT License
600 stars 108 forks source link

处理45k的文件出错 #6

Closed bswhb closed 1 year ago

bswhb commented 1 year ago

文本文件45k,分成了12段,每个段落4k不到,上传成功进入聊天模式之后,提问出错如下:

chatpdf-minimal-demo-app-1  | Error: Command failed with exit code 1: python3 py/process-article.py ask embeddings/57e7926127a3aca90f890cd63981d4a4 What is the name and label of the button with the text "联系
客服"?
chatpdf-minimal-demo-app-1  | Traceback (most recent call last):
chatpdf-minimal-demo-app-1  |   File "/app/py/process-article.py", line 153, in <module>
chatpdf-minimal-demo-app-1  |     [prompt,answer] = ask(question,obj["embeddings"],obj["sources"])
chatpdf-minimal-demo-app-1  | ValueError: not enough values to unpack (expected 2, got 0)
chatpdf-minimal-demo-app-1  |     at makeError (file:///app/node_modules/execa/lib/error.js:59:11)
chatpdf-minimal-demo-app-1  |     at handlePromise (file:///app/node_modules/execa/index.js:119:26)
chatpdf-minimal-demo-app-1  |     at processTicksAndRejections (node:internal/process/task_queues:96:5)
chatpdf-minimal-demo-app-1  |     at async file:///app/node_modules/@shack-js/runner-express/esm/index.js:56:37 {
chatpdf-minimal-demo-app-1  |   shortMessage: 'Command failed with exit code 1: python3 py/process-article.py ask embeddings/57e7926127a3aca90f890cd63981d4a4 What is the name and label of the button with the text "联系客服"?',
chatpdf-minimal-demo-app-1  |   command: 'python3 py/process-article.py ask embeddings/57e7926127a3aca90f890cd63981d4a4 What is the name and label of the button with the text "联系客服"?',
chatpdf-minimal-demo-app-1  |   escapedCommand: 'python3 "py/process-article.py" ask "embeddings/57e7926127a3aca90f890cd63981d4a4" "What is the name and label of the button with the text \\"联系客服\\"?"',
chatpdf-minimal-demo-app-1  |   exitCode: 1,
chatpdf-minimal-demo-app-1  |   signal: undefined,
chatpdf-minimal-demo-app-1  |   signalDescription: undefined,
chatpdf-minimal-demo-app-1  |   stdout: '',
chatpdf-minimal-demo-app-1  |   stderr: 'Traceback (most recent call last):\n' +
chatpdf-minimal-demo-app-1  |     '  File "/app/py/process-article.py", line 153, in <module>\n' +
chatpdf-minimal-demo-app-1  |     '    [prompt,answer] = ask(question,obj["embeddings"],obj["sources"])\n' +
chatpdf-minimal-demo-app-1  |     'ValueError: not enough values to unpack (expected 2, got 0)',
chatpdf-minimal-demo-app-1  |   failed: true,
chatpdf-minimal-demo-app-1  |   timedOut: false,
chatpdf-minimal-demo-app-1  |   isCanceled: false,
chatpdf-minimal-demo-app-1  |   killed: false
chatpdf-minimal-demo-app-1  | }
postor commented 1 year ago

image 应该是你的文本原本没有换行,每段太大了 方法1:继续切小 方法2:改上面截图里的变量,改了之后可能会导致总字数超出4000调用失败,自己慢慢调变量