meta_workflows 0.8.7 → 0.8.9

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: 20f6cdd2bd711b98e1961eafc5221ae7972df75bda8b5fad2ffe01d376baa7dc
4
- data.tar.gz: 97b70ce3e211bc1735acd1f40108b13b0700cfe9a1d36d26ca8f4709927339da
3
+ metadata.gz: cb7fc05f27cea2d28257ac0b8712e260ec7d8f05bed224877eeef450f3b57d4a
4
+ data.tar.gz: 63d7b52ff4bf5dc960951996b8c0d86f7b088da7f279aa25bb7e02c9c7b4c52f
5
5
  SHA512:
6
- metadata.gz: d682e32e43cb0d06e99fd8dcf7e703eff7bb763fc3f087d5347c98e6365dd340d455fc6de6fe4a5c079de519198888d18bc0076162f773b323238c8492e3d0ec
7
- data.tar.gz: 534fbd9b1c6282d6615c0eb5261bd2b6477655b678978cc59d86f6c82e25790cc30fb337198680de03e07d25fc5a3566669ef51f10fdfe28a17df3f0e70b3545
6
+ metadata.gz: 141e4c91bf9be5664954762f5619cee0bc5a05d133c568dc73a96db9b2d6be1ca1ae9c4de28fa2acba8c7dfe510db0a91aa0a91c01285d4b1abeacf3406d06f6
7
+ data.tar.gz: 543b4fd54eaa0a21704524df8d34039f5c2a10a2e1b9d3282529c021fc5130bb8c8dbc217650152f2c1daaf8e1e00f0ab66826373603c34eaccfcf7250d6e6c8
@@ -27,6 +27,10 @@ module MetaWorkflows
27
27
  'meta_workflows/redirect'
28
28
  end
29
29
 
30
+ def meta_lexi_chat_right_tray
31
+ 'meta_workflows/lexi_chat_right_tray'
32
+ end
33
+
30
34
  def random_chat_placeholder
31
35
  [
32
36
  'What would you like to improve?',
@@ -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: record.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 = record.workflow_execution
27
- current_step = workflow_execution.workflow_steps.find_by(step: workflow_execution.current_step)
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
- return nil unless record&.workflow_execution
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
@@ -0,0 +1,40 @@
1
+ <%# Lexi Chat Tray %>
2
+ <div class="relative flex flex-col h-[100vh] bg-white px-4">
3
+ <%# Header with Lexi logo and action icons %>
4
+ <div class="flex-shrink-0 flex items-center justify-between pb-2 border-b border-gray-200">
5
+ <div class="flex items-center space-x-2">
6
+ <%= image_tag("lexi_logo_color.png", alt: "Lexi Logo", class: "h-14 w-auto") %>
7
+ </div>
8
+ <div class="flex items-center gap-2">
9
+ <button type="button" class="p-2 rounded-xl hover:bg-gray-100" aria-label="New Chat" disabled>
10
+ <i class="fa-solid fa-plus text-xl"></i>
11
+ </button>
12
+ <button type="button" class="p-2 rounded-xl hover:bg-gray-100" aria-label="Chat History" disabled>
13
+ <i class="fa-solid fa-clock-rotate-left text-xl"></i>
14
+ </button>
15
+ </div>
16
+ </div>
17
+
18
+ <%# Chat messages area %>
19
+ <div class="flex-1 overflow-y-auto py-4 space-y-4">
20
+ <%= render partial: meta_loader, locals: {record: local_assigns[:record], step_progress: ["Generating draft course objectives...", "Talking to the LLM..."] } %>
21
+ </div>
22
+
23
+ <%# Lexi avatar and input area pinned to bottom %>
24
+ <div class="flex-1 relative bg-white min-h-[415px]">
25
+ <!-- Bottom section with recording notice and input area -->
26
+ <div class="absolute bottom-15 left-0 right-0 flex flex-col space-y-2 z-10">
27
+ <!-- Recording notice -->
28
+ <p class="text-left text-xs text-purple-600">This chat is being recorded.</p>
29
+
30
+ <!-- Input area -->
31
+ <div class="w-full">
32
+ <% active_execution = local_assigns[:record]&.workflow_executions&.order(created_at: :desc)&.first %>
33
+ <%= render partial: "meta_workflows/response_form_lexi", locals: {record: local_assigns[:record], response_enabled: true, workflow_execution_id: active_execution&.id, chat_id: active_execution&.workflow_steps&.last&.chat&.id } %>
34
+ </div>
35
+ </div>
36
+
37
+ <!-- Lexi image positioned absolutely to the right -->
38
+ <%= image_tag("lexi-expanded.png", alt: "Lexi Avatar", class: "absolute bottom-10 right-0 h-[375px] w-auto pointer-events-none") %>
39
+ </div>
40
+ </div>
@@ -3,7 +3,7 @@
3
3
  module MetaWorkflows
4
4
  MAJOR = 0
5
5
  MINOR = 8
6
- PATCH = 7 # this is automatically incremented by the build process
6
+ PATCH = 9 # 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? && record.workflow_execution.blank?
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 = record.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)
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.7
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Medovyy
@@ -150,6 +150,7 @@ files:
150
150
  - app/sidekiq/meta_workflows/tools/meta_workflow_tool.rb
151
151
  - app/views/layouts/meta_workflows/application.html.erb
152
152
  - app/views/layouts/meta_workflows/debug.html.erb
153
+ - app/views/meta_workflows/_lexi_chat_right_tray.html.erb
153
154
  - app/views/meta_workflows/_loader.html.erb
154
155
  - app/views/meta_workflows/_redirect.html.erb
155
156
  - app/views/meta_workflows/_response_form_lexi.html.erb