chatgpt-google-summary-extension icon indicating copy to clipboard operation
chatgpt-google-summary-extension copied to clipboard

Request to add the gemini-2.0-flash-exp model to Gemini.

Open Wooden-Gear opened this issue 10 months ago • 1 comments

Request to add the gemini-2.0-flash-exp model to Gemini.

Wooden-Gear avatar Jan 21 '25 12:01 Wooden-Gear

第一处修改

然后解压缩 packages\chromium-chrome.zip ,修改 options.js ,移除对 key 的 sk- 开头的检测,也就是删除 579 行的 !l.startsWith("sk-")||

Image

然后就可以用 gemini key 了,这里我使用了最新的 models/gemini-2.5-flash-preview-04-17 模型

注意 API Host 和 Path 的值https://generativelanguage.googleapis.com/v1beta/openai/chat/completions

Image

第二处修改

此外还有一个时间解析的 Bug,目前要求时间必须为两位数字,但 LLM 可能只返回一位数字的时间,比如一位数字的分钟 1:10,所以修改 content-script.js 1427 行,改成 j=/\d+:\d+(?::\d+)?/

Image

第三处修改

问题:字幕被截短后才发给 LLM 删掉截断的判断和 max_tokens,在 background.js 452 行

改动 3.1 generateAnswer(G) 函数中删除 max_tokens:X||WG,

Image

改动 3.2 let l=vl(I);return G>=l?I:Hb(I.substring(0,I.length*(G/l)),G) 改成 return I;

Image

第四处修改(可选)

搜索 log.felo.aiglarityapi.com,把 js 中包含这些 url 的字符串都清空,但不要删除变量。这样可以避免上传一些设备信息。

Image

至于一些 banner 可以用 uBlock origin 来屏蔽。

改完上面 3-4 处就可以把 packages\chromium-chrome 文件夹作为开发者扩展加载到 chrome 或 edge 中使用了

这有一份我自己修改的 chromium-chrome[modified].zip


First Modification

Then unzip packages\chromium-chrome.zip, modify options.js, and remove the check for keys starting with sk-, which means deleting the !l.startsWith("sk-")|| on line 579.

Image

You can then use the Gemini key. Here, I used the latest model models/gemini-2.5-flash-preview-04-17.

Note the values for API Host and Path, https://generativelanguage.googleapis.com/v1beta/openai and /chat/completions.

Image

Second Modification

There is also a bug in time parsing; currently, the time must be two digits, but the LLM may return a one-digit time, such as a one-digit minute 1:10. So modify line 1427 in content-script.js to j=/\d+:\d+(?::\d+)?/.

Image

Third Modification

Issue: Subtitles are sent to the LLM only after being truncated. Remove the truncation check and maxtokens on line 452 in background.js.

Change 3.1: In the generateAnswer(G) function, delete maxtokens:X||WG,.

Image

Change 3.2: Modify let l=vl(I);return G>=l?I:Hb(I.substring(0,I.length*(G/l)),G) to return I;.

Image

Fourth Modification (Optional)

Search for log.felo.ai and glarityapi.com, and clear any strings in the js that contain these URLs, but do not delete the variables. This can help avoid uploading certain device information.

Image

As for some banners, you can use uBlock Origin to block them.

After making changes to the 3-4 places above, you can load the packages\chromium-chrome folder as a developer extension in Chrome or Edge.

Here is my modified version of chromium-chrome[modified].zip

2-3-5-7 avatar May 05 '25 08:05 2-3-5-7