Restore admin link to debug prompts
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -28,16 +28,7 @@
|
||||
<div class="margin-block fill-shade txt-ink border border-radius pad">
|
||||
<h2 class="margin-block">Summary</h2>
|
||||
<div class="summary-content">
|
||||
<%= @activity_summary&.to_html %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="margin-block fill-shade txt-ink border border-radius pad">
|
||||
<h2 class="margin-block">Summarized Contents</h2>
|
||||
<div class="summary-content">
|
||||
<pre>
|
||||
<%= @day_timeline.summarizable_content %>
|
||||
</pre>
|
||||
<%= @period_highlights&.to_html %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,5 +13,12 @@
|
||||
|
||||
<div class="events__activity-summary txt-small">
|
||||
<%= 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" %>
|
||||
<span class="for-screen-reader">Prompt sandbox</span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user