diff --git a/app/controllers/entries_controller.rb b/app/controllers/entries_controller.rb
index e872ced6..b237c8e7 100644
--- a/app/controllers/entries_controller.rb
+++ b/app/controllers/entries_controller.rb
@@ -279,7 +279,7 @@ def process_as_ai
def respond_to_ai
if current_user.can_ai?
- @entry.body += "
👤 You:
#{params[:entry][:ai_response]}"
+ @entry.body += "
👤 You:
#{ActionController::Base.helpers.simple_format(params[:entry][:ai_response])}"
if params[:entry][:ai_response].present? && @entry.save
AiEntryJob.perform_later(current_user.id, @entry.id, email: false)
flash[:notice] = "DabbleMeGPT response is generating."
diff --git a/app/models/concerns/entry/ai_assistant.rb b/app/models/concerns/entry/ai_assistant.rb
index f12f6dc4..56833679 100644
--- a/app/models/concerns/entry/ai_assistant.rb
+++ b/app/models/concerns/entry/ai_assistant.rb
@@ -33,9 +33,9 @@ def respond_as_ai(messages)
max_tokens: MAX_RESPONSE_TOKENS
}
)
- if resp["choices"].present?
- resp.dig("choices", 0, "message", "content")
- end
+ return unless resp["choices"].present?
+
+ resp.dig("choices", 0, "message", "content")
end
def as_life_coach