Skip to content

Commit 1b717d7

Browse files
committed
aistudio worker fix
1 parent 19b83d7 commit 1b717d7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/backend-tokenApproximator.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,11 @@
414414
*
415415
*/
416416
function createEstimatorWorker() {
417-
// Gemini's CSP blocks blob workers. Fallback to an on-thread mock worker.
418-
if (Site === 'Gemini') {
419-
log('Using synchronous on-thread estimator for Gemini due to CSP.');
417+
// CSP workaround: some sites (Gemini / AI Studio) block blob workers.
418+
// In that case, return an on-thread mock worker.
419+
if (Site === 'Gemini' || Site === 'AIStudio') {
420+
// Use project logger; keep message site-specific for easier debugging.
421+
log(`Using synchronous on-thread estimator for ${Site} due to CSP.`);
420422
const mockWorker = {
421423
onmessage: null,
422424
postMessage: (data) => {

0 commit comments

Comments
 (0)