Class: RailsAi::PromptComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/ai/prompt_component.rb

Instance Method Summary collapse

Constructor Details

#initialize(prompt:, model: nil, stream_id: nil, placeholder: "Ask me anything...", **options) ⇒ PromptComponent

Returns a new instance of PromptComponent.



5
6
7
8
9
10
11
# File 'app/components/ai/prompt_component.rb', line 5

def initialize(prompt:, model: nil, stream_id: nil, placeholder: "Ask me anything...", **options)
  @prompt = prompt
  @model = model || RailsAi.config.default_model
  @stream_id = stream_id || SecureRandom.uuid
  @placeholder = placeholder
  @options = options
end