From fc0eec8d077047966ecd4c1cc36d1d8b6b72fa16 Mon Sep 17 00:00:00 2001 From: Jorge Manrubia Date: Tue, 2 Sep 2025 11:23:01 +0200 Subject: [PATCH] Restore admin link to debug prompts --- .../admin/prompt_sandboxes_controller.rb | 13 +++++++------ app/views/admin/prompt_sandboxes/show.html.erb | 11 +---------- app/views/events/_weekly_highlights.html.erb | 7 +++++++ 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/app/controllers/admin/prompt_sandboxes_controller.rb b/app/controllers/admin/prompt_sandboxes_controller.rb index 32c37ae13..88fe6a7d8 100644 --- a/app/controllers/admin/prompt_sandboxes_controller.rb +++ b/app/controllers/admin/prompt_sandboxes_controller.rb @@ -5,10 +5,10 @@ class Admin::PromptSandboxesController < AdminController @llm_model = params[:llm_model] || Event::Summarizer::LLM_MODEL if @prompt = cookies[:prompt].presence - @activity_summary = build_activity_summary + @period_highlights = build_period_highlights cookies.delete :prompt else - @activity_summary = @day_timeline.summary + @period_highlights = @day_timeline.weekly_highlights @prompt = Event::Summarizer::PROMPT end end @@ -21,9 +21,10 @@ class Admin::PromptSandboxesController < AdminController end private - def build_activity_summary - summarizer = Event::Summarizer.new(@day_timeline.events, prompt: @prompt, llm_model: @llm_model) - content, cost_in_microcents = summarizer.summarize - Event::ActivitySummary.new(content: content, cost_in_microcents: cost_in_microcents) + def build_period_highlights + period = PeriodHighlights::Period.new(Current.user.collections, starts_at: @day_timeline.day.utc.beginning_of_week(:sunday), duration: 1.week) + summarizer = Event::Summarizer.new(period.events, prompt: @prompt, llm_model: @llm_model) + content = summarizer.summarized_content + PeriodHighlights.new(content: content, cost_in_microcents: summarizer.cost.in_microcents) end end diff --git a/app/views/admin/prompt_sandboxes/show.html.erb b/app/views/admin/prompt_sandboxes/show.html.erb index be745ae53..6b82e5de5 100644 --- a/app/views/admin/prompt_sandboxes/show.html.erb +++ b/app/views/admin/prompt_sandboxes/show.html.erb @@ -28,16 +28,7 @@

Summary

- <%= @activity_summary&.to_html %> -
-
- -
-

Summarized Contents

-
-
-<%= @day_timeline.summarizable_content %>
-    
+ <%= @period_highlights&.to_html %>
diff --git a/app/views/events/_weekly_highlights.html.erb b/app/views/events/_weekly_highlights.html.erb index 8c4566fd4..f2788c6ab 100644 --- a/app/views/events/_weekly_highlights.html.erb +++ b/app/views/events/_weekly_highlights.html.erb @@ -13,5 +13,12 @@
<%= day_timeline.weekly_highlights.to_html %> + + <% if Current.user.staff? %> + <%= link_to admin_prompt_sandbox_path(day: day_timeline.day), class: "btn txt-xx-small events__activity-prompt-edit" do %> + <%= icon_tag "bolt" %> + Prompt sandbox + <% end %> + <% end %>
<% end %>