Skip to content

Commit 2b5d950

Browse files
committed
Update to setup scope according to settings
1 parent e1f4b54 commit 2b5d950

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

Core/Sources/ChatService/ChatService.swift

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,29 @@ public final class ChatService: ObservableObject {
6262
}
6363

6464
public func resetDefaultScopes() {
65-
if UserDefaults.shared.value(for: \.useCodeScopeByDefaultInChatContext) {
66-
memory.contextController.defaultScopes = ["code"]
67-
} else {
68-
memory.contextController.defaultScopes = ["file"]
65+
var scopes = Set<String>()
66+
67+
if UserDefaults.shared.value(for: \.enableFileScopeByDefaultInChatContext) {
68+
scopes.insert("file")
69+
}
70+
71+
if UserDefaults.shared.value(for: \.enableCodeScopeByDefaultInChatContext) {
72+
scopes.insert("code")
73+
}
74+
75+
if UserDefaults.shared.value(for: \.enableSenseScopeByDefaultInChatContext) {
76+
scopes.insert("sense")
6977
}
78+
79+
if UserDefaults.shared.value(for: \.enableProjectScopeByDefaultInChatContext) {
80+
scopes.insert("project")
81+
}
82+
83+
if UserDefaults.shared.value(for: \.enableWebScopeByDefaultInChatContext) {
84+
scopes.insert("web")
85+
}
86+
87+
memory.contextController.defaultScopes = scopes
7088
}
7189

7290
public func send(content: String) async throws {

0 commit comments

Comments
 (0)