Add Apple Intelligence provider (Phase 1 — on-device)
- New AppleFoundationProvider using FoundationModels framework (macOS 27+) - Streaming via streamResponse(to:) → ResponseStream<String> snapshot deltas - Session built with system prompt + conversation history injected as instructions text - Full error mapping: context exceeded, guardrail violation, rate limit, availability states - Settings.Provider.appleOnDevice case wired through ProviderRegistry, Color+Extensions, CreditsView - inferProvider() detects "apple-" prefix model IDs - Settings → General: Apple Intelligence section with live availability badge and deep link to System Settings Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -58,17 +58,25 @@ struct Settings: Codable {
|
||||
case anthropic
|
||||
case openai
|
||||
case ollama
|
||||
|
||||
case appleOnDevice = "apple_on_device"
|
||||
|
||||
var displayName: String {
|
||||
rawValue.capitalized
|
||||
switch self {
|
||||
case .openrouter: return "OpenRouter"
|
||||
case .anthropic: return "Anthropic"
|
||||
case .openai: return "OpenAI"
|
||||
case .ollama: return "Ollama"
|
||||
case .appleOnDevice: return "Apple Intelligence"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var iconName: String {
|
||||
switch self {
|
||||
case .openrouter: return "network"
|
||||
case .anthropic: return "brain"
|
||||
case .openai: return "sparkles"
|
||||
case .ollama: return "server.rack"
|
||||
case .openrouter: return "network"
|
||||
case .anthropic: return "brain"
|
||||
case .openai: return "sparkles"
|
||||
case .ollama: return "server.rack"
|
||||
case .appleOnDevice: return "apple.logo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user