File tree Expand file tree Collapse file tree
Core/AI/AppleIntelligence Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33// TablePro
44//
55
6+ import AppKit
67import Foundation
78#if canImport(FoundationModels)
89import FoundationModels
910#endif
1011
1112enum AppleIntelligenceAvailability {
13+ static func openSystemSettings( ) {
14+ let identifiers = [
15+ " x-apple.systempreferences:com.apple.Siri-Settings.extension " ,
16+ " x-apple.systempreferences: "
17+ ]
18+ for identifier in identifiers {
19+ if let url = URL ( string: identifier) , NSWorkspace . shared. open ( url) {
20+ return
21+ }
22+ }
23+ }
24+
1225 static func currentStatus( ) -> AppleIntelligenceStatus {
1326 #if canImport(FoundationModels)
1427 guard #available( macOS 26 , * ) else { return . osNotSupported }
Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ struct AIChatMessageView: View {
2323 }
2424 }
2525
26+ private var modelLabel : String ? {
27+ guard let modelId = message. modelId, !modelId. isEmpty else { return nil }
28+ if modelId == AIProviderType . appleIntelligenceModelID {
29+ return AIProviderType . appleIntelligence. displayName
30+ }
31+ return modelId
32+ }
33+
2634 var body : some View {
2735 VStack ( alignment: . leading, spacing: 4 ) {
2836 if message. role == . user {
@@ -77,8 +85,8 @@ struct AIChatMessageView: View {
7785 . buttonStyle ( . plain)
7886 . foregroundStyle ( . secondary)
7987 }
80- if let modelId = message . modelId , !modelId . isEmpty {
81- Text ( modelId )
88+ if let modelLabel {
89+ Text ( modelLabel )
8290 . font ( . caption2)
8391 . foregroundStyle ( . tertiary)
8492 . lineLimit ( 1 )
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ struct AIProviderDetailSheet: View {
161161 }
162162 if appleIntelligenceStatus. canOpenSystemSettings {
163163 Button ( String ( localized: " Open System Settings " ) ) {
164- openAppleIntelligenceSystemSettings ( )
164+ AppleIntelligenceAvailability . openSystemSettings ( )
165165 }
166166 }
167167 } header: {
@@ -173,18 +173,6 @@ struct AIProviderDetailSheet: View {
173173 }
174174 }
175175
176- private func openAppleIntelligenceSystemSettings( ) {
177- let identifiers = [
178- " x-apple.systempreferences:com.apple.Siri-Settings.extension " ,
179- " x-apple.systempreferences: "
180- ]
181- for identifier in identifiers {
182- if let url = URL ( string: identifier) , NSWorkspace . shared. open ( url) {
183- return
184- }
185- }
186- }
187-
188176 private var apiKeyAuthSection : some View {
189177 Section {
190178 SecureField ( String ( localized: " API Key " ) , text: $apiKey)
Original file line number Diff line number Diff line change @@ -234,19 +234,7 @@ struct AISettingsView: View {
234234 return
235235 }
236236 if appleIntelligenceStatus. canOpenSystemSettings {
237- openAppleIntelligenceSystemSettings ( )
238- }
239- }
240-
241- private func openAppleIntelligenceSystemSettings( ) {
242- let identifiers = [
243- " x-apple.systempreferences:com.apple.Siri-Settings.extension " ,
244- " x-apple.systempreferences: "
245- ]
246- for identifier in identifiers {
247- if let url = URL ( string: identifier) , NSWorkspace . shared. open ( url) {
248- return
249- }
237+ AppleIntelligenceAvailability . openSystemSettings ( )
250238 }
251239 }
252240
You can’t perform that action at this time.
0 commit comments