Class: PythonAiResponseCreator

Inherits:
ApplicationJob show all
Defined in:
app/jobs/python_ai_response_creator.rb

Instance Method Summary collapse

Instance Method Details

#perform(chat_id:, model:, user_id:, bundle_interval: 0.25) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'app/jobs/python_ai_response_creator.rb', line 4

def perform(chat_id:, model:, user_id:, bundle_interval: 0.25)
  chat = Chat.find(chat_id)
  chat_message = create_initial_message(chat, model)

  begin
    process_ai_response(chat, chat_message, model, user_id, bundle_interval)
  rescue StandardError => e
    handle_error(chat_message, e)
  end
end