Add some voices

This commit is contained in:
Jackson Harper
2023-11-08 19:36:34 +08:00
parent e395036e61
commit 155d71c7bd
6 changed files with 18 additions and 7 deletions

View File

@ -1400,7 +1400,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.36.0;
MARKETING_VERSION = 1.37.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app;
@ -1435,7 +1435,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.36.0;
MARKETING_VERSION = 1.37.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app;
PRODUCT_NAME = "$(TARGET_NAME)";
@ -1490,7 +1490,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.36.0;
MARKETING_VERSION = 1.37.0;
PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app;
PRODUCT_NAME = Omnivore;
PROVISIONING_PROFILE_SPECIFIER = "";
@ -1831,7 +1831,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.36.0;
MARKETING_VERSION = 1.37.0;
PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app;
PRODUCT_NAME = Omnivore;
PROVISIONING_PROFILE_SPECIFIER = "";

View File

@ -103,7 +103,7 @@ public extension AppEnvironment {
case .prod:
return URL(string: prodTtsURL)!
case .test, .local:
return URL(string: "http://localhost:4000")!
return URL(string: "http://localhost:8080")!
case .custom:
guard
let str = UserDefaults.standard.string(forKey: AppEnvironmentUserDefaultKey.ttsBaseURL.rawValue),

View File

@ -875,6 +875,7 @@
let result: (Data, URLResponse)? = try? await URLSession.shared.data(for: request)
guard let httpResponse = result?.1 as? HTTPURLResponse, 200 ..< 300 ~= httpResponse.statusCode else {
print("HTTP respooinse", result?.1 as? HTTPURLResponse)
throw BasicError.message(messageText: "audioFetch failed. no response or bad status code.")
}

View File

@ -17,6 +17,7 @@ struct UtteranceRequest: Codable {
let language: String
let rate: String
let isUltraRealisticVoice: Bool
let isOpenAIVoice: Bool
}
struct Utterance: Decodable {
@ -32,7 +33,8 @@ struct Utterance: Decodable {
voice: usedVoice,
language: document.language,
rate: "1.1",
isUltraRealisticVoice: Voices.isUltraRealisticVoice(usedVoice))
isUltraRealisticVoice: Voices.isUltraRealisticVoice(usedVoice),
isOpenAIVoice: Voices.isOpenAIVoice(usedVoice))
return try JSONEncoder().encode(request)
}
}

View File

@ -61,6 +61,10 @@ public enum Voices {
voice.firstKey == voiceKey || voice.secondKey == voiceKey
})
}
public static func isOpenAIVoice(_ voiceKey: String) -> Bool {
return voiceKey.starts(with: "openai-")
}
public static let English = VoiceLanguage(key: "en",
name: "English",
@ -81,6 +85,10 @@ public enum Voices {
]
public static let Pairs = [
VoicePair(firstKey: "openai-alloy", secondKey: "openai-echo", firstName: "Alloy", secondName: "Echo", language: "en-US", category: .enUS),
VoicePair(firstKey: "openai-fable", secondKey: "openai-onyx", firstName: "Fable", secondName: "Onyx", language: "en-US", category: .enUS),
VoicePair(firstKey: "openai-nova", secondKey: "openai-shimmer", firstName: "Nova", secondName: "Shimmer", language: "en-US", category: .enUS),
VoicePair(firstKey: "en-US-JennyNeural", secondKey: "en-US-BrandonNeural", firstName: "Jenny", secondName: "Brandon", language: "en-US", category: .enUS),
VoicePair(firstKey: "en-US-CoraNeural", secondKey: "en-US-ChristopherNeural", firstName: "Cora", secondName: "Christopher", language: "en-US", category: .enUS),
VoicePair(firstKey: "en-US-ElizabethNeural", secondKey: "en-US-EricNeural", firstName: "Elizabeth", secondName: "Eric", language: "en-US", category: .enUS),

View File

@ -241,7 +241,7 @@ public struct LibraryItemCard: View {
var imageBox: some View {
ZStack(alignment: .bottomLeading) {
if let imageURL = item.imageURL {
AsyncImage(url: imageURL) { phase in
CachedAsyncImage(url: imageURL) { phase in
if let image = phase.image {
image
.resizable()