rcrewai-rails 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/rcrewai/rails/agents_controller.rb +64 -0
- data/app/controllers/rcrewai/rails/api/v1/crews_controller.rb +55 -0
- data/app/controllers/rcrewai/rails/api/v1/executions_controller.rb +52 -0
- data/app/controllers/rcrewai/rails/crews_controller.rb +1 -1
- data/app/controllers/rcrewai/rails/executions_controller.rb +2 -2
- data/app/controllers/rcrewai/rails/tasks_controller.rb +76 -0
- data/app/controllers/rcrewai/rails/tools_controller.rb +61 -0
- data/app/models/rcrewai/rails/agent.rb +2 -2
- data/app/models/rcrewai/rails/task.rb +2 -6
- data/app/models/rcrewai/rails/tool.rb +26 -0
- data/app/views/rcrewai/rails/agents/edit.html.erb +107 -0
- data/app/views/rcrewai/rails/agents/index.html.erb +81 -0
- data/app/views/rcrewai/rails/agents/new.html.erb +103 -0
- data/app/views/rcrewai/rails/agents/show.html.erb +136 -0
- data/app/views/rcrewai/rails/crews/edit.html.erb +87 -0
- data/app/views/rcrewai/rails/crews/index.html.erb +1 -1
- data/app/views/rcrewai/rails/crews/new.html.erb +75 -0
- data/app/views/rcrewai/rails/executions/index.html.erb +91 -0
- data/app/views/rcrewai/rails/executions/show.html.erb +1 -1
- data/app/views/rcrewai/rails/tasks/edit.html.erb +105 -0
- data/app/views/rcrewai/rails/tasks/index.html.erb +82 -0
- data/app/views/rcrewai/rails/tasks/new.html.erb +101 -0
- data/app/views/rcrewai/rails/tasks/show.html.erb +129 -0
- data/app/views/rcrewai/rails/tools/edit.html.erb +60 -0
- data/app/views/rcrewai/rails/tools/index.html.erb +48 -0
- data/app/views/rcrewai/rails/tools/new.html.erb +56 -0
- data/app/views/rcrewai/rails/tools/show.html.erb +47 -0
- data/db/migrate/001_add_agent_to_tasks.rb +25 -0
- data/lib/rcrewai/rails/engine.rb +16 -10
- data/lib/rcrewai/rails/version.rb +1 -1
- metadata +24 -2
- /data/lib/{rcrewai-rails.rb → rcrewai_rails.rb} +0 -0
@@ -0,0 +1,103 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>New Agent</h1>
|
3
|
+
<div class="actions">
|
4
|
+
<% if @agent.crew %>
|
5
|
+
<%= link_to "Back to Crew", @agent.crew, class: "btn" %>
|
6
|
+
<% else %>
|
7
|
+
<%= link_to "All Agents", agents_path, class: "btn" %>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="form-container">
|
13
|
+
<%= form_with model: [@crew, @agent].compact, local: true do |form| %>
|
14
|
+
<% if @agent.errors.any? %>
|
15
|
+
<div class="alert alert-error">
|
16
|
+
<h4><%= pluralize(@agent.errors.count, "error") %> prohibited this agent from being saved:</h4>
|
17
|
+
<ul>
|
18
|
+
<% @agent.errors.full_messages.each do |message| %>
|
19
|
+
<li><%= message %></li>
|
20
|
+
<% end %>
|
21
|
+
</ul>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<div class="form-group">
|
26
|
+
<%= form.label :name, class: "form-label" %>
|
27
|
+
<%= form.text_field :name, class: "form-input", required: true %>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="form-group">
|
31
|
+
<%= form.label :role, class: "form-label" %>
|
32
|
+
<%= form.text_field :role, class: "form-input", required: true %>
|
33
|
+
<span class="form-help">The role this agent plays in the crew</span>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="form-group">
|
37
|
+
<%= form.label :goal, class: "form-label" %>
|
38
|
+
<%= form.text_area :goal, class: "form-input", rows: 3, required: true %>
|
39
|
+
<span class="form-help">What this agent is trying to achieve</span>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="form-group">
|
43
|
+
<%= form.label :backstory, class: "form-label" %>
|
44
|
+
<%= form.text_area :backstory, class: "form-input", rows: 4, required: true %>
|
45
|
+
<span class="form-help">The agent's background and experience</span>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
<% unless @crew %>
|
49
|
+
<div class="form-group">
|
50
|
+
<%= form.label :crew_id, "Crew", class: "form-label" %>
|
51
|
+
<%= form.select :crew_id,
|
52
|
+
options_from_collection_for_select(RcrewAI::Rails::Crew.all, :id, :name, @agent.crew_id),
|
53
|
+
{ prompt: 'Select a crew (optional)' },
|
54
|
+
{ class: "form-select" } %>
|
55
|
+
</div>
|
56
|
+
<% end %>
|
57
|
+
|
58
|
+
<div class="form-group">
|
59
|
+
<%= form.label :verbose, class: "form-label" %>
|
60
|
+
<%= form.check_box :verbose, class: "form-checkbox" %>
|
61
|
+
<span class="form-help">Enable verbose logging for this agent</span>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<div class="form-group">
|
65
|
+
<%= form.label :allow_delegation, class: "form-label" %>
|
66
|
+
<%= form.check_box :allow_delegation, class: "form-checkbox" %>
|
67
|
+
<span class="form-help">Allow this agent to delegate tasks to other agents</span>
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div class="form-group">
|
71
|
+
<%= form.label :max_iter, "Max Iterations", class: "form-label" %>
|
72
|
+
<%= form.number_field :max_iter, class: "form-input", min: 1 %>
|
73
|
+
<span class="form-help">Maximum number of iterations (optional)</span>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
<div class="form-group">
|
77
|
+
<%= form.label :max_execution_time, "Max Execution Time (seconds)", class: "form-label" %>
|
78
|
+
<%= form.number_field :max_execution_time, class: "form-input", min: 1 %>
|
79
|
+
<span class="form-help">Maximum execution time in seconds (optional)</span>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
<div class="form-group">
|
83
|
+
<%= form.label :llm_config, "LLM Configuration (JSON)", class: "form-label" %>
|
84
|
+
<%= form.text_area :llm_config, class: "form-input", rows: 3 %>
|
85
|
+
<span class="form-help">LLM configuration in JSON format (optional)</span>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
<div class="form-group">
|
89
|
+
<%= form.label :tools_config, "Tools Configuration (JSON)", class: "form-label" %>
|
90
|
+
<%= form.text_area :tools_config, class: "form-input", rows: 3 %>
|
91
|
+
<span class="form-help">Tools configuration in JSON format (optional)</span>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
<div class="form-actions">
|
95
|
+
<%= form.submit "Create Agent", class: "btn btn-primary" %>
|
96
|
+
<% if @crew %>
|
97
|
+
<%= link_to "Cancel", @crew, class: "btn btn-secondary" %>
|
98
|
+
<% else %>
|
99
|
+
<%= link_to "Cancel", agents_path, class: "btn btn-secondary" %>
|
100
|
+
<% end %>
|
101
|
+
</div>
|
102
|
+
<% end %>
|
103
|
+
</div>
|
@@ -0,0 +1,136 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1><%= @agent.name %></h1>
|
3
|
+
<div class="actions">
|
4
|
+
<%= link_to "Edit Agent", edit_agent_path(@agent), class: "btn btn-primary" %>
|
5
|
+
<%= link_to "Manage Tools", agent_tools_path(@agent), class: "btn" %>
|
6
|
+
<% if @agent.crew %>
|
7
|
+
<%= link_to "Back to Crew", @agent.crew, class: "btn" %>
|
8
|
+
<% else %>
|
9
|
+
<%= link_to "All Agents", agents_path, class: "btn" %>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<div class="agent-details">
|
15
|
+
<div class="details-grid">
|
16
|
+
<div class="detail-section">
|
17
|
+
<h3>Basic Information</h3>
|
18
|
+
<div class="detail-item">
|
19
|
+
<strong>Role:</strong> <%= @agent.role %>
|
20
|
+
</div>
|
21
|
+
<div class="detail-item">
|
22
|
+
<strong>Goal:</strong>
|
23
|
+
<p><%= @agent.goal %></p>
|
24
|
+
</div>
|
25
|
+
<div class="detail-item">
|
26
|
+
<strong>Backstory:</strong>
|
27
|
+
<p><%= @agent.backstory %></p>
|
28
|
+
</div>
|
29
|
+
<% if @agent.crew %>
|
30
|
+
<div class="detail-item">
|
31
|
+
<strong>Crew:</strong> <%= link_to @agent.crew.name, @agent.crew %>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="detail-section">
|
37
|
+
<h3>Configuration</h3>
|
38
|
+
<div class="detail-item">
|
39
|
+
<strong>Status:</strong>
|
40
|
+
<span class="badge <%= @agent.active ? 'badge-success' : 'badge-warning' %>">
|
41
|
+
<%= @agent.active ? 'Active' : 'Inactive' %>
|
42
|
+
</span>
|
43
|
+
</div>
|
44
|
+
<div class="detail-item">
|
45
|
+
<strong>Verbose Logging:</strong>
|
46
|
+
<span class="badge <%= @agent.verbose ? 'badge-info' : 'badge-secondary' %>">
|
47
|
+
<%= @agent.verbose ? 'Enabled' : 'Disabled' %>
|
48
|
+
</span>
|
49
|
+
</div>
|
50
|
+
<div class="detail-item">
|
51
|
+
<strong>Allow Delegation:</strong>
|
52
|
+
<span class="badge <%= @agent.allow_delegation ? 'badge-success' : 'badge-secondary' %>">
|
53
|
+
<%= @agent.allow_delegation ? 'Enabled' : 'Disabled' %>
|
54
|
+
</span>
|
55
|
+
</div>
|
56
|
+
<% if @agent.max_iter %>
|
57
|
+
<div class="detail-item">
|
58
|
+
<strong>Max Iterations:</strong> <%= @agent.max_iter %>
|
59
|
+
</div>
|
60
|
+
<% end %>
|
61
|
+
<% if @agent.max_execution_time %>
|
62
|
+
<div class="detail-item">
|
63
|
+
<strong>Max Execution Time:</strong> <%= @agent.max_execution_time %> seconds
|
64
|
+
</div>
|
65
|
+
<% end %>
|
66
|
+
</div>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
<% if @agent.llm_config.present? %>
|
70
|
+
<div class="detail-section">
|
71
|
+
<h3>LLM Configuration</h3>
|
72
|
+
<pre class="code-block"><%= JSON.pretty_generate(@agent.llm_config) %></pre>
|
73
|
+
</div>
|
74
|
+
<% end %>
|
75
|
+
|
76
|
+
<% if @agent.tools_config.present? %>
|
77
|
+
<div class="detail-section">
|
78
|
+
<h3>Tools Configuration</h3>
|
79
|
+
<pre class="code-block"><%= JSON.pretty_generate(@agent.tools_config) %></pre>
|
80
|
+
</div>
|
81
|
+
<% end %>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
<div class="related-sections">
|
85
|
+
<div class="section">
|
86
|
+
<div class="section-header">
|
87
|
+
<h2>Tools (<%= @tools.count %>)</h2>
|
88
|
+
<%= link_to "Manage Tools", agent_tools_path(@agent), class: "btn btn-sm" %>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<% if @tools.any? %>
|
92
|
+
<div class="tools-list">
|
93
|
+
<% @tools.each do |tool| %>
|
94
|
+
<div class="tool-item">
|
95
|
+
<h4><%= link_to tool.name, [@agent, tool] %></h4>
|
96
|
+
<p><%= truncate(tool.description, length: 100) %></p>
|
97
|
+
<span class="badge"><%= tool.tool_class %></span>
|
98
|
+
<% unless tool.active %>
|
99
|
+
<span class="badge badge-warning">Inactive</span>
|
100
|
+
<% end %>
|
101
|
+
</div>
|
102
|
+
<% end %>
|
103
|
+
</div>
|
104
|
+
<% else %>
|
105
|
+
<p>No tools configured for this agent.</p>
|
106
|
+
<% end %>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<div class="section">
|
110
|
+
<div class="section-header">
|
111
|
+
<h2>Tasks (<%= @agent.tasks.count %>)</h2>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
<% if @agent.tasks.any? %>
|
115
|
+
<div class="tasks-list">
|
116
|
+
<% @agent.tasks.each do |task| %>
|
117
|
+
<div class="task-item">
|
118
|
+
<h4><%= link_to "Task ##{task.id}", task %></h4>
|
119
|
+
<p><%= truncate(task.description, length: 100) %></p>
|
120
|
+
<% unless task.active %>
|
121
|
+
<span class="badge badge-warning">Inactive</span>
|
122
|
+
<% end %>
|
123
|
+
</div>
|
124
|
+
<% end %>
|
125
|
+
</div>
|
126
|
+
<% else %>
|
127
|
+
<p>No tasks assigned to this agent.</p>
|
128
|
+
<% end %>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
<div class="danger-zone">
|
133
|
+
<%= link_to "Delete Agent", @agent, method: :delete,
|
134
|
+
confirm: "Are you sure you want to delete this agent? This action cannot be undone.",
|
135
|
+
class: "btn btn-danger" %>
|
136
|
+
</div>
|
@@ -0,0 +1,87 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>Edit Crew: <%= @crew.name %></h1>
|
3
|
+
<div class="actions">
|
4
|
+
<%= link_to "View Crew", @crew, class: "btn" %>
|
5
|
+
<%= link_to "Back to Crews", crews_path, class: "btn" %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="form-container">
|
10
|
+
<%= form_with model: @crew, local: true do |form| %>
|
11
|
+
<% if @crew.errors.any? %>
|
12
|
+
<div class="alert alert-error">
|
13
|
+
<h4><%= pluralize(@crew.errors.count, "error") %> prohibited this crew from being saved:</h4>
|
14
|
+
<ul>
|
15
|
+
<% @crew.errors.full_messages.each do |message| %>
|
16
|
+
<li><%= message %></li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<div class="form-group">
|
23
|
+
<%= form.label :name, class: "form-label" %>
|
24
|
+
<%= form.text_field :name, class: "form-input", required: true %>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="form-group">
|
28
|
+
<%= form.label :description, class: "form-label" %>
|
29
|
+
<%= form.text_area :description, class: "form-input", rows: 3 %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="form-group">
|
33
|
+
<%= form.label :process_type, class: "form-label" %>
|
34
|
+
<%= form.select :process_type,
|
35
|
+
options_for_select([
|
36
|
+
['Sequential', 'sequential'],
|
37
|
+
['Hierarchical', 'hierarchical']
|
38
|
+
], @crew.process_type),
|
39
|
+
{ prompt: 'Select process type' },
|
40
|
+
{ class: "form-select" } %>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div class="form-group">
|
44
|
+
<%= form.label :verbose, class: "form-label" %>
|
45
|
+
<%= form.check_box :verbose, class: "form-checkbox" %>
|
46
|
+
<span class="form-help">Enable verbose logging</span>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="form-group">
|
50
|
+
<%= form.label :memory_enabled, class: "form-label" %>
|
51
|
+
<%= form.check_box :memory_enabled, class: "form-checkbox" %>
|
52
|
+
<span class="form-help">Enable memory for agents</span>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div class="form-group">
|
56
|
+
<%= form.label :cache_enabled, class: "form-label" %>
|
57
|
+
<%= form.check_box :cache_enabled, class: "form-checkbox" %>
|
58
|
+
<span class="form-help">Enable caching</span>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div class="form-group">
|
62
|
+
<%= form.label :max_rpm, class: "form-label" %>
|
63
|
+
<%= form.number_field :max_rpm, class: "form-input", min: 0 %>
|
64
|
+
<span class="form-help">Maximum requests per minute (0 for unlimited)</span>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<div class="form-group">
|
68
|
+
<%= form.label :manager_llm, class: "form-label" %>
|
69
|
+
<%= form.text_field :manager_llm, class: "form-input" %>
|
70
|
+
<span class="form-help">LLM configuration for the manager (JSON format)</span>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div class="form-group">
|
74
|
+
<%= form.label :active, class: "form-label" %>
|
75
|
+
<%= form.check_box :active, class: "form-checkbox" %>
|
76
|
+
<span class="form-help">Crew is active</span>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="form-actions">
|
80
|
+
<%= form.submit "Update Crew", class: "btn btn-primary" %>
|
81
|
+
<%= link_to "Cancel", @crew, class: "btn btn-secondary" %>
|
82
|
+
<%= link_to "Delete Crew", @crew, method: :delete,
|
83
|
+
confirm: "Are you sure you want to delete this crew?",
|
84
|
+
class: "btn btn-danger" %>
|
85
|
+
</div>
|
86
|
+
<% end %>
|
87
|
+
</div>
|
@@ -0,0 +1,75 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>New Crew</h1>
|
3
|
+
<%= link_to "Back to Crews", crews_path, class: "btn" %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div class="form-container">
|
7
|
+
<%= form_with model: @crew, local: true do |form| %>
|
8
|
+
<% if @crew.errors.any? %>
|
9
|
+
<div class="alert alert-error">
|
10
|
+
<h4><%= pluralize(@crew.errors.count, "error") %> prohibited this crew from being saved:</h4>
|
11
|
+
<ul>
|
12
|
+
<% @crew.errors.full_messages.each do |message| %>
|
13
|
+
<li><%= message %></li>
|
14
|
+
<% end %>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<div class="form-group">
|
20
|
+
<%= form.label :name, class: "form-label" %>
|
21
|
+
<%= form.text_field :name, class: "form-input", required: true %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="form-group">
|
25
|
+
<%= form.label :description, class: "form-label" %>
|
26
|
+
<%= form.text_area :description, class: "form-input", rows: 3 %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="form-group">
|
30
|
+
<%= form.label :process_type, class: "form-label" %>
|
31
|
+
<%= form.select :process_type,
|
32
|
+
options_for_select([
|
33
|
+
['Sequential', 'sequential'],
|
34
|
+
['Hierarchical', 'hierarchical']
|
35
|
+
], @crew.process_type),
|
36
|
+
{ prompt: 'Select process type' },
|
37
|
+
{ class: "form-select" } %>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="form-group">
|
41
|
+
<%= form.label :verbose, class: "form-label" %>
|
42
|
+
<%= form.check_box :verbose, class: "form-checkbox" %>
|
43
|
+
<span class="form-help">Enable verbose logging</span>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div class="form-group">
|
47
|
+
<%= form.label :memory_enabled, class: "form-label" %>
|
48
|
+
<%= form.check_box :memory_enabled, class: "form-checkbox" %>
|
49
|
+
<span class="form-help">Enable memory for agents</span>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
<div class="form-group">
|
53
|
+
<%= form.label :cache_enabled, class: "form-label" %>
|
54
|
+
<%= form.check_box :cache_enabled, class: "form-checkbox" %>
|
55
|
+
<span class="form-help">Enable caching</span>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div class="form-group">
|
59
|
+
<%= form.label :max_rpm, class: "form-label" %>
|
60
|
+
<%= form.number_field :max_rpm, class: "form-input", min: 0 %>
|
61
|
+
<span class="form-help">Maximum requests per minute (0 for unlimited)</span>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<div class="form-group">
|
65
|
+
<%= form.label :manager_llm, class: "form-label" %>
|
66
|
+
<%= form.text_field :manager_llm, class: "form-input" %>
|
67
|
+
<span class="form-help">LLM configuration for the manager (JSON format)</span>
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<div class="form-actions">
|
71
|
+
<%= form.submit "Create Crew", class: "btn btn-primary" %>
|
72
|
+
<%= link_to "Cancel", crews_path, class: "btn btn-secondary" %>
|
73
|
+
</div>
|
74
|
+
<% end %>
|
75
|
+
</div>
|
@@ -0,0 +1,91 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>Executions</h1>
|
3
|
+
<% if params[:crew_id] %>
|
4
|
+
<% crew = RcrewAI::Rails::Crew.find(params[:crew_id]) %>
|
5
|
+
<p>Showing executions for crew: <%= link_to crew.name, crew %></p>
|
6
|
+
<% end %>
|
7
|
+
</div>
|
8
|
+
|
9
|
+
<div class="filters">
|
10
|
+
<%= form_tag executions_path, method: :get, local: true, class: "filter-form" do %>
|
11
|
+
<%= select_tag :status,
|
12
|
+
options_for_select([
|
13
|
+
['All Statuses', ''],
|
14
|
+
['Pending', 'pending'],
|
15
|
+
['Running', 'running'],
|
16
|
+
['Completed', 'completed'],
|
17
|
+
['Failed', 'failed'],
|
18
|
+
['Cancelled', 'cancelled']
|
19
|
+
], params[:status]),
|
20
|
+
{ class: "form-select", onchange: "this.form.submit();" } %>
|
21
|
+
|
22
|
+
<%= select_tag :crew_id,
|
23
|
+
options_for_select([['All Crews', '']] + RcrewAI::Rails::Crew.all.map { |c| [c.name, c.id] }, params[:crew_id]),
|
24
|
+
{ class: "form-select", onchange: "this.form.submit();" } %>
|
25
|
+
<% end %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<div class="executions-table">
|
29
|
+
<% if @executions.any? %>
|
30
|
+
<table class="data-table">
|
31
|
+
<thead>
|
32
|
+
<tr>
|
33
|
+
<th>ID</th>
|
34
|
+
<th>Crew</th>
|
35
|
+
<th>Status</th>
|
36
|
+
<th>Started</th>
|
37
|
+
<th>Completed</th>
|
38
|
+
<th>Duration</th>
|
39
|
+
<th>Actions</th>
|
40
|
+
</tr>
|
41
|
+
</thead>
|
42
|
+
<tbody>
|
43
|
+
<% @executions.each do |execution| %>
|
44
|
+
<tr class="execution-row status-<%= execution.status %>">
|
45
|
+
<td>
|
46
|
+
<%= link_to "##{execution.id}", execution %>
|
47
|
+
</td>
|
48
|
+
<td>
|
49
|
+
<%= link_to execution.crew.name, execution.crew %>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<span class="status-badge status-<%= execution.status %>">
|
53
|
+
<%= execution.status.humanize %>
|
54
|
+
</span>
|
55
|
+
</td>
|
56
|
+
<td>
|
57
|
+
<%= execution.started_at&.strftime("%Y-%m-%d %H:%M") || "Not started" %>
|
58
|
+
</td>
|
59
|
+
<td>
|
60
|
+
<%= execution.completed_at&.strftime("%Y-%m-%d %H:%M") || "In progress" %>
|
61
|
+
</td>
|
62
|
+
<td>
|
63
|
+
<%= execution.duration_seconds ? "#{execution.duration_seconds}s" : "N/A" %>
|
64
|
+
</td>
|
65
|
+
<td class="actions">
|
66
|
+
<%= link_to "View", execution, class: "btn btn-sm" %>
|
67
|
+
<% if execution.running? %>
|
68
|
+
<%= button_to "Cancel", cancel_execution_path(execution),
|
69
|
+
method: :post, class: "btn btn-sm btn-danger",
|
70
|
+
confirm: "Are you sure you want to cancel this execution?" %>
|
71
|
+
<% end %>
|
72
|
+
</td>
|
73
|
+
</tr>
|
74
|
+
<% end %>
|
75
|
+
</tbody>
|
76
|
+
</table>
|
77
|
+
<% else %>
|
78
|
+
<div class="empty-state">
|
79
|
+
<h3>No executions found</h3>
|
80
|
+
<p>
|
81
|
+
<% if params[:crew_id] || params[:status] %>
|
82
|
+
No executions match your current filters.
|
83
|
+
<% else %>
|
84
|
+
No executions have been run yet.
|
85
|
+
<% end %>
|
86
|
+
</p>
|
87
|
+
</div>
|
88
|
+
<% end %>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<!-- Pagination would go here if Kaminari gem is added -->
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>Edit Task #<%= @task.id %></h1>
|
3
|
+
<div class="actions">
|
4
|
+
<%= link_to "View Task", @task, class: "btn" %>
|
5
|
+
<% if @task.crew %>
|
6
|
+
<%= link_to "Back to Crew", @task.crew, class: "btn" %>
|
7
|
+
<% else %>
|
8
|
+
<%= link_to "All Tasks", tasks_path, class: "btn" %>
|
9
|
+
<% end %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="form-container">
|
14
|
+
<%= form_with model: @task, local: true do |form| %>
|
15
|
+
<% if @task.errors.any? %>
|
16
|
+
<div class="alert alert-error">
|
17
|
+
<h4><%= pluralize(@task.errors.count, "error") %> prohibited this task from being saved:</h4>
|
18
|
+
<ul>
|
19
|
+
<% @task.errors.full_messages.each do |message| %>
|
20
|
+
<li><%= message %></li>
|
21
|
+
<% end %>
|
22
|
+
</ul>
|
23
|
+
</div>
|
24
|
+
<% end %>
|
25
|
+
|
26
|
+
<div class="form-group">
|
27
|
+
<%= form.label :description, class: "form-label" %>
|
28
|
+
<%= form.text_area :description, class: "form-input", rows: 4, required: true %>
|
29
|
+
<span class="form-help">Detailed description of what this task should accomplish</span>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<div class="form-group">
|
33
|
+
<%= form.label :expected_output, class: "form-label" %>
|
34
|
+
<%= form.text_area :expected_output, class: "form-input", rows: 3, required: true %>
|
35
|
+
<span class="form-help">Description of the expected output from this task</span>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="form-group">
|
39
|
+
<%= form.label :crew_id, "Crew", class: "form-label" %>
|
40
|
+
<%= form.select :crew_id,
|
41
|
+
options_from_collection_for_select(RcrewAI::Rails::Crew.all, :id, :name, @task.crew_id),
|
42
|
+
{ prompt: 'Select a crew (optional)' },
|
43
|
+
{ class: "form-select" } %>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div class="form-group">
|
47
|
+
<%= form.label :agent_id, "Assigned Agent", class: "form-label" %>
|
48
|
+
<% agents = @task.crew ? @task.crew.agents : RcrewAI::Rails::Agent.all %>
|
49
|
+
<%= form.select :agent_id,
|
50
|
+
options_from_collection_for_select(agents, :id, :name, @task.agent_id),
|
51
|
+
{ prompt: 'Select an agent' },
|
52
|
+
{ class: "form-select" } %>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div class="form-group">
|
56
|
+
<%= form.label :async_execution, class: "form-label" %>
|
57
|
+
<%= form.check_box :async_execution, class: "form-checkbox" %>
|
58
|
+
<span class="form-help">Execute this task asynchronously</span>
|
59
|
+
</div>
|
60
|
+
|
61
|
+
<div class="form-group">
|
62
|
+
<%= form.label :order_index, "Execution Order", class: "form-label" %>
|
63
|
+
<%= form.number_field :order_index, class: "form-input", min: 0 %>
|
64
|
+
<span class="form-help">Order in which this task should be executed (0 = first)</span>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<div class="form-group">
|
68
|
+
<%= form.label :output_file, class: "form-label" %>
|
69
|
+
<%= form.text_field :output_file, class: "form-input" %>
|
70
|
+
<span class="form-help">File path where output should be saved (optional)</span>
|
71
|
+
</div>
|
72
|
+
|
73
|
+
<div class="form-group">
|
74
|
+
<%= form.label :context, class: "form-label" %>
|
75
|
+
<%= form.text_area :context, class: "form-input", rows: 3 %>
|
76
|
+
<span class="form-help">Additional context for the task (optional)</span>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="form-group">
|
80
|
+
<%= form.label :config, "Configuration (JSON)", class: "form-label" %>
|
81
|
+
<%= form.text_area :config, class: "form-input", rows: 3 %>
|
82
|
+
<span class="form-help">Task configuration in JSON format (optional)</span>
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div class="form-group">
|
86
|
+
<%= form.label :tools_config, "Tools Configuration (JSON)", class: "form-label" %>
|
87
|
+
<%= form.text_area :tools_config, class: "form-input", rows: 3 %>
|
88
|
+
<span class="form-help">Tools configuration in JSON format (optional)</span>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div class="form-group">
|
92
|
+
<%= form.label :active, class: "form-label" %>
|
93
|
+
<%= form.check_box :active, class: "form-checkbox" %>
|
94
|
+
<span class="form-help">Task is active</span>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
<div class="form-actions">
|
98
|
+
<%= form.submit "Update Task", class: "btn btn-primary" %>
|
99
|
+
<%= link_to "Cancel", @task, class: "btn btn-secondary" %>
|
100
|
+
<%= link_to "Delete Task", @task, method: :delete,
|
101
|
+
confirm: "Are you sure you want to delete this task?",
|
102
|
+
class: "btn btn-danger" %>
|
103
|
+
</div>
|
104
|
+
<% end %>
|
105
|
+
</div>
|