module AipReport
Constants
- STYLE_TAG
- TAG
Public Instance Methods
Source
# File lib/aip_report.rb, line 54 def format_error(message) IrcReply.error(tag: TAG, message: message, heading_style: STYLE_TAG) end
Source
# File lib/aip_report.rb, line 41 def format_plan_reply(preview:, body:, model:, total_tokens:, duration_s:, usage_percents: nil) header = IrcFormat.report_header(tag: TAG, title: preview.to_s.strip, style: STYLE_TAG) body_lines = body.to_s.strip.split("\n").map(&:strip).reject(&:empty?) card_body = ([header] + body_lines).join("\n") AiSummary.format_answer( card_body, model: model, total_tokens: total_tokens, duration_s: duration_s, usage_percents: usage_percents ) end
Source
# File lib/aip_report.rb, line 19 def format_question_reply(prompt:, options:, title: nil) question = prompt.to_s.strip lines = [] Array(options).each_with_index do |option, index| label = option[:label].to_s.strip label = option[:id].to_s.strip if label.empty? next if label.empty? letter = ("a".."z").to_a[index] || (index + 1).to_s lines << "#{letter}) #{label}" end lines << "Reply: !aip a|b|c|1|2|3" if lines.any? IrcReply.card( tag: TAG, title: title || "Plan needs input", body_lines: [question].concat(lines).reject(&:empty?), footer_parts: ["plan", "awaiting admin"], heading_style: STYLE_TAG ) end
Source
# File lib/aip_report.rb, line 13 def format_request_ack(asker:, question:) preview = question.to_s.strip preview = "#{preview[0, 77]}..." if preview.length > 80 "AIP plan from #{asker}: #{preview}" end