Skip to content

Commit

Permalink
fix: remove openai domain config
Browse files Browse the repository at this point in the history
  • Loading branch information
phlpsong committed Feb 1, 2024
1 parent 1109f1f commit 9579b3e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 49 deletions.
38 changes: 3 additions & 35 deletions Easydict/App/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -2613,39 +2613,7 @@
}
}
},
"service.configuration.openai.domain.placeholder" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "api.openai.com"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "api.openai.com"
}
}
}
},
"service.configuration.openai.domain.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Domain"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "域名"
}
}
}
},
"service.configuration.openai.endpoint_key.placeholder" : {
"service.configuration.openai.endpoint.placeholder" : {
"localizations" : {
"en" : {
"stringUnit" : {
Expand All @@ -2661,7 +2629,7 @@
}
}
},
"service.configuration.openai.endpoint_key.title" : {
"service.configuration.openai.endpoint.title" : {
"localizations" : {
"en" : {
"stringUnit" : {
Expand Down Expand Up @@ -3894,4 +3862,4 @@
}
},
"version" : "1.0"
}
}
3 changes: 2 additions & 1 deletion Easydict/Feature/Service/Gemini/GeminiService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 izual. All rights reserved.
//

import Defaults
import Foundation
import GoogleGenerativeAI

Expand Down Expand Up @@ -59,7 +60,7 @@ public final class GeminiService: QueryService {

// easydict://writeKeyValue?EZGeminiAPIKey=xxx
private var apiKey: String {
let apiKey = UserDefaults.standard.string(forKey: EZGeminiAPIKey)
let apiKey = Defaults[.geminiAPIKey]
if let apiKey, !apiKey.isEmpty {
return apiKey
} else {
Expand Down
1 change: 0 additions & 1 deletion Easydict/NewApp/Configuration/Configuration+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ extension Defaults.Keys {
static let openAIDictionary = Key<String>("EZOpenAIDictionaryKey", default: "1")
static let openAISentence = Key<String>("EZOpenAISentenceKey", default: "1")
static let openAIServiceUsageStatus = Key<String>("EZOpenAIServiceUsageStatusKey", default: "0")
static let openAIDomain = Key<String?>("EZOpenAIDomainKey")
static let openAIEndPoint = Key<String?>("EZOpenAIEndPointKey")
static let openAIModel = Key<String>("EZOpenAIModelKey", default: OpenAIModels.gpt3_5_turbo.rawValue)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@ extension EZOpenAIService: ConfigurableService {
key: .openAIAPIKey,
placeholder: "service.configuration.openai.api_key.placeholder"
)
// domain
// endpoint
ServiceConfigurationInputCell(
textFieldTitleKey: "service.configuration.openai.domain.title",
key: .openAIDomain,
placeholder: "service.configuration.openai.domain.placeholder"
)
// endpoint key
ServiceConfigurationInputCell(
textFieldTitleKey: "service.configuration.openai.endpoint_key.title",
textFieldTitleKey: "service.configuration.openai.endpoint.title",
key: .openAIEndPoint,
placeholder: "service.configuration.openai.endpoint_key.placeholder"
placeholder: "service.configuration.openai.endpoint.placeholder"
)
// model
ServiceConfigurationPickerCell(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ struct ServiceConfigurationToggleCell: View {
)

ServiceConfigurationInputCell(
textFieldTitleKey: "service.configuration.openai.domain.title",
key: .openAIDomain,
placeholder: "service.configuration.openai.domain.placeholder"
textFieldTitleKey: "service.configuration.openai.endpoint.title",
key: .openAIEndPoint,
placeholder: "service.configuration.openai.endpoint.placeholder"
)

// model
Expand Down

0 comments on commit 9579b3e

Please sign in to comment.