chatgpt 在使用舊版 chrome 產生 "oops, an error occurred!" 的修正方法 (Windows7)

Microsoft Windows 相關知識
回覆文章
dtchang
Site Admin
文章: 90
註冊時間: 2017-01-22, 16:54

chatgpt 在使用舊版 chrome 產生 "oops, an error occurred!" 的修正方法 (Windows7)

文章 dtchang » 2024-08-08, 16:08

參考資料: https://community.openai.com/t/oops-an- ... /65?page=2

產生 "oops, an error occurred!" 的起因為 chatgpt 使用的 Javascript 缺失 (最新版的 chrome 沒此問題)
即缺少 toSorted().
修正方法為預先插入取代的 Javascript 程式碼
以下為使用自動插入 JS
1. 安裝 Resource Override 插件

代碼: 選擇全部

https://chromewebstore.google.com/detail/resource-override/pkoacgokdfckfpndoffpifphamojphii
2. 開啟插件針對 chatgpt 加入一段程式碼;
Add Tab Group
Tab URL: " *chatgpt.com/* "
Add Rule: Inject File
Name: " ArrayPrototypeToSorted.js "
File Type: " JS "
Inject into: " Head "

3. 編輯程式碼 (Edit File/Save & Close)

代碼: 選擇全部

//copy this (ArrayPrototypeToSorted.js) . ini
if (!Array.prototype.toSorted) {
    Array.prototype.toSorted = function(compareFn) {
        compareFn = compareFn || ((a, b) => String(a).localeCompare(b));
        const arrayCopy = [...this];
        return arrayCopy.sort(compareFn);
    };
}
//copy this (ArrayPrototypeToSorted.js) . end
4. 重啟 chrome

代碼: 選擇全部

-- In Google Chrome install the extension: " https://chromewebstore.google.com/detail/resource-override/pkoacgokdfckfpndoffpifphamojphii " (Resource Override) and configure the following -- :

1 - [Open: Resource Override] :

2 - [Press Button: Add Tab Group] :
Tab URL: " *chatgpt.com/* "

3 - [Press Button: Add Rule > Press Button: Inject File] :
Name: " ArrayPrototypeToSorted.js " 
File Type: " JS "
Inject into: " Head "

4 - [Press Button: Edit File] :
//copy this (ArrayPrototypeToSorted.js) . ini
if (!Array.prototype.toSorted) {
    Array.prototype.toSorted = function(compareFn) {
        compareFn = compareFn || ((a, b) => String(a).localeCompare(b));
        const arrayCopy = [...this];
        return arrayCopy.sort(compareFn);
    };
}
//copy this (ArrayPrototypeToSorted.js) . end
[Press Button: Save & Close] .

-- On page load: "*chatgpt.com/*" ; This will add the missing functionality. --
ResourceOverride.jpg
ResourceOverride.jpg (75.87 KiB) 已瀏覽 2315 次

回覆文章