- Add Vision framework integration for image analysis (OCR, classification) - Add image attachment support in chat UI with drag & drop - Add recent images sidebar from Downloads/Desktop - Add copy to clipboard button for assistant responses - Add gRPC reflection service with toggle in settings - Create proper .proto file and generate Swift code - Add server restart when toggling reflection setting - Fix port number formatting in settings (remove comma grouping) - Update gRPC dependencies to v2.x 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
67 lines
2.1 KiB
Swift
67 lines
2.1 KiB
Swift
import SwiftUI
|
|
|
|
struct SettingsView: View {
|
|
@Bindable var settings: AppSettings
|
|
var serverManager: ServerManager?
|
|
@Environment(\.dismiss) private var dismiss
|
|
|
|
var body: some View {
|
|
Form {
|
|
Section("Server Configuration") {
|
|
TextField("Host", text: $settings.host)
|
|
.textFieldStyle(.roundedBorder)
|
|
|
|
TextField("Port", value: $settings.port, format: .number.grouping(.never))
|
|
.textFieldStyle(.roundedBorder)
|
|
|
|
SecureField("API Key (optional)", text: $settings.apiKey)
|
|
.textFieldStyle(.roundedBorder)
|
|
}
|
|
|
|
Section("Behavior") {
|
|
Toggle("Launch at login", isOn: $settings.launchAtLogin)
|
|
Toggle("Auto-start server on launch", isOn: $settings.autoStartServer)
|
|
}
|
|
|
|
Section("API") {
|
|
Toggle("Enable gRPC reflection", isOn: $settings.enableReflection)
|
|
.onChange(of: settings.enableReflection) { _, _ in
|
|
serverManager?.restart()
|
|
}
|
|
}
|
|
|
|
Section {
|
|
HStack {
|
|
Button("Reset to Defaults") {
|
|
settings.resetToDefaults()
|
|
}
|
|
|
|
Spacer()
|
|
|
|
Button("Done") {
|
|
dismiss()
|
|
}
|
|
.keyboardShortcut(.defaultAction)
|
|
}
|
|
}
|
|
}
|
|
.formStyle(.grouped)
|
|
.frame(width: 400, height: 380)
|
|
.fixedSize()
|
|
.onAppear {
|
|
NSApp.setActivationPolicy(.regular)
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
if let window = NSApp.windows.first(where: { $0.title == "Settings" }) {
|
|
window.makeKeyAndOrderFront(nil)
|
|
}
|
|
}
|
|
}
|
|
.onDisappear {
|
|
if NSApp.windows.filter({ $0.isVisible && $0.title != "" }).isEmpty {
|
|
NSApp.setActivationPolicy(.accessory)
|
|
}
|
|
}
|
|
}
|
|
}
|