[Chanzhaoyu/chatgpt-web]npm run build部署前端在Linux发生了问题

2024-06-21 549 views
3

后端是run start使用pm2挂载正常

前端本地跑,版本到今天940分的是正常的,后面的版本更新后会发生同样的问题:返回数据收到后,页面不展示的 服务器使用nginx部署后,同样的问题,接口有返回,页面无更新 image 这是返回的data:【{"role":"assistant","id":"chatcmpl-6yxCwpUQVHnLWCs54NzLS56n5E9wb","parentMessageId":"fc9cbcb2-fddd-4062-b1ec-d28be774bde5","text":"","detail":{"id":"chatcmpl-6yxCwpUQVHnLWCs54NzLS56n5E9wb","object":"chat.completion.chunk","created":1679985294,"model":"gpt-3.5-turbo-0301","choices":[{"delta":{"role":"assistant"},"index":0,"finish_reason":null}]}}t1h1i4s5i1s4a1s9i1l9l8y1s0plitI'm sorry, but I still don't understand what you're looking for. Can you please provide more information or clarify your question?】

这是nginx部署文件 server { listen 80; server_name localhost;

location /{

二级路由时需要使用别名alias,不用root
alias /server/chatgpt-web/dist/;
index  index.html;
#若不配置try_files,刷新会404
try_files $uri $uri/ /index.html=404;
proxy_buffering off;

}

后台接口

location /api/ { proxy_pass http://127.0.0.1:3002/; } }

回答

3

你本地调试可以吗

1

本地正常的

1

先用老版本

9

b579d24d是唯一本地能跑的前端,服务器的还没找到能用的......

7

使用带标签的版本

0

2.10.8 .7都试了下都是一样的问题呢 问题可能处在 ` try { let lastText = '' const fetchChatAPIOnce = async () => { await fetchChatAPIProcess({ prompt: message, options, signal: controller.signal, onDownloadProgress: ({ event }) => { const xhr = event.target const { responseText } = xhr // Always process the final line const lastIndex = responseText.lastIndexOf('\n', responseText.length - 2) let chunk = responseText if (lastIndex !== -1) chunk = responseText.substring(lastIndex) try { const data = JSON.parse(chunk) updateChat( +uuid, dataSources.value.length - 1, { dateTime: new Date().toLocaleString(), text: lastText + data.text ?? '', inversion: false, error: false, loading: false, conversationOptions: { conversationId: data.conversationId, parentMessageId: data.id }, requestOptions: { prompt: message, options: { ...options } }, }, )

        if (openLongReply && data.detail.choices[0].finish_reason === 'length') {
          options.parentMessageId = data.id
          lastText = data.text
          message = ''
          return fetchChatAPIOnce()
        }

        scrollToBottomIfAtBottom()
      }
      catch (error) {
      //
      }
    },
  })
}

await fetchChatAPIOnce()

}`

4

我这边测试都是正常的啊

3

是后端问题,我直接clone的master代码发生了问题