Skip to content

Commit ae67756

Browse files
authored
[Example] Update content security policy to include new hf lfs cdn (#603)
Related issue: #590 Hugging Face started to use a new domain name https://cdn-lfs-us-1.hf.co besides the original https://cdn-lfs-us-1.huggingface.co in storing model weight files. This PR updated the content security policy of the chrome extension examples to allow the extension to connect to the new domain to download weights and load the models.
1 parent 634702e commit ae67756

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

examples/chrome-extension-webgpu-service-worker/src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"128": "icons/icon-128.png"
1111
},
1212
"content_security_policy": {
13-
"extension_pages": "style-src-elem 'self' https://cdnjs.cloudflare.com; font-src 'self' https://cdnjs.cloudflare.com; script-src 'self' 'wasm-unsafe-eval'; default-src 'self' data:; connect-src 'self' data: http://localhost:8000 https://huggingface.co https://cdn-lfs.huggingface.co https://cdn-lfs-us-1.huggingface.co https://raw.githubusercontent.com"
13+
"extension_pages": "style-src-elem 'self' https://cdnjs.cloudflare.com; font-src 'self' https://cdnjs.cloudflare.com; script-src 'self' 'wasm-unsafe-eval'; default-src 'self' data:; connect-src 'self' data: http://localhost:8000 https://huggingface.co https://cdn-lfs.huggingface.co https://cdn-lfs-us-1.huggingface.co https://raw.githubusercontent.com https://cdn-lfs-us-1.hf.co"
1414
},
1515
"action": {
1616
"default_title": "MLCBot",

examples/chrome-extension-webgpu-service-worker/src/popup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const initProgressCallback = (report: InitProgressReport) => {
4646
};
4747

4848
const engine: MLCEngineInterface = await CreateExtensionServiceWorkerMLCEngine(
49-
"Mistral-7B-Instruct-v0.2-q4f16_1-MLC",
49+
"Qwen2-0.5B-Instruct-q4f16_1-MLC",
5050
{ initProgressCallback: initProgressCallback },
5151
);
5252
const chatHistory: ChatCompletionMessageParam[] = [];

examples/chrome-extension/src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"128": "icons/icon-128.png"
1111
},
1212
"content_security_policy": {
13-
"extension_pages": "style-src-elem 'self' https://cdnjs.cloudflare.com; font-src 'self' https://cdnjs.cloudflare.com; script-src 'self' 'wasm-unsafe-eval'; default-src 'self' data:; connect-src 'self' data: http://localhost:8000 https://huggingface.co https://cdn-lfs.huggingface.co https://cdn-lfs-us-1.huggingface.co https://raw.githubusercontent.com"
13+
"extension_pages": "style-src-elem 'self' https://cdnjs.cloudflare.com; font-src 'self' https://cdnjs.cloudflare.com; script-src 'self' 'wasm-unsafe-eval'; default-src 'self' data:; connect-src 'self' data: http://localhost:8000 https://huggingface.co https://cdn-lfs.huggingface.co https://cdn-lfs-us-1.huggingface.co https://raw.githubusercontent.com https://cdn-lfs-us-1.hf.co"
1414
},
1515
"action": {
1616
"default_title": "MLCBot",

examples/chrome-extension/src/manifest_v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"64": "icons/icon-64.png",
1010
"128": "icons/icon-128.png"
1111
},
12-
"content_security_policy": "style-src-elem 'self' https://cdnjs.cloudflare.com; font-src 'self' https://cdnjs.cloudflare.com; script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'; default-src 'self' data:; connect-src 'self' data: http://localhost:8000 https://huggingface.co https://cdn-lfs.huggingface.co https://raw.githubusercontent.com",
12+
"content_security_policy": "style-src-elem 'self' https://cdnjs.cloudflare.com; font-src 'self' https://cdnjs.cloudflare.com; script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'; default-src 'self' data:; connect-src 'self' data: http://localhost:8000 https://huggingface.co https://cdn-lfs.huggingface.co https://raw.githubusercontent.com https://cdn-lfs-us-1.hf.co",
1313
"browser_action": {
1414
"default_popup": "popup.html"
1515
},

0 commit comments

Comments
 (0)