Skip to content

Conversation

@yunshaochu
Copy link

@yunshaochu yunshaochu commented Dec 11, 2025

Scope: src/components/Manga/actions/translation/selfhosted.ts
自定义翻译 URL

背景

在 Kaggle 等平台使用免费 GPU 运行翻译程序时,需要通过 ngrok 等内网穿透工具暴露服务。但 ngrok 免费用户每次访问都会遇到警告页面,未通过验证会导致翻译功能请求失败。

其实通常在浏览器中手动访问一次警告页面即可正常使用翻译功能了,但我昨晚发现,在 PWA 环境下是无法打开该页面进行验证的TAT

解决方案

当检测到 ngrok 域名时,自动添加 ngrok-skip-browser-warning 请求头以跳过警告页面。

@yunshaochu
Copy link
Author

又测了一下,发现了个事,不知道算不算使用的注意事项(挠头):
由于翻译引擎是直接从html中解析出来的,而上面加请求头的方式无法解决html的显示,所以图中的"翻译服务"是空的(没有默认选择gpt3.5),因此翻译请求一开始是失败的;
不过如果在PWA反复打开本地图片,试了三四次然后刷新页面,就会突然会默认选择gpt3.5做翻译引擎了,成功翻译。

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant