lobe-chat icon indicating copy to clipboard operation
lobe-chat copied to clipboard

[Question] URL 携带 /chat 路径,Edge 浏览器刷新会报错

Open rtpacks opened this issue 1 year ago • 18 comments

🧐 问题描述 | Proposed Solution

问题: URL 携带 /chat 路径,Edge 浏览器刷新会报错,在 Chrome 和 Firefox 中同样的操作不会触发这个错误

image

复现步骤:

  1. 使用 docker-compose 部署
  2. 访问部署地址,URL出现 /chat#session=inbox 后刷新 Edge 浏览器,出现上面错误
  3. 移除 URL 的 /chat#session=inbox,页面路由重定向正常

📝 补充信息 | Additional Information

部署方式:docker compose 部署

version: '3' 

services:
  lobe:
    image: lobehub/lobe-chat
    container_name: lobe
    restart: always
    # volumes:
      # - ./data:/data
    # network_mode: "host"
    ports:
      - 7007:3210
    environment:
      OPENAI_API_KEY: sk-xx
      OPENAI_PROXY_URL: https://api.gptapi.us/v1
      ACCESS_CODE: xxx

版本信息 Microsoft Edge 版本 120.0.2210.77 (正式版本) (64 位)

Firefox 版本 121.0 (64 位)

Google Chrome 版本 120.0.6099.110(正式版本) (64 位)

rtpacks avatar Dec 22 '23 11:12 rtpacks

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


🧐 Problem Description | Proposed Solution

Problem: If the URL carries the /chat path, an error will be reported when refreshing the Edge browser. The same operation in Chrome and Firefox will not trigger this error.

image

Steps to reproduce:

  1. Deploy using docker-compose
  2. Access the deployment address, the URL appears /chat#session=inbox and then refresh the Edge browser. The above error appears.
  3. Remove /chat#session=inbox from the URL, and the page routing redirection will be normal.

📝 Additional Information |

Deployment method: docker compose deployment

version: '3'

services:
  lobe:
    image: lobehub/lobe-chat
    container_name: lobe
    restart: always
    # volumes:
      # - ./data:/data
    # network_mode: "host"
    ports:
      - 7007:3210
    environment:
      OPENAI_API_KEY: sk-xx
      OPENAI_PROXY_URL: https://api.gptapi.us/v1
      ACCESS_CODE: xxx

Version Information Microsoft Edge Version 120.0.2210.77 (Official version) (64-bit)

Firefox Version 121.0 (64-bit)

Google Chrome Version 120.0.6099.110 (official version) (64-bit)

lobehubbot avatar Dec 22 '23 11:12 lobehubbot

👀 @rtpacks

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot avatar Dec 22 '23 11:12 lobehubbot

关闭浏览器所有插件还会触发这个错误

rtpacks avatar Dec 22 '23 11:12 rtpacks

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


All browser plug-ins have been turned off

lobehubbot avatar Dec 22 '23 11:12 lobehubbot

能否点一下那个 t.useCallback 后面那一串,然后截个图发出来?

arvinxx avatar Dec 22 '23 15:12 arvinxx

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Can you click on the string after t.useCallback and then take a screenshot and send it?

lobehubbot avatar Dec 22 '23 15:12 lobehubbot

@arvinxx,不太清楚这是不是 React 源码编译产物。

和 #664 类似,IP 访问是正常的,但我这只有在域名访问并且是 Edge 浏览器访问才会出现这个问题,Chrome 都是正常的。

目前测试下来,network_mode: "host" 模式下 Edge 刷新后没有这个问题。桥接模式下我是通过端口直接访问的,Nginx 没有反代 Docker 使用的服务器端口。

image

image

9925-8f38d69104e46048.js.txt

rtpacks avatar Dec 22 '23 16:12 rtpacks

我之前也遇到了这个问题,后面发现是我导入的配置文件有问题。 我那个配置文件是以前某个版本的lobechat生成的,我在最新版本lobechat清空设置之后重新配置并导出一份,其他电脑再导入就没有这个问题了

crabkun avatar Dec 23 '23 11:12 crabkun

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I also encountered this problem before, and later found out that there was a problem with the configuration file I imported. My configuration file was generated by a previous version of lobechat. After clearing the settings of the latest version of lobechat, I reconfigured and exported a copy. When I imported it from other computers, there was no problem.

lobehubbot avatar Dec 23 '23 11:12 lobehubbot

我之前也遇到了这个问题,后面发现是我导入的配置文件有问题。

我那个配置文件是以前某个版本的lobechat生成的,我在最新版本lobechat清空设置之后重新配置并导出一份,其他电脑再导入就没有这个问题了

可以把配置文件移除apikey后发出来一份吗?我检查下是什么原因

arvinxx avatar Dec 23 '23 12:12 arvinxx

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I also encountered this problem before, and later found out that there was a problem with the configuration file I imported.

My configuration file was generated by a previous version of lobechat. After clearing the settings in the latest version of lobechat, I reconfigured and exported a copy. When I imported it from other computers, there was no problem.

Can you remove the apikey from the configuration file and send a copy? I'll check what's the reason

lobehubbot avatar Dec 23 '23 12:12 lobehubbot

感觉是其他插件js干扰了,我刷新演示https://chat-preview.lobehub.com/chat#session=inbox 的这个地址,百分百会复现。 但是我换没有chrome插件的隐私模式,就不会出现这个问题。 建议lz尝试下无插件的隐私模式。

suwubee avatar Dec 26 '23 14:12 suwubee

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


It feels like other plug-in js is interfering. I refresh the address of the demo https://chat-preview.lobehub.com/chat#session=inbox and it will 100% reappear. But when I switch to privacy mode without the chrome plug-in, this problem does not occur. It is recommended that lz try the privacy mode without plug-ins.

lobehubbot avatar Dec 26 '23 14:12 lobehubbot

@suwubee @rtpacks 问题定位到了。麻烦进一下 /settings/tts URL ,将语音识别服务设置为 OpenAI ,然后就应该能好了。

应该是之前你们改过这里变成了 Browser ,然后导致的报错。这个是一个实现 bug,我们后续修复

image

arvinxx avatar Jan 03 '24 07:01 arvinxx

我之前也遇到了这个问题,后面发现是我导入的配置文件有问题。 我那个配置文件是以前某个版本的lobechat生成的,我在最新版本lobechat清空设置之后重新配置并导出一份,其他电脑再导入就没有这个问题了

可以把配置文件移除apikey后发出来一份吗?我检查下是什么原因

不好意思刚看到消息。我刚在preview上导入这份配置文件还是能复现问题。 步骤:隐私模式进入preview,导入配置,点击立即开始,开新的会话,刷新页面,报错。 LobeChat-settings-v1-new.json 这是11月30号导出的配置文件,新的版本导出已经没有这个问题了

crabkun avatar Jan 04 '24 14:01 crabkun

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I also encountered this problem before, and later found out that there was a problem with the configuration file I imported. My configuration file was generated by a previous version of lobechat. I reconfigured and exported a copy after clearing the settings in the latest version of lobechat. When I imported it from other computers, there was no such problem.

Can you remove the apikey from the configuration file and send a copy? I'll check what's the reason

Sorry, I just saw the news. I just imported this configuration file on preview and can still reproduce the problem. Steps: Enter preview in privacy mode, import the configuration, click Start Now, open a new session, refresh the page, and report an error. LobeChat-settings-v1-new.json This is the configuration file exported on November 30th. The new version does not have this problem anymore.

lobehubbot avatar Jan 04 '24 14:01 lobehubbot

感谢 @arvinxx 开发者处理 bug。我在 v0.117.0 版本中将语音识别服务设置为 OpenAI 后,/chat 路由仍会有刷新报错这个问题,升级新版本后没有解决了。❤️

rtpacks avatar Jan 07 '24 09:01 rtpacks

我也遇到了同样的问题,fork Vercel 部署(已更新到最新代码),Microsoft Edge 浏览器,TTS 从默认 OpenAI 切换 Browser 后会复现这个错,测试改回 OpenAI 没问题。 image

function r8(e, t) {
            var n = rN();
            t = void 0 === t ? null : t;
            var r = n.memoizedState;
            return null !== t && rb(t, r[1]) ? r[0] : (n.memoizedState = [e, t],
            e)
        }

zhiweio avatar Feb 22 '24 03:02 zhiweio

✅ @rtpacks

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

lobehubbot avatar Apr 03 '24 15:04 lobehubbot

:tada: This issue has been resolved in version 0.145.11 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

lobehubbot avatar Apr 03 '24 15:04 lobehubbot