-
Notifications
You must be signed in to change notification settings - Fork 59.3k
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
[Bug] 一个有关 replaceAll 的兼容性的bug: #2376
Comments
手机系统版本? |
Mobile phone system version? |
|
|
我加一个 polyfill 吧。 |
Let me add a polyfill. |
I am going to introduce |
@sbetamaster 已经尝试在主线增加 babel 转译,请使用演示站点测试此 bug 是否依然存在:https://chatgpt1.nextweb.fun/ |
@sbetamaster has tried adding babel transpilation to the mainline, please use the demo site to test if the bug persists: https://chatgpt1.nextweb.fun/ |
* main: Added Azure OpenAI capabilities Update tauri.conf.json Update home.tsx Update mask.tsx feat: add type for import feat: add typings for metadata feat: close ChatGPTNextWeb#2376 add babel polyfill fix: ChatGPTNextWeb#2367 do not copy in async callback after sharing to ShareGPT feat: improve dnd icon Update README.md dev: use current inject configuration fix: enable `enableInjectSystemPrompts` attribute for old sessions fixed react key fixed openai base url if empty feat: drag and drop in contextual prompts
feat: close ChatGPTNextWeb#2376 add babel polyfill
feat: close ChatGPTNextWeb#2376 add babel polyfill
Describe the bug
一个有关 replaceAll 兼容性的 bug 。
To Reproduce
我在手机上用 via 浏览器时,会出现一个奇怪的现象,输入文字并且点击按钮发送请求后,列表中并没有象正常那样把用户输入的文字显示在列表框中,而是消失不见,并且一直无法收到响应。然而用Chrome或者Edge浏览器并没有这种问题。
通过调试发现问题出在 app/store/chat.ts 文件中的以下代码处:
Object.entries(vars).forEach(([name, value]) => {
output = output.replaceAll(
{{${name}}}
, value);});
以上代码产生了异常,从而导致后续的代码都没有正常执行,于是出现了上述描述的现象。
其中 output.replaceAll 这一行代码编译后,在 via 浏览器运行时会出现异常,提示 o.replaceAll not is a function。
通过询问 chatgpt ,提示问题出现的原因为:”而您可能使用的是不支持该方法的JavaScript引擎“。因此这可能是个兼容性的问题。
chatgpt 提供了以下解决方案,即修改代码为:
Object.entries(vars).forEach(([name, value]) => {
output = output.replace(new RegExp(
{{${name}}}
, 'g'), value);});
经过测试后可行。
The text was updated successfully, but these errors were encountered: