Skip to content

Commit f5fc7ef

Browse files
feat: extend feature flags to read from remote config
- Add private_models_enabled to RemoteConfig type - Update useFeatureFlags to check remoteConfig first, fallback to websocket - Improve UploadModelUpgradeModal styling and layout - Update modal footer with external link icon 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5e3a559 commit f5fc7ef

File tree

6 files changed

+18
-25
lines changed

6 files changed

+18
-25
lines changed

src/composables/useFeatureFlags.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { computed, reactive, readonly } from 'vue'
22

3+
import { remoteConfig } from '@/platform/remoteConfig/remoteConfig'
34
import { api } from '@/scripts/api'
45

56
/**
@@ -41,9 +42,10 @@ export function useFeatureFlags() {
4142
)
4243
},
4344
get privateModelsEnabled() {
44-
return api.getServerFeature(
45-
ServerFeatureFlag.PRIVATE_MODELS_ENABLED,
46-
false
45+
// Check remote config first (from /api/features), fall back to websocket feature flags
46+
return (
47+
remoteConfig.value.private_models_enabled ??
48+
api.getServerFeature(ServerFeatureFlag.PRIVATE_MODELS_ENABLED, false)
4749
)
4850
}
4951
})

src/platform/assets/components/UploadModelUpgradeModal.vue

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
class="upload-model-upgrade-modal flex flex-col justify-between gap-6 p-4 pt-6 border-t-[1px] border-border-default"
3+
class="upload-model-upgrade-modal flex flex-col justify-between gap-10 p-4 border-t-[1px] border-border-default"
44
>
55
<!-- Upgrade Content -->
66
<UploadModelUpgradeModalBody />
@@ -33,15 +33,7 @@ function handleSubscribe() {
3333

3434
<style scoped>
3535
.upload-model-upgrade-modal {
36-
width: 90vw;
37-
max-width: 500px;
38-
min-height: 200px;
39-
}
40-
41-
@media (min-width: 640px) {
42-
.upload-model-upgrade-modal {
43-
width: auto;
44-
min-width: 450px;
45-
}
36+
width: auto;
37+
max-width: min(500px, 90vw);
4638
}
4739
</style>

src/platform/assets/components/UploadModelUpgradeModalBody.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div
3-
class="flex flex-1 flex-col items-center justify-center gap-6 text-base text-muted-foreground"
3+
class="flex flex-1 flex-col items-center justify-center text-base text-muted-foreground"
44
>
55
<p class="m-0 max-w-md">
66
{{ $t('assetBrowser.upgradeFeatureDescription') }}

src/platform/assets/components/UploadModelUpgradeModalFooter.vue

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
<template>
2-
<div class="flex justify-end gap-2 w-full">
3-
<span
2+
<div class="flex flex-wrap justify-end gap-2 w-full">
3+
<a
4+
href="https://blog.comfy.org/p/comfy-cloud-new-features-and-pricing"
5+
target="_blank"
46
class="text-muted-foreground mr-auto underline flex items-center gap-2"
57
>
6-
<i class="icon-[lucide--circle-question-mark]" />
7-
<a
8-
href="https://blog.comfy.org/p/comfy-cloud-new-features-and-pricing"
9-
target="_blank"
10-
class="text-muted-foreground"
11-
>{{ $t('Learn more') }}</a
12-
>
13-
</span>
8+
<i class="icon-[lucide--external-link]" />
9+
<span>{{ $t('Learn more') }}</span>
10+
</a>
1411
<TextButton
1512
:label="$t('g.close')"
1613
type="transparent"

src/platform/remoteConfig/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ export type RemoteConfig = {
3434
comfy_platform_base_url?: string
3535
firebase_config?: FirebaseRuntimeConfig
3636
telemetry_disabled_events?: TelemetryEventName[]
37+
private_models_enabled?: boolean
3738
}

src/scripts/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,7 @@ export class ComfyApi extends EventTarget {
12741274
* @returns The feature value or default
12751275
*/
12761276
getServerFeature<T = unknown>(featureName: string, defaultValue?: T): T {
1277+
console.log('Server feature flags:', this.serverFeatureFlags)
12771278
return get(this.serverFeatureFlags, featureName, defaultValue) as T
12781279
}
12791280

0 commit comments

Comments
 (0)