From 4d9595690050295784a5925971ba76d766decbab Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 29 Jun 2026 22:31:13 +0530 Subject: [PATCH] feat: use approximate figures in overview summary and cache hourly --- .../api/v1/accounts/captain/assistants_controller.rb | 2 +- .../openai/openai_prompts/captain_overview_summary.liquid | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/enterprise/app/controllers/api/v1/accounts/captain/assistants_controller.rb b/enterprise/app/controllers/api/v1/accounts/captain/assistants_controller.rb index c9a5dbb5a..db64aa7d4 100644 --- a/enterprise/app/controllers/api/v1/accounts/captain/assistants_controller.rb +++ b/enterprise/app/controllers/api/v1/accounts/captain/assistants_controller.rb @@ -48,7 +48,7 @@ class Api::V1::Accounts::Captain::AssistantsController < Api::V1::Accounts::Base end def summary - result = Rails.cache.fetch(summary_cache_key, expires_in: 1.day) do + result = Rails.cache.fetch(summary_cache_key, expires_in: 1.hour) do builder = Captain::AssistantStatsBuilder.new(@assistant, params[:range]) Captain::OverviewSummaryService.new( account: Current.account, diff --git a/lib/integrations/openai/openai_prompts/captain_overview_summary.liquid b/lib/integrations/openai/openai_prompts/captain_overview_summary.liquid index 20377e4b7..19c32ed7c 100644 --- a/lib/integrations/openai/openai_prompts/captain_overview_summary.liquid +++ b/lib/integrations/openai/openai_prompts/captain_overview_summary.liquid @@ -6,7 +6,8 @@ Voice and format: - This is a static, read-only poster on an analytics dashboard, not a chat. The reader cannot reply or ask you for anything. Never ask a question, invite a reply, offer further help, or say things like "let me know" or "I can dive in". - Write 2 to 4 sentences in one short paragraph. Add a second short paragraph only for a genuinely useful heads-up. - Output plain markdown only: no headings, lists, preamble, or sign-off. Do not use em dashes. -- Wrap every number, percentage, and duration in **double asterisks** so the interface can highlight it. Bold only the figures, never whole phrases. +- Never state an exact figure. This summary is cached and the live numbers keep moving, so a precise value would quickly look wrong. Round every number down to a clean approximation and soften it with words like "around", "roughly", "about", "nearly", "just over", or "upwards of". For example, render **1,248** as "upwards of **1,200**", **63.2%** as "around **60%**", and **612** hours as "roughly **600** hours". For a small count, use a loose phrase like "a handful" instead of the exact number. +- Wrap the approximate figure in **double asterisks** so the interface can highlight it. Bold only the figures, never whole phrases or the softening word. Timing: today is {{ today }}. These stats cover {{ period_label }} ({{ period_start }} to {{ period_end }}). You may lightly reference the month, the season, or how far into the period things stand when it genuinely fits, but never invent events or facts.