mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 02:05:37 +08:00
36 lines
938 B
Ruby
Vendored
36 lines
938 B
Ruby
Vendored
# frozen_string_literal: true
|
|
module DiscourseAi
|
|
module Automation
|
|
module LlmAgentTriage
|
|
def self.handle(
|
|
post:,
|
|
agent_id:,
|
|
whisper: false,
|
|
silent_mode: false,
|
|
automation: nil,
|
|
action: nil
|
|
)
|
|
DiscourseAi::AiBot::Playground.reply_to_post(
|
|
post: post,
|
|
agent_id: agent_id,
|
|
whisper: whisper,
|
|
silent_mode: silent_mode,
|
|
feature_name: "automation - #{automation&.name}",
|
|
attributed_user: Discourse.system_user,
|
|
feature_context: {
|
|
automation_id: automation&.id,
|
|
automation_name: automation&.name,
|
|
action: action,
|
|
},
|
|
)
|
|
rescue => e
|
|
Discourse.warn_exception(
|
|
e,
|
|
message: "Error responding to: #{post&.url} in LlmAgentTriage.handle",
|
|
)
|
|
raise e if Rails.env.test?
|
|
nil
|
|
end
|
|
end
|
|
end
|
|
end
|