meta_workflows 0.8.7 → 0.8.8
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b59bf863e285b8d7f6b88f4d7547745bf89776f6e8c6ee1b7a77feee3fbe4d8
|
4
|
+
data.tar.gz: 1e005cddde9031f92399c506f3ca84f61db4703b6784c2aa5b4e496f218a2ea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70110e137cc53c66b295d90b8a02485498029f30c62db4d4b7c5eedfe7c7b0273141745a30172ee1d7a0e6bb86aa32abf7446a921514c0b940c6c59d47c03a85
|
7
|
+
data.tar.gz: d10e39347a37ae1b1747a19bc3baa501fe84698940726238229302f8504a53a5b01365e47c878b3aceb2add999dec9c1d723094b4c8551166526a03d2ca84f7b
|
@@ -34,12 +34,13 @@ module MetaWorkflows
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def broadcast_form(chat)
|
37
|
+
workflow_execution = active_workflow_execution
|
37
38
|
Turbo::StreamsChannel.broadcast_replace_to(
|
38
39
|
turbo_stream_name(record),
|
39
40
|
target: target_frame_id(record, form: true),
|
40
41
|
partial: meta_response_form,
|
41
42
|
locals: { record: record,
|
42
|
-
workflow_execution_id:
|
43
|
+
workflow_execution_id: workflow_execution&.id,
|
43
44
|
response_enabled: true,
|
44
45
|
chat_id: chat.id }
|
45
46
|
)
|
@@ -23,8 +23,8 @@ module MetaWorkflows
|
|
23
23
|
def initialize_new_conversation(params)
|
24
24
|
inputs = params.symbolize_keys[:inputs]
|
25
25
|
|
26
|
-
workflow_execution =
|
27
|
-
current_step = workflow_execution.workflow_steps
|
26
|
+
workflow_execution = active_workflow_execution
|
27
|
+
current_step = workflow_execution.workflow_steps&.find_by(step: workflow_execution.current_step)
|
28
28
|
@chat = current_step&.chat
|
29
29
|
|
30
30
|
conversation = RubyConversations::Conversation.new(chat:)
|
@@ -89,9 +89,9 @@ module MetaWorkflows
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def current_workflow_step
|
92
|
-
|
92
|
+
workflow_execution = active_workflow_execution
|
93
|
+
return nil unless workflow_execution
|
93
94
|
|
94
|
-
workflow_execution = record.workflow_execution
|
95
95
|
workflow_execution.workflow_steps.find_by(step: workflow_execution.current_step)
|
96
96
|
end
|
97
97
|
|
@@ -107,5 +107,10 @@ module MetaWorkflows
|
|
107
107
|
def broadcast_response(chat, full_response)
|
108
108
|
raise NotImplementedError
|
109
109
|
end
|
110
|
+
|
111
|
+
# Get the most recent (active) workflow execution for the record
|
112
|
+
def active_workflow_execution
|
113
|
+
record.workflow_executions.order(created_at: :desc).first
|
114
|
+
end
|
110
115
|
end
|
111
116
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module MetaWorkflows
|
4
4
|
MAJOR = 0
|
5
5
|
MINOR = 8
|
6
|
-
PATCH =
|
6
|
+
PATCH = 8 # this is automatically incremented by the build process
|
7
7
|
|
8
8
|
VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
|
9
9
|
end
|
@@ -235,7 +235,7 @@ module Services
|
|
235
235
|
end
|
236
236
|
|
237
237
|
def validate_workflow_presence
|
238
|
-
return unless workflow_name.nil? &&
|
238
|
+
return unless workflow_name.nil? && active_workflow_execution.blank?
|
239
239
|
|
240
240
|
raise ArgumentError, 'No workflow specified and record has no workflow attached'
|
241
241
|
end
|
@@ -251,13 +251,18 @@ module Services
|
|
251
251
|
workflow_params: workflow_params
|
252
252
|
)
|
253
253
|
else
|
254
|
-
workflow_execution =
|
254
|
+
workflow_execution = active_workflow_execution
|
255
255
|
workflow = workflow_execution.workflow
|
256
256
|
end
|
257
257
|
|
258
258
|
[workflow, workflow_execution]
|
259
259
|
end
|
260
260
|
|
261
|
+
# Get the most recent (active) workflow execution for the record
|
262
|
+
def active_workflow_execution
|
263
|
+
record.workflow_executions.order(created_at: :desc).first
|
264
|
+
end
|
265
|
+
|
261
266
|
def prepare_workflow_execution(workflow, workflow_execution)
|
262
267
|
execution_step = workflow.step_data(workflow_execution.current_step)
|
263
268
|
execution_output = workflow.step_output(workflow_execution.current_step)
|