meta_workflows 0.8.10 → 0.8.11
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/assets/images/lexi-chaticon.png +0 -0
- data/app/assets/images/lexi-collapsed.png +0 -0
- data/app/assets/images/lexi-expanded.png +0 -0
- data/app/assets/images/lexi_logo_color.png +0 -0
- data/app/controllers/meta_workflows/humans_controller.rb +45 -35
- data/app/controllers/meta_workflows/meta_controller.rb +7 -1
- data/app/helpers/meta_workflows/meta_workflows_helper.rb +4 -0
- data/app/jobs/meta_workflows/human_input_job.rb +2 -1
- data/app/models/meta_workflows/workflow.rb +4 -0
- data/app/models/meta_workflows/workflow_step.rb +12 -0
- data/app/views/meta_workflows/_lexi_chat_alpha_tray.html.erb +1 -1
- data/app/views/meta_workflows/_response_form_lexi.html.erb +8 -9
- data/db/migrate/20250626211926_add_repetition_to_meta_workflows_workflow_steps.rb +5 -0
- data/lib/meta_workflows/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88e0b63f0ddb77f268afe958db75e5b12b557e0426fe51fbc4c3387d1f457cda
|
4
|
+
data.tar.gz: 96dbf3330181b487494cc35b3cb7fa30fc9f41b95c4340acec101e7f02aa3913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3d8b0365283b1221d9a149a6d250f53a04dc4db46e9e72ca5400861c8ee81eeb6beb909a7abcef5ac301c900e0042d51ad60c9052c461456b732227e794f114
|
7
|
+
data.tar.gz: e13c2fb2fe7d36b98c6d05f9acbbef7598ef03bbc1971ff7194bf2589b61b81890e69dd184629326ce376e829eb22e46d94708c1b9c81500824adf5cdfa208ca
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -6,17 +6,58 @@ module MetaWorkflows
|
|
6
6
|
before_action :set_workflow_data, only: [:update]
|
7
7
|
|
8
8
|
def update
|
9
|
-
if params[:advance].present?
|
9
|
+
if params[:advance].present? || should_auto_advance?
|
10
10
|
advance_workflow
|
11
11
|
render_loader_stream
|
12
12
|
else
|
13
|
-
process_human_input
|
14
13
|
render_response_form_stream
|
14
|
+
process_human_input
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
|
+
def advance_workflow
|
21
|
+
dialogue = collect_messages_from_chat
|
22
|
+
@workflow_execution.increment_step
|
23
|
+
|
24
|
+
MetaWorkflows::MetaWorkflowJob.perform_later(
|
25
|
+
record_id: @record.id,
|
26
|
+
record_type: @record.class.name,
|
27
|
+
workflow_name: nil,
|
28
|
+
user_id: current_user.id,
|
29
|
+
inputs: { dialogue: dialogue }
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def collect_messages_from_chat
|
34
|
+
messages = MetaWorkflows::Chat.find(params[:chat_id]).messages
|
35
|
+
messages.map do |m|
|
36
|
+
{ role: m.role, content: m.content.strip }
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def should_auto_advance?
|
41
|
+
step_repetitions = current_step_repetitions
|
42
|
+
return false unless step_repetitions
|
43
|
+
|
44
|
+
new_repetition = @workflow_step.increment_repetition!
|
45
|
+
|
46
|
+
new_repetition >= step_repetitions
|
47
|
+
end
|
48
|
+
|
49
|
+
def process_human_input
|
50
|
+
MetaWorkflows::HumanInputJob.perform_later(
|
51
|
+
user_id: current_user.id,
|
52
|
+
record: @record,
|
53
|
+
params: {
|
54
|
+
inputs: params[:message],
|
55
|
+
chat_id: params[:chat_id],
|
56
|
+
prompt_id: @prompt_id
|
57
|
+
}
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
20
61
|
def render_loader_stream
|
21
62
|
respond_to do |format|
|
22
63
|
format.turbo_stream do
|
@@ -51,45 +92,14 @@ module MetaWorkflows
|
|
51
92
|
end
|
52
93
|
end
|
53
94
|
|
54
|
-
def advance_workflow
|
55
|
-
dialogue = collect_messages_from_chat
|
56
|
-
@workflow_execution.increment_step
|
57
|
-
|
58
|
-
MetaWorkflows::MetaWorkflowJob.perform_later(
|
59
|
-
record_id: @record.id,
|
60
|
-
record_type: @record.class.name,
|
61
|
-
workflow_name: nil,
|
62
|
-
user_id: current_user.id,
|
63
|
-
inputs: { dialogue: dialogue }
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
def process_human_input
|
68
|
-
MetaWorkflows::HumanInputJob.perform_later(
|
69
|
-
user_id: current_user.id,
|
70
|
-
record: @record,
|
71
|
-
params: {
|
72
|
-
inputs: params[:message],
|
73
|
-
chat_id: params[:chat_id],
|
74
|
-
prompt_id: @prompt_id
|
75
|
-
}
|
76
|
-
)
|
77
|
-
end
|
78
|
-
|
79
|
-
def collect_messages_from_chat
|
80
|
-
messages = MetaWorkflows::Chat.find(params[:chat_id]).messages
|
81
|
-
messages.map do |m|
|
82
|
-
{ role: m.role, content: m.content.strip }
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
95
|
def response_form_locals(response_enabled: true, responding: false)
|
87
96
|
{
|
88
97
|
record: @record,
|
89
98
|
workflow_execution_id: @workflow_execution.id,
|
90
99
|
chat_id: params[:chat_id],
|
91
100
|
response_enabled: response_enabled,
|
92
|
-
responding: responding
|
101
|
+
responding: responding,
|
102
|
+
step_has_repetitions: current_step_has_repetitions?(@workflow_execution)
|
93
103
|
}
|
94
104
|
end
|
95
105
|
end
|
@@ -5,9 +5,11 @@ module MetaWorkflows
|
|
5
5
|
include MetaWorkflows::MetaWorkflowsHelper
|
6
6
|
|
7
7
|
def set_workflow_data
|
8
|
-
@workflow_execution = MetaWorkflows::WorkflowExecution.
|
8
|
+
@workflow_execution = MetaWorkflows::WorkflowExecution.includes(:record, :workflow,
|
9
|
+
:workflow_steps).find(params[:id])
|
9
10
|
@record = @workflow_execution.record
|
10
11
|
@workflow = @workflow_execution.workflow
|
12
|
+
@workflow_step = @workflow_execution.workflow_steps.find_by(step: @workflow_execution.current_step)
|
11
13
|
@prompt_id = @workflow.prompt_id(@workflow_execution.current_step)
|
12
14
|
end
|
13
15
|
|
@@ -17,5 +19,9 @@ module MetaWorkflows
|
|
17
19
|
@workflow.step_progress(@workflow_execution.current_step) || ['Processing your request...',
|
18
20
|
'Talking to the LLM...']
|
19
21
|
end
|
22
|
+
|
23
|
+
def current_step_repetitions
|
24
|
+
@workflow.step_repetitions(@workflow_execution.current_step)
|
25
|
+
end
|
20
26
|
end
|
21
27
|
end
|
@@ -42,7 +42,8 @@ module MetaWorkflows
|
|
42
42
|
locals: { record: record,
|
43
43
|
workflow_execution_id: workflow_execution&.id,
|
44
44
|
response_enabled: true,
|
45
|
-
chat_id: chat.id
|
45
|
+
chat_id: chat.id,
|
46
|
+
step_has_repetitions: current_step_has_repetitions?(workflow_execution) }
|
46
47
|
)
|
47
48
|
end
|
48
49
|
end
|
@@ -6,6 +6,7 @@ module MetaWorkflows
|
|
6
6
|
belongs_to :chat, class_name: 'MetaWorkflows::Chat', optional: true
|
7
7
|
|
8
8
|
validates :step, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 }
|
9
|
+
validates :repetition, numericality: { only_integer: true, greater_than_or_equal_to: 0 }, allow_nil: true
|
9
10
|
validates :workflow_execution_id, uniqueness: { scope: :step }
|
10
11
|
|
11
12
|
has_one :workflow, through: :workflow_execution, class_name: 'MetaWorkflows::Workflow'
|
@@ -45,5 +46,16 @@ module MetaWorkflows
|
|
45
46
|
|
46
47
|
"#{error_type}: #{error_message}"
|
47
48
|
end
|
49
|
+
|
50
|
+
# Repetition methods
|
51
|
+
def current_repetition
|
52
|
+
repetition || 0
|
53
|
+
end
|
54
|
+
|
55
|
+
def increment_repetition!
|
56
|
+
new_repetition = current_repetition + 1
|
57
|
+
update!(repetition: new_repetition)
|
58
|
+
new_repetition
|
59
|
+
end
|
48
60
|
end
|
49
61
|
end
|
@@ -37,7 +37,7 @@
|
|
37
37
|
<!-- Input form -->
|
38
38
|
<div class="w-full">
|
39
39
|
<% active_execution = local_assigns[:record]&.workflow_executions&.order(created_at: :desc)&.first %>
|
40
|
-
<%= render partial:
|
40
|
+
<%= render partial: meta_response_form, locals: {record: local_assigns[:record], response_enabled: true, workflow_execution_id: active_execution&.id, chat_id: active_execution&.workflow_steps&.last&.chat&.id, step_has_repetitions: true } %>
|
41
41
|
</div>
|
42
42
|
</div>
|
43
43
|
</div>
|
@@ -1,5 +1,4 @@
|
|
1
1
|
<%= turbo_frame_tag target_frame_id(record, form: true) do %>
|
2
|
-
<% if local_assigns[:response_enabled] %>
|
3
2
|
<div>
|
4
3
|
<%= form_with url: (workflow_execution_id.present? ? meta_workflows.human_path(workflow_execution_id) : "#"), method: :patch do |form| %>
|
5
4
|
<%= form.hidden_field :chat_id, value: chat_id %>
|
@@ -9,7 +8,7 @@
|
|
9
8
|
<div class="flex flex-col max-h-[200px] border border-gray-300 rounded-lg bg-white/80 p-2">
|
10
9
|
<!-- Input area with icons -->
|
11
10
|
<div class="flex-1 relative">
|
12
|
-
<%= form.text_area :message, rows: 1, placeholder: random_chat_placeholder, disabled: local_assigns[:responding], class: "w-full min-h-[50px] border-0 resize-none focus:outline-none focus:ring-0 bg-transparent text-base overflow-y-auto" %>
|
11
|
+
<%= form.text_area :message, rows: 1, placeholder: random_chat_placeholder, disabled: local_assigns[:responding] || !local_assigns[:response_enabled], class: "w-full min-h-[50px] border-0 resize-none focus:outline-none focus:ring-0 bg-transparent text-base overflow-y-auto" %>
|
13
12
|
</div>
|
14
13
|
|
15
14
|
<div class="flex justify-between">
|
@@ -39,15 +38,15 @@
|
|
39
38
|
</div>
|
40
39
|
</div>
|
41
40
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
41
|
+
<% unless local_assigns[:step_has_repetitions] %>
|
42
|
+
<div class="flex justify-end">
|
43
|
+
<%= form.button type: "submit", name: "advance", value: "true", class: "text-xs mb-2 #{local_assigns[:responding] ? 'opacity-50 cursor-not-allowed' : ''}", disabled: local_assigns[:responding] do %>
|
44
|
+
<i class="fa-light fa-arrow-right"></i> Next
|
45
|
+
<% end %>
|
46
|
+
</div>
|
47
|
+
<% end %>
|
48
48
|
</div>
|
49
49
|
</fieldset>
|
50
50
|
<% end %>
|
51
51
|
</div>
|
52
|
-
<% end %>
|
53
52
|
<% end %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module MetaWorkflows
|
4
4
|
MAJOR = 0
|
5
5
|
MINOR = 8
|
6
|
-
PATCH =
|
6
|
+
PATCH = 11 # this is automatically incremented by the build process
|
7
7
|
|
8
8
|
VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meta_workflows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Medovyy
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-06-
|
12
|
+
date: 2025-06-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -114,6 +114,10 @@ files:
|
|
114
114
|
- CHANGELOG.md
|
115
115
|
- README.md
|
116
116
|
- Rakefile
|
117
|
+
- app/assets/images/lexi-chaticon.png
|
118
|
+
- app/assets/images/lexi-collapsed.png
|
119
|
+
- app/assets/images/lexi-expanded.png
|
120
|
+
- app/assets/images/lexi_logo_color.png
|
117
121
|
- app/assets/javascripts/meta_workflows/controllers/loading_phrases_controller.js
|
118
122
|
- app/assets/javascripts/meta_workflows/controllers/meta_flash_controller.js
|
119
123
|
- app/assets/javascripts/meta_workflows/controllers/redirect_controller.js
|
@@ -170,6 +174,7 @@ files:
|
|
170
174
|
- db/migrate/20250613213159_add_error_fields_to_workflow_steps.rb
|
171
175
|
- db/migrate/20250617192849_remove_repetition_from_meta_workflows_workflow_executions.rb
|
172
176
|
- db/migrate/20250618175439_add_call_id_and_status_to_meta_workflows_tool_calls.rb
|
177
|
+
- db/migrate/20250626211926_add_repetition_to_meta_workflows_workflow_steps.rb
|
173
178
|
- lib/meta_workflows.rb
|
174
179
|
- lib/meta_workflows/asset_installer.rb
|
175
180
|
- lib/meta_workflows/configuration.rb
|