Skip to content

Commit 896ecf8

Browse files
committed
Add settings views
1 parent 1dfc3f1 commit 896ecf8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Core/Sources/HostApp/FeatureSettings/ChatSettingsView.swift

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ struct ChatSettingsView: View {
44
class Settings: ObservableObject {
55
@AppStorage(\.chatFontSize) var chatFontSize
66
@AppStorage(\.chatCodeFontSize) var chatCodeFontSize
7+
@AppStorage(\.embedFileContentInChatContextIfNoSelection)
8+
var embedFileContentInChatContextIfNoSelection
9+
@AppStorage(\.maxEmbeddableFileInChatContextLineCount)
10+
var maxEmbeddableFileInChatContextLineCount
711
init() {}
812
}
913

@@ -36,6 +40,33 @@ struct ChatSettingsView: View {
3640

3741
Text("pt")
3842
}
43+
44+
Divider()
45+
46+
Toggle(isOn: $settings.embedFileContentInChatContextIfNoSelection) {
47+
Text("Embed file content in chat context if no code is selected.")
48+
}
49+
50+
HStack {
51+
TextField(text: .init(get: {
52+
"\(Int(settings.maxEmbeddableFileInChatContextLineCount))"
53+
}, set: {
54+
settings.maxEmbeddableFileInChatContextLineCount = Int($0) ?? 0
55+
})) {
56+
Text("Max embeddable file")
57+
}
58+
.textFieldStyle(.roundedBorder)
59+
60+
Text("lines")
61+
}
3962
}
4063
}
4164
}
65+
66+
// MARK: - Preview
67+
68+
struct ChatSettingsView_Previews: PreviewProvider {
69+
static var previews: some View {
70+
ChatSettingsView()
71+
}
72+
}

0 commit comments

Comments
 (0)