mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-10 05:24:44 +00:00
* DEV: improve internal design of ai persona and bug fix - Fixes bug where OpenAI could not describe images - Fixes bug where mentionable personas could not be mentioned unless overarching bot was enabled - Improves internal design of playground and bot to allow better for non "bot" users - Allow PMs directly to persona users (previously bot user would also have to be in PM) - Simplify internal code Co-authored-by: Martin Brennan <martin@discourse.org>
18 lines
560 B
Ruby
18 lines
560 B
Ruby
# frozen_string_literal: true
|
|
|
|
module ::Jobs
|
|
class UpdateAiBotPmTitle < ::Jobs::Base
|
|
sidekiq_options retry: false
|
|
|
|
def execute(args)
|
|
return unless bot_user = User.find_by(id: args[:bot_user_id])
|
|
return unless bot = DiscourseAi::AiBot::Bot.as(bot_user, model: args[:model])
|
|
return unless post = Post.includes(:topic).find_by(id: args[:post_id])
|
|
|
|
return unless post.topic.custom_fields[DiscourseAi::AiBot::EntryPoint::REQUIRE_TITLE_UPDATE]
|
|
|
|
DiscourseAi::AiBot::Playground.new(bot).title_playground(post)
|
|
end
|
|
end
|
|
end
|