- import Foundation
- enum OpenAIConfiguration {
- /// Read key from Info.plist (`OPENAI_API_KEY`) populated by build settings.
- static var apiKey: String {
- let fromPlist = Bundle.main.object(forInfoDictionaryKey: "OPENAI_API_KEY") as? String ?? ""
- return fromPlist.trimmingCharacters(in: .whitespacesAndNewlines)
- }
- /// Whether `apiKey` is currently populated with a real value.
- static var hasAPIKey: Bool {
- !apiKey.isEmpty
- }
- }
|