#{I18n.t("discourse_ai.ai_bot.command_summary.#{self.class.name}")}
            
              #{I18n.t("discourse_ai.ai_bot.command_description.#{self.class.name}", self.description_args)}
            
           
          HTML
          raw << custom_raw if custom_raw.present?
          raw = post.raw.sub(placeholder, raw)
          if chain_next_response
            post.raw = raw
            post.save!(validate: false)
          else
            post.revise(bot_user, { raw: raw }, skip_validations: true, skip_revision: true)
          end
          [chain_next_response, post]
        end
        def format_results(rows, column_names = nil, args: nil)
          rows = rows.map { |row| yield row } if block_given?
          if !column_names
            index = -1
            column_indexes = {}
            rows =
              rows.map do |data|
                new_row = []
                data.each do |key, value|
                  found_index = column_indexes[key.to_s] ||= (index += 1)
                  new_row[found_index] = value
                end
                new_row
              end
            column_names = column_indexes.keys
          end
          # this is not the most efficient format
          # however this is needed cause GPT 3.5 / 4 was steered using JSON
          result = { column_names: column_names, rows: rows }
          result[:args] = args if args
          result
        end
        protected
        attr_reader :bot_user, :args
      end
    end
  end
end