-
Notifications
You must be signed in to change notification settings - Fork 641
feat: add gated Hugging Face model access hints #13742
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
base: main
Are you sure you want to change the base?
Changes from all commits
c24ec68
41f35c2
5a9db5c
5dbac5b
9e502a9
0e7217a
d33c1db
33b18fc
3e045e1
216e744
7caff34
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| { | ||
| "last_node_id": 1, | ||
| "last_link_id": 1, | ||
| "nodes": [ | ||
| { | ||
| "id": 1, | ||
| "type": "CheckpointLoaderSimple", | ||
| "pos": [256, 256], | ||
| "size": [315, 98], | ||
| "flags": {}, | ||
| "order": 0, | ||
| "mode": 0, | ||
| "inputs": [], | ||
| "outputs": [ | ||
| { | ||
| "name": "MODEL", | ||
| "type": "MODEL", | ||
| "links": null | ||
| }, | ||
| { | ||
| "name": "CLIP", | ||
| "type": "CLIP", | ||
| "links": null | ||
| }, | ||
| { | ||
| "name": "VAE", | ||
| "type": "VAE", | ||
| "links": null | ||
| } | ||
| ], | ||
| "properties": { | ||
| "Node name for S&R": "CheckpointLoaderSimple", | ||
| "models": [ | ||
| { | ||
| "name": "gated_model.safetensors", | ||
| "url": "https://huggingface.co/comfy-e2e/gated-test/resolve/main/gated_model.safetensors", | ||
| "directory": "checkpoints" | ||
| } | ||
| ] | ||
| }, | ||
| "widgets_values": ["gated_model.safetensors"] | ||
| } | ||
| ], | ||
| "links": [], | ||
| "groups": [], | ||
| "config": {}, | ||
| "extra": { | ||
| "ds": { | ||
| "offset": [0, 0], | ||
| "scale": 1 | ||
| } | ||
| }, | ||
| "version": 0.4 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,20 @@ | ||
| <template> | ||
| <div class="px-3"> | ||
| <div | ||
| v-if="showGatedModelsHint" | ||
| data-testid="missing-model-gated-hint" | ||
| role="note" | ||
| class="mb-2 flex gap-2 rounded-md border border-warning-background/30 bg-warning-background/10 p-2.5" | ||
| > | ||
| <i | ||
| aria-hidden="true" | ||
| class="mt-0.5 icon-[lucide--lock] size-4 shrink-0 text-warning-background" | ||
| /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: (non-blocking) The gated-hint banner conveys its warning state through color alone (
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The banner already has two non-color indicators: a visible lock icon and explicit text stating that some models are gated and require Hugging Face sign-in/license acceptance. Color is only supplemental styling here, so I kept the current copy rather than adding a generic “Note:” prefix. |
||
| <p class="m-0 text-xs/relaxed text-warning-background"> | ||
| {{ t('rightSidePanel.missingModels.gatedModelsHint') }} | ||
| </p> | ||
| </div> | ||
|
|
||
| <div | ||
| v-if="importableModelRows.length > 0" | ||
| data-testid="missing-model-importable-rows" | ||
|
|
@@ -68,7 +83,7 @@ import type { MissingModelGroup } from '@/platform/missingModel/types' | |
| import { isCloud } from '@/platform/distribution/types' | ||
| import MissingModelRow from '@/platform/missingModel/components/MissingModelRow.vue' | ||
| import Button from '@/components/ui/button/Button.vue' | ||
| import { downloadModel } from '@/platform/missingModel/missingModelDownload' | ||
| import { useMissingModelDownload } from '@/platform/missingModel/composables/useMissingModelDownload' | ||
| import { getDownloadableModels } from '@/platform/missingModel/missingModelViewUtils' | ||
| import { useMissingModelStore } from '@/platform/missingModel/missingModelStore' | ||
| import { formatSize } from '@/utils/formatUtil' | ||
|
|
@@ -100,6 +115,7 @@ const emit = defineEmits<{ | |
|
|
||
| const { t } = useI18n() | ||
| const missingModelStore = useMissingModelStore() | ||
| const { downloadMissingModel } = useMissingModelDownload() | ||
|
|
||
| const sortedModelRows = computed(() => | ||
| missingModelGroups | ||
|
|
@@ -128,6 +144,12 @@ const downloadableModels = computed(() => { | |
| return getDownloadableModels(missingModelGroups) | ||
| }) | ||
|
|
||
| const showGatedModelsHint = computed(() => | ||
| downloadableModels.value.some( | ||
| (model) => !!missingModelStore.gatedRepoUrls[model.url] | ||
| ) | ||
| ) | ||
|
|
||
| const downloadAllLabel = computed(() => { | ||
| const base = t('rightSidePanel.missingModels.downloadAll') | ||
| const total = downloadableModels.value.reduce( | ||
|
|
@@ -139,7 +161,7 @@ const downloadAllLabel = computed(() => { | |
|
|
||
| function downloadAllModels() { | ||
| for (const model of downloadableModels.value) { | ||
| downloadModel(model, missingModelStore.folderPaths) | ||
| downloadMissingModel(model) | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: (non-blocking) The
downloadUrlToHfRepoUrlutility used to derivegatedRepoUrlhas acatchblock that returns the rawurlargument unchanged on parse failure. SinceisHuggingFaceRepoUrlusesnew URL()too and would fail on the same malformed input, this path is unreachable viafetchHeadMetadata. But the function's own contract is broken: it claims to return an HF repo URL but can return anything. A safer fallback would bereturn 'https://huggingface.co/'so future callers that skip the hostname check don't receive arbitrary values.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left the raw fallback unchanged because it is a pre-existing utility-contract issue and remains unreachable from the gated flow. In 7caff34, both the composable and
openGatedRepoPageindependently require the exacthttps://huggingface.coorigin, so a malformed/raw fallback cannot reach browser navigation or Electron IPC. I would prefer to clean up the broader conversion utility contract in a focused follow-up if it gains additional callers.