Class: GetAiResponseJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- GetAiResponseJob
- Defined in:
- lib/generators/appchat/templates/get_ai_response_job.rb
Instance Attribute Summary collapse
-
#chat ⇒ Object
readonly
Returns the value of attribute chat.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#informed_prompt ⇒ Object
readonly
Returns the value of attribute informed_prompt.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#user_prompt ⇒ Object
readonly
Returns the value of attribute user_prompt.
Instance Method Summary collapse
Instance Attribute Details
#chat ⇒ Object (readonly)
Returns the value of attribute chat.
4 5 6 |
# File 'lib/generators/appchat/templates/get_ai_response_job.rb', line 4 def chat @chat end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
4 5 6 |
# File 'lib/generators/appchat/templates/get_ai_response_job.rb', line 4 def client @client end |
#informed_prompt ⇒ Object (readonly)
Returns the value of attribute informed_prompt.
4 5 6 |
# File 'lib/generators/appchat/templates/get_ai_response_job.rb', line 4 def informed_prompt @informed_prompt end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
4 5 6 |
# File 'lib/generators/appchat/templates/get_ai_response_job.rb', line 4 def @message end |
#user_prompt ⇒ Object (readonly)
Returns the value of attribute user_prompt.
4 5 6 |
# File 'lib/generators/appchat/templates/get_ai_response_job.rb', line 4 def user_prompt @user_prompt end |
Instance Method Details
#perform(chat_id, user_prompt) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/generators/appchat/templates/get_ai_response_job.rb', line 6 def perform(chat_id, user_prompt) @client = new_client @chat = Chat.find(chat_id) @user_prompt = user_prompt @message = chat..create(role: 'assistant') appchat_functions call_ollama end |