diff --git a/lib/ai_helper/assistant.rb b/lib/ai_helper/assistant.rb index 3bf198389..2fc5bcdf8 100644 --- a/lib/ai_helper/assistant.rb +++ b/lib/ai_helper/assistant.rb @@ -125,6 +125,11 @@ def generate_prompt( custom_instructions: custom_locale_instructions(user, force_default_locale), ) context = attach_user_context(context, user, force_default_locale: force_default_locale) + context.messages.each do |msg| + if msg[:content].is_a?(Array) + msg[:content] = msg[:content].map(&:to_s).join("\n") + end + end helper_response = +"" @@ -248,6 +253,11 @@ def generate_image_caption(upload, user) ], custom_instructions: custom_locale_instructions(user, force_default_locale), ) + context.messages.each do |msg| + if msg[:content].is_a?(Array) + msg[:content] = msg[:content].map(&:to_s).join("\n") + end + end structured_output = nil