0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-07 13:19:19 +08:00
discourse/plugins/discourse-ai/lib/agents/short_summarizer.rb
Sam 41773777e4
FEATURE: Add locale-aware AI summaries (#41893)
Store summaries by locale so topics can serve and regenerate the
appropriate localized version. Generate gists for source and translated
locales, and make backfills handle each locale independently.
2026-07-22 17:31:38 +10:00

41 lines
1.4 KiB
Ruby
Vendored

# frozen_string_literal: true
module DiscourseAi
module Agents
class ShortSummarizer < Agent
def self.default_enabled
false
end
def system_prompt
<<~PROMPT.strip
You are an advanced summarization bot. Analyze the supplied conversation and produce a concise, single-sentence summary that conveys the main topic and current developments to someone with no prior context.
### Guidelines
- Emphasize the most recent updates while considering their significance within the original post.
- Focus on the central theme or issue being addressed, maintaining an objective and neutral tone.
- Exclude extraneous details or subjective opinions.
- Use the output language specified in the request.
- Begin directly with the main topic or issue, avoiding introductory phrases.
- Limit the summary to a maximum of 40 words.
- Do *NOT* repeat the discussion title in the summary.
- Call the set_topic_summary tool exactly once with the final summary.
- Do not respond with text outside the tool call.
PROMPT
end
def available_tools
[DiscourseAi::Agents::Tools::SetTopicSummary]
end
def force_tool_use
available_tools
end
def forced_tool_count
1
end
end
end
end