Class: SimpleAcp::Models::MessagePartEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/simple_acp/models/events.rb

Overview

Message part event (for streaming individual parts)

Instance Attribute Summary

Attributes inherited from Event

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

#sse_format

Methods inherited from Base

#==, attribute, attributes, #hash, own_attributes, #to_h, #to_json

Constructor Details

#initialize(**kwargs) ⇒ MessagePartEvent

Returns a new instance of MessagePartEvent.



48
49
50
51
# File 'lib/simple_acp/models/events.rb', line 48

def initialize(**kwargs)
  kwargs[:type] = Types::EventType::MESSAGE_PART
  super
end

Class Method Details

.from_hash(hash) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/simple_acp/models/events.rb', line 53

def self.from_hash(hash)
  return nil if hash.nil?

  instance = super
  if hash["part"] || hash[:part]
    instance.part = MessagePart.from_hash(hash["part"] || hash[:part])
  end
  instance
end