| 123456789101112131415161718 |
- import Foundation
- enum AIConfiguration {
- /// OpenAI API key used by Post Generator, Title Optimizer, and Comment Writer.
- /// Priority: `OPENAI_API_KEY` environment variable (dev builds), then bundled encrypted key.
- static var apiKey: String? {
- if let envKey = ProcessInfo.processInfo.environment["OPENAI_API_KEY"],
- !envKey.trimmingCharacters(in: .whitespaces).isEmpty {
- return envKey.trimmingCharacters(in: .whitespaces)
- }
- return EncryptedOpenAIKey.openAIAPIKey()
- }
- static func usesLiveAI(hasPremiumAccess: Bool) -> Bool {
- hasPremiumAccess && apiKey != nil
- }
- }
|