Line data Source code
1 16 : <template>
2 0 : <div class="flex h-full flex-col justify-between gap-6 text-sm">
3 : <div class="flex flex-col gap-6">
4 : <div class="flex flex-col gap-2">
5 : <p class="m-0">
6 : {{ $t('assetBrowser.uploadModelDescription1Generic') }}
7 : </p>
8 : <div>
9 : <p class="m-0 text-muted-foreground">
10 : {{ $t('assetBrowser.uploadModelDescription2Generic') }}
11 : </p>
12 : <span class="mt-2 inline-flex flex-wrap items-center gap-1">
13 : <span class="inline-flex items-center gap-1">
14 : <img
15 : :src="civitaiIcon"
16 : :alt="$t('assetBrowser.providerCivitai')"
17 : class="size-4"
18 : />
19 : <a
20 : :href="civitaiUrl"
21 : target="_blank"
22 : rel="noopener noreferrer"
23 : class="text-muted-foreground underline"
24 : >
25 : {{ $t('assetBrowser.providerCivitai') }}</a
26 : ><span>,</span>
27 : </span>
28 : <span class="inline-flex items-center gap-1">
29 : <img
30 : :src="huggingFaceIcon"
31 : :alt="$t('assetBrowser.providerHuggingFace')"
32 : class="size-4"
33 : />
34 : <a
35 : :href="huggingFaceUrl"
36 : target="_blank"
37 : rel="noopener noreferrer"
38 : class="text-muted-foreground underline"
39 : >
40 : {{ $t('assetBrowser.providerHuggingFace') }}
41 : </a>
42 : </span>
43 : </span>
44 : </div>
45 : </div>
46 :
47 : <div class="flex flex-col gap-2">
48 : <Input
49 : v-model="url"
50 : autofocus
51 : :placeholder="$t('assetBrowser.genericLinkPlaceholder')"
52 : data-attr="upload-model-step1-url-input"
53 : />
54 : <p v-if="error" class="text-destructive">
55 : {{ error }}
56 : </p>
57 : </div>
58 : <slot />
59 : </div>
60 :
61 : <div class="flex flex-col gap-6 text-muted-foreground">
62 : <div v-if="showSecretsHint">
63 : <i18n-t keypath="assetBrowser.apiKeyHint" tag="span">
64 : <template #link>
65 : <Button
66 : variant="muted-textonly"
67 : size="unset"
68 : class="p-0 underline"
69 : @click="openSecretsSettings"
70 : >
71 : {{ $t('assetBrowser.apiKeyHintLink') }}
72 : </Button>
73 : </template>
74 : </i18n-t>
75 : </div>
76 : <div>
77 : {{ $t('assetBrowser.uploadModelHelpFooterText') }}
78 : </div>
79 : </div>
80 : </div>
81 : </template>
82 :
83 : <script setup lang="ts">
84 : import { computed } from 'vue'
85 :
86 : import Button from '@comfyorg/design-system/button/Button'
87 : import Input from '@comfyorg/design-system/input/Input'
88 : import { useFeatureFlags } from '@/composables/useFeatureFlags'
89 : import { useSettingsDialog } from '@/platform/settings/composables/useSettingsDialog'
90 :
91 0 : const { flags } = useFeatureFlags()
92 0 : const settingsDialog = useSettingsDialog()
93 :
94 0 : const showSecretsHint = computed(() => flags.userSecretsEnabled)
95 :
96 0 : function openSecretsSettings() {
97 0 : settingsDialog.show('secrets')
98 : }
99 :
100 0 : const props = defineProps<{
101 : modelValue: string
102 : error?: string
103 : }>()
104 :
105 0 : const emit = defineEmits<{
106 : 'update:modelValue': [value: string]
107 : }>()
108 :
109 0 : const url = computed({
110 : get: () => props.modelValue,
111 : set: (value: string) => emit('update:modelValue', value)
112 : })
113 :
114 2355 : const civitaiIcon = '/assets/images/civitai.svg'
115 2355 : const civitaiUrl = 'https://civitai.com/models'
116 2355 : const huggingFaceIcon = '/assets/images/hf-logo.svg'
117 2355 : const huggingFaceUrl = 'https://huggingface.co'
118 : </script>
|