mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-08-02 19:33:38 +00:00
You can now edit each AI helper prompt individually through personas, limit access to specific groups, set different LLMs, etc.
27 lines
685 B
Ruby
27 lines
685 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class StreamComposerHelper < ::Jobs::Base
|
|
sidekiq_options retry: false
|
|
|
|
def execute(args)
|
|
return unless args[:prompt]
|
|
return unless user = User.find_by(id: args[:user_id])
|
|
return unless args[:text]
|
|
return unless args[:client_id]
|
|
|
|
helper_mode = args[:prompt]
|
|
|
|
DiscourseAi::AiHelper::Assistant.new.stream_prompt(
|
|
helper_mode,
|
|
args[:text],
|
|
user,
|
|
"/discourse-ai/ai-helper/stream_composer_suggestion",
|
|
force_default_locale: args[:force_default_locale],
|
|
client_id: args[:client_id],
|
|
custom_prompt: args[:custom_prompt],
|
|
)
|
|
end
|
|
end
|
|
end
|