discourse-ai/lib/automation/llm_persona_triage.rb
Sam 01893bb6ed
FEATURE: Add persona-based replies and whisper support to LLM triage (#1170)
This PR enhances the LLM triage automation with several important improvements:

- Add ability to use AI personas for automated replies instead of canned replies
- Add support for whisper responses
- Refactor LLM persona reply functionality into a reusable method
- Add new settings to configure response behavior in automations
- Improve error handling and logging
- Fix handling of personal messages in the triage flow
- Add comprehensive test coverage for new features
- Make personas configurable with more flexible requirements

This allows for more dynamic and context-aware responses in automated workflows, with better control over visibility and attribution.
2025-03-06 17:18:15 +11:00

22 lines
553 B
Ruby

# frozen_string_literal: true
module DiscourseAi
module Automation
module LlmPersonaTriage
def self.handle(post:, persona_id:, whisper: false, automation: nil)
DiscourseAi::AiBot::Playground.reply_to_post(
post: post,
persona_id: persona_id,
whisper: whisper,
)
rescue => e
Discourse.warn_exception(
e,
message: "Error responding to: #{post&.url} in LlmPersonaTriage.handle",
)
raise e if Rails.env.test?
nil
end
end
end
end