Skip to content

Commit e129e4b

Browse files
committed
Autocorrecting rubocop offenses
1 parent d9a34d7 commit e129e4b

17 files changed

Lines changed: 57 additions & 57 deletions

File tree

.rubocop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ inherit_gem: { rubocop-rails-omakase: rubocop.yml }
44
# Overwrite or add rules to create your own house style
55
#
66
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
7-
Layout/SpaceInsideArrayLiteralBrackets:
8-
Enabled: false
7+
# Layout/SpaceInsideArrayLiteralBrackets:
8+
# Enabled: false
99

1010
AllCops:
1111
TargetRubyVersion: 3.3

activeagent.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Gem::Specification.new do |spec|
55
spec.version = ActiveAgent::VERSION
66
spec.summary = "Rails AI Agents Framework"
77
spec.description = "The only agent-oriented AI framework designed for Rails, where Agents are Controllers. Build AI features with less complexity using the MVC conventions you love."
8-
spec.authors = ["Justin Bowen"]
8+
spec.authors = [ "Justin Bowen" ]
99
spec.email = "jusbowen@gmail.com"
1010
spec.files = Dir["CHANGELOG.md", "README.rdoc", "MIT-LICENSE", "lib/**/*"]
1111
spec.require_paths = "lib"

lib/active_agent/action_prompt.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def collect_responses_from_block(headers, &block)
8585
end
8686

8787
def collect_responses_from_text(headers)
88-
[{
88+
[ {
8989
body: headers.delete(:body),
9090
content_type: headers[:content_type] || "text/plain"
91-
}]
91+
} ]
9292
end
9393

9494
def collect_responses_from_templates(headers)
@@ -97,7 +97,7 @@ def collect_responses_from_templates(headers)
9797
each_template(Array(templates_path), templates_name).map do |template|
9898
format = template.format || formats.first
9999
{
100-
body: render(template: template, formats: [format]),
100+
body: render(template: template, formats: [ format ]),
101101
content_type: Mime[format].to_s
102102
}
103103
end

lib/active_agent/action_prompt/collector.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def any(*args, &block)
2525

2626
def custom(mime, options = {})
2727
options.reverse_merge!(content_type: mime.to_s)
28-
@context.formats = [mime.to_sym]
28+
@context.formats = [ mime.to_sym ]
2929
options[:body] = block_given? ? yield : @default_render.call
3030
@responses << options
3131
end

lib/active_agent/action_prompt/prompt.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def headers(headers = {})
6868
private
6969

7070
def set_messages
71-
@messages = [Message.new(content: @instructions, role: :system)] + @messages if @instructions.present?
71+
@messages = [ Message.new(content: @instructions, role: :system) ] + @messages if @instructions.present?
7272
end
7373

7474
def set_message

lib/active_agent/base.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Base < AbstractController::Base
5353

5454
include ActionView::Layouts
5555

56-
PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + [:@_action_has_layout]
56+
PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + [ :@_action_has_layout ]
5757

5858
helper ActiveAgent::PromptHelper
5959

@@ -63,7 +63,7 @@ class Base < AbstractController::Base
6363
mime_version: "1.0",
6464
charset: "UTF-8",
6565
content_type: "text/plain",
66-
parts_order: ["text/plain", "text/enriched", "text/html"]
66+
parts_order: [ "text/plain", "text/enriched", "text/html" ]
6767
}.freeze
6868

6969
class << self
@@ -324,7 +324,7 @@ def prompt(headers = {}, &block)
324324
def action_schemas
325325
action_methods.map do |action|
326326
if action != "text_prompt"
327-
JSON.parse render_to_string(locals: {action_name: action}, action: action, formats: :json)
327+
JSON.parse render_to_string(locals: { action_name: action }, action: action, formats: :json)
328328
end
329329
end.compact
330330
end
@@ -345,7 +345,7 @@ def set_content_type(m, user_content_type, class_default) # :doc:
345345
# If the subject has interpolations, you can pass them through the +interpolations+ parameter.
346346
def default_i18n_subject(interpolations = {}) # :doc:
347347
agent_scope = self.class.agent_name.tr("/", ".")
348-
I18n.t(:subject, **interpolations.merge(scope: [agent_scope, action_name], default: action_name.humanize))
348+
I18n.t(:subject, **interpolations.merge(scope: [ agent_scope, action_name ], default: action_name.humanize))
349349
end
350350

351351
def apply_defaults(headers)
@@ -390,10 +390,10 @@ def collect_responses_from_block(headers)
390390
end
391391

392392
def collect_responses_from_text(headers)
393-
[{
393+
[ {
394394
body: headers.delete(:body),
395395
content_type: headers[:content_type] || "text/plain"
396-
}]
396+
} ]
397397
end
398398

399399
def collect_responses_from_templates(headers)
@@ -405,7 +405,7 @@ def collect_responses_from_templates(headers)
405405

406406
format = template.format || formats.first
407407
{
408-
body: render(template: template, formats: [format]),
408+
body: render(template: template, formats: [ format ]),
409409
content_type: Mime[format].to_s
410410
}
411411
end.compact

lib/active_agent/generation_provider/open_ai_provider.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def provider_messages(messages)
7878
}.compact
7979

8080
if message.content_type == "image_url"
81-
provider_message[:image_url] = {url: message.content}
81+
provider_message[:image_url] = { url: message.content }
8282
end
8383
provider_message
8484
end
@@ -110,7 +110,7 @@ def handle_actions(tool_calls)
110110

111111
tool_calls.map do |tool_call|
112112
next if tool_call["function"].nil? || tool_call["function"]["name"].blank?
113-
args = tool_call["function"]["arguments"].blank? ? nil : JSON.parse(tool_call["function"]["arguments"], {symbolize_names: true})
113+
args = tool_call["function"]["arguments"].blank? ? nil : JSON.parse(tool_call["function"]["arguments"], { symbolize_names: true })
114114

115115
ActiveAgent::ActionPrompt::Action.new(
116116
id: tool_call["id"],

lib/active_agent/preview.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module Previews # :nodoc:
1111

1212
mattr_accessor :show_previews, instance_writer: false
1313

14-
mattr_accessor :preview_interceptors, instance_writer: false, default: [ActiveAgent::InlinePreviewInterceptor]
14+
mattr_accessor :preview_interceptors, instance_writer: false, default: [ ActiveAgent::InlinePreviewInterceptor ]
1515
end
1616

1717
module ClassMethods

lib/active_agent/railtie.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Railtie < Rails::Railtie # :nodoc:
2929
options.stylesheets_dir ||= paths["public/stylesheets"].first
3030
options.show_previews = Rails.env.development? if options.show_previews.nil?
3131
options.cache_store ||= Rails.cache
32-
options.preview_paths |= ["#{Rails.root}/test/agents/previews"]
32+
options.preview_paths |= [ "#{Rails.root}/test/agents/previews" ]
3333

3434
# make sure readers methods get compiled
3535
options.asset_host ||= app.config.asset_host
@@ -45,7 +45,7 @@ class Railtie < Rails::Railtie # :nodoc:
4545
register_interceptors(options.delete(:interceptors))
4646
register_preview_interceptors(options.delete(:preview_interceptors))
4747
register_observers(options.delete(:observers))
48-
self.view_paths = ["#{Rails.root}/app/views"]
48+
self.view_paths = [ "#{Rails.root}/app/views" ]
4949
self.preview_paths |= options[:preview_paths]
5050

5151
if (generation_job = options.delete(:generation_job))

spec/active_agent/action_prompt/message_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@
5252
message = described_class.new(
5353
role: "user",
5454
content: "hello",
55-
requested_actions: ["action1", "action2"]
55+
requested_actions: [ "action1", "action2" ]
5656
)
5757
expect(message.to_h).to eq({
5858
role: "user",
5959
content: "hello",
6060
action_requested: true,
61-
requested_actions: ["action1", "action2"]
61+
requested_actions: [ "action1", "action2" ]
6262
})
6363
end
6464
end

0 commit comments

Comments
 (0)