Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[远程部署]: 对话气泡复制按钮错误 #826

Closed
2 tasks done
LBEILC opened this issue Jun 30, 2023 · 5 comments
Closed
2 tasks done

[远程部署]: 对话气泡复制按钮错误 #826

LBEILC opened this issue Jun 30, 2023 · 5 comments
Labels
question Further information is requested server deployment 在远程服务器上部署的问题

Comments

@LBEILC
Copy link

LBEILC commented Jun 30, 2023

是否已存在现有反馈与解答?

  • 我确认没有已有issue或discussion,且已阅读常见问题

是否是一个代理配置相关的疑问?

  • 我确认这不是一个代理配置相关的疑问。

错误描述

将项目部署到服务器本地后,通过内网穿透的方式远程访问服务端的网站,但在远程访问时,对话气泡的复制按钮失效,并报错
Uncaught TypeError: Cannot read properties of undefined (reading 'writeText')
at HTMLButtonElement. ((索引):459:14)

索引对应的代码部分:
copyButton.addEventListener('click', ()=>{
            const textToCopy = rawMessage.innerText;
            navigator.clipboard.writeText(textToCopy).then(()=>{   //报错位置
                copyButton.innerHTML = copiedIcon;
                setTimeout(()=>{
                    copyButton.innerHTML = copyIcon;
                }
                , 1500);
            }
            ).catch(()=>{
                console.error("copy failed");
            }
            );
        }

但远程复制代码块的时候是正常的

复现操作

将项目部署到服务器本地后,通过内网穿透的方式远程访问服务端的网站,但在远程访问时,对话气泡的复制按钮失效
在服务器端访问网站的话是可以正常复制的

错误日志

终端未报错

运行环境

  • OS: Windows11 22H2
  • Server: WinServe
  • Gradio version: 3.33.1
  • Python version: 3.11.1

补充说明

No response

@LBEILC LBEILC added question Further information is requested server deployment 在远程服务器上部署的问题 labels Jun 30, 2023
@Keldos-Li
Copy link
Collaborator

这个功能应该和远程或本地部署无关,复制仅是javascript在浏览器层面提供的功能。如果本地能用,不至于远程不能用。

希望您能提供一些更具体的复现步骤,如使用了什么浏览器?远程使用的是什么对话、对话了什么导致复制失败?

以及希望您做一些检查:切换markdown渲染显示是否正确?川虎Chat是否使用了最新版?

另外,需要提醒您,更新新版本的川虎Chat之后,一些老版历史记录的读取可能会有兼容性问题。

@Kilig947
Copy link
Contributor

Kilig947 commented Jul 2, 2023

gradio-app/gradio@c5577c6

gradio-app/gradio#4324

这个问题导致的,当部署在内网,http访问时点击复制按钮,会报错

@Keldos-Li
Copy link
Collaborator

gradio-app/gradio#4324

这个问题导致的,当部署在内网,http访问时点击复制按钮,会报错

谢谢!

@Kilig947
Copy link
Contributor

Kilig947 commented Jul 2, 2023

@Keldos-Li @LBEILC
已解决,提交pr啦~
#827

@LBEILC
Copy link
Author

LBEILC commented Jul 7, 2023

@Keldos-Li @LBEILC 已解决,提交pr啦~ #827

辛苦了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested server deployment 在远程服务器上部署的问题
Projects
None yet
Development

No branches or pull requests

3 participants