module AiSummaryLabeledFooter
Constants
- USAGE_LABELS
Public Instance Methods
Source
# File plugins/ai.rb, line 2484 def format_answer(text, model:, total_tokens:, duration_s:, usage_percents: nil, now: Time.now) lines = text.to_s.strip.split("\n").map(&:strip).reject(&:empty?) lines = ["No response"] if lines.empty? footer = format_footer( model: model, total_tokens: total_tokens, duration_s: duration_s, usage_percents: usage_percents, now: now ) lines[-1] = "#{lines[-1]} #{footer}" lines.join("\n") end
Source
# File plugins/ai.rb, line 2477 def format_build_success_message(filename:, attempts:, model:, total_tokens:, duration_s:, usage_percents: nil, now: Time.now) prefix = "Plugin #{filename} built in #{attempts} attempt(s) " "#{prefix}#{format_footer(model: model, total_tokens: total_tokens, duration_s: duration_s, usage_percents: usage_percents, now: now)}" end
Source
# File plugins/ai.rb, line 2460 def format_cycle_remaining_segment(usage_percents, now: Time.now) return "" unless usage_percents.is_a?(Hash) remaining = Ai.format_cycle_remaining(usage_percents[:billing_cycle_end], now: now) return "" if remaining.empty? "#{AiSummary::STYLE_META} ยท #{AiSummary::IRC_RESET}#{AiSummary::STYLE_DURATION}#{remaining}#{AiSummary::IRC_RESET}" end
Source
# File plugins/ai.rb, line 2451 def format_stats_percentages(usage_percents) return "" if usage_percents.nil? auto = format_usage_percent(usage_percents[:auto_percent_used], AiSummary::STYLE_USAGE_AUTO, label: USAGE_LABELS[:auto]) api = format_usage_percent(usage_percents[:api_percent_used], AiSummary::STYLE_USAGE_API, label: USAGE_LABELS[:api]) total = format_usage_percent(usage_percents[:total_percent_used], AiSummary::STYLE_USAGE_TOTAL, label: USAGE_LABELS[:total]) "#{AiSummary::STYLE_META} ยท #{AiSummary::IRC_RESET}#{auto}#{api}#{total}" end
Source
# File plugins/ai.rb, line 2443 def format_usage_percent(value, style, label: nil) if label format("#{style}#{label}%d%%#{AiSummary::IRC_RESET}", value.to_i) else super(value, style) end end
Calls superclass method