Fix AI enhancement icon fallback to use default prompt

This commit is contained in:
Beingpax 2025-08-07 13:45:53 +05:45
parent 3fc90b43be
commit acaa11923f
2 changed files with 7 additions and 1 deletions

View File

@ -161,6 +161,12 @@ class AIEnhancementService: ObservableObject {
}
guard let activePrompt = activePrompt else {
// Use default prompt when none is selected
if let defaultPrompt = allPrompts.first(where: { $0.id == PredefinedPrompts.defaultPromptId }) {
var systemMessage = String(format: AIPrompts.customPromptTemplate, defaultPrompt.promptText)
systemMessage += contextSection
return systemMessage
}
return AIPrompts.assistantMode + contextSection
}

View File

@ -137,7 +137,7 @@ struct RecorderPromptButton: View {
var body: some View {
RecorderToggleButton(
isEnabled: enhancementService.isEnhancementEnabled,
icon: enhancementService.activePrompt?.icon.rawValue ?? "brain",
icon: enhancementService.activePrompt?.icon.rawValue ?? enhancementService.allPrompts.first(where: { $0.id == PredefinedPrompts.defaultPromptId })?.icon.rawValue ?? "checkmark.seal.fill",
color: .blue,
disabled: false
) {