Skip to content

Commit eb42acd

Browse files
committed
Add feature flag
1 parent 3675e8a commit eb42acd

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Core/Sources/HostApp/AccountSettings/SharedModelManagement/AIModelManagementVIew.swift

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import AIModel
22
import ComposableArchitecture
3+
import PlusFeatureFlag
34
import SwiftUI
45

56
protocol AIModelManagementAction {
@@ -43,8 +44,21 @@ struct AIModelManagementView<Management: AIModelManagement, Model: ManageableAIM
4344
VStack(spacing: 0) {
4445
HStack {
4546
Spacer()
46-
Button("Add Model") {
47-
store.send(.createModel)
47+
if isFeatureAvailable(\.unlimitedChatAndEmbeddingModels) {
48+
Button("Add Model") {
49+
store.send(.createModel)
50+
}
51+
} else {
52+
WithViewStore(store, observe: { $0.models.count }) { viewStore in
53+
Text("\(viewStore.state) / 2")
54+
.foregroundColor(.secondary)
55+
56+
let disabled = viewStore.state >= 2
57+
58+
Button(disabled ? "Add More Model (Plus)" : "Add Model") {
59+
store.send(.createModel)
60+
}.disabled(disabled)
61+
}
4862
}
4963
}.padding(4)
5064

Pro

Submodule Pro updated from b5d9415 to 7dce70e

0 commit comments

Comments
 (0)