Remove toggle switch for word replacements
This commit is contained in:
parent
dc925e0ebd
commit
5f59b61ee8
@ -123,10 +123,7 @@ class AudioTranscriptionManager: ObservableObject {
|
||||
text = WhisperTextFormatter.format(text)
|
||||
}
|
||||
|
||||
// Apply word replacements if enabled
|
||||
if UserDefaults.standard.bool(forKey: "IsWordReplacementEnabled") {
|
||||
text = WordReplacementService.shared.applyReplacements(to: text)
|
||||
}
|
||||
text = WordReplacementService.shared.applyReplacements(to: text)
|
||||
|
||||
// Handle enhancement if enabled
|
||||
if let enhancementService = whisperState.enhancementService,
|
||||
|
||||
@ -73,11 +73,8 @@ class AudioTranscriptionService: ObservableObject {
|
||||
text = WhisperTextFormatter.format(text)
|
||||
}
|
||||
|
||||
// Apply word replacements if enabled
|
||||
if UserDefaults.standard.bool(forKey: "IsWordReplacementEnabled") {
|
||||
text = WordReplacementService.shared.applyReplacements(to: text)
|
||||
logger.notice("✅ Word replacements applied")
|
||||
}
|
||||
text = WordReplacementService.shared.applyReplacements(to: text)
|
||||
logger.notice("✅ Word replacements applied")
|
||||
|
||||
// Get audio duration
|
||||
let audioAsset = AVURLAsset(url: url)
|
||||
|
||||
@ -22,16 +22,9 @@ class WordReplacementManager: ObservableObject {
|
||||
UserDefaults.standard.set(replacements, forKey: "wordReplacements")
|
||||
}
|
||||
}
|
||||
|
||||
@Published var isEnabled: Bool {
|
||||
didSet {
|
||||
UserDefaults.standard.set(isEnabled, forKey: "IsWordReplacementEnabled")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
init() {
|
||||
self.replacements = UserDefaults.standard.dictionary(forKey: "wordReplacements") as? [String: String] ?? [:]
|
||||
self.isEnabled = UserDefaults.standard.bool(forKey: "IsWordReplacementEnabled")
|
||||
}
|
||||
|
||||
func addReplacement(original: String, replacement: String) {
|
||||
@ -97,26 +90,15 @@ struct WordReplacementView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 20) {
|
||||
// Info Section with Toggle
|
||||
GroupBox {
|
||||
HStack {
|
||||
Label {
|
||||
Text("Define word replacements to automatically replace specific words or phrases")
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.frame(alignment: .leading)
|
||||
} icon: {
|
||||
Image(systemName: "info.circle.fill")
|
||||
.foregroundColor(.blue)
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
Toggle("Enable", isOn: $manager.isEnabled)
|
||||
.toggleStyle(.switch)
|
||||
.labelsHidden()
|
||||
.help("Enable automatic word replacement after transcription")
|
||||
Label {
|
||||
Text("Define word replacements to automatically replace specific words or phrases")
|
||||
.font(.system(size: 12))
|
||||
.foregroundColor(.secondary)
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
} icon: {
|
||||
Image(systemName: "info.circle.fill")
|
||||
.foregroundColor(.blue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -325,10 +325,8 @@ class WhisperState: NSObject, ObservableObject {
|
||||
logger.notice("📝 Formatted transcript: \(text, privacy: .public)")
|
||||
}
|
||||
|
||||
if UserDefaults.standard.bool(forKey: "IsWordReplacementEnabled") {
|
||||
text = WordReplacementService.shared.applyReplacements(to: text)
|
||||
logger.notice("📝 WordReplacement: \(text, privacy: .public)")
|
||||
}
|
||||
text = WordReplacementService.shared.applyReplacements(to: text)
|
||||
logger.notice("📝 WordReplacement: \(text, privacy: .public)")
|
||||
|
||||
let audioAsset = AVURLAsset(url: url)
|
||||
let actualDuration = (try? CMTimeGetSeconds(await audioAsset.load(.duration))) ?? 0.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user