Class: LlmGateway::Agents::FileSessionManager
- Inherits:
-
InMemorySessionManager
- Object
- InMemorySessionManager
- LlmGateway::Agents::FileSessionManager
- Defined in:
- lib/llm_gateway/agents/file_session_manager.rb
Constant Summary
Constants inherited from InMemorySessionManager
InMemorySessionManager::DRAIN_MODES, InMemorySessionManager::MESSAGE_QUEUED, InMemorySessionManager::MESSAGE_STARTED, InMemorySessionManager::QUEUES
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#session_path ⇒ Object
readonly
Returns the value of attribute session_path.
Instance Method Summary collapse
- #events ⇒ Object
-
#initialize(file_name = nil, session_id: nil, session_start: nil, session_dir: nil) ⇒ FileSessionManager
constructor
A new instance of FileSessionManager.
- #normalize_path(file_name) ⇒ Object
- #session_id ⇒ Object
- #session_start ⇒ Object
Methods inherited from InMemorySessionManager
#active_messages, #build_model_input_messages, #busy!, #busy?, #compaction, #drain_message_queue, #events_until, #idle!, #last_assistant_message_at, #last_message_id, #last_model_used, #last_reasoning_level_used, #push_entry, #push_message, #push_message_to_queue, #queued_messages?, #start_or_enqueue_user_message, #total_tokens, #validate_drain_mode!, #validate_queue!
Constructor Details
#initialize(file_name = nil, session_id: nil, session_start: nil, session_dir: nil) ⇒ FileSessionManager
Returns a new instance of FileSessionManager.
14 15 16 17 18 19 |
# File 'lib/llm_gateway/agents/file_session_manager.rb', line 14 def initialize(file_name = nil, session_id: nil, session_start: nil, session_dir: nil) super(session_id) @file_name = file_name @preset_session_start = session_start @session_dir = session_dir end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
12 13 14 |
# File 'lib/llm_gateway/agents/file_session_manager.rb', line 12 def file_name @file_name end |
#session_path ⇒ Object (readonly)
Returns the value of attribute session_path.
12 13 14 |
# File 'lib/llm_gateway/agents/file_session_manager.rb', line 12 def session_path @session_path end |
Instance Method Details
#events ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/llm_gateway/agents/file_session_manager.rb', line 35 def events @events ||= begin @session_path = normalize_path(file_name) if file_name if @session_path && File.exist?(@session_path) load_session(@session_path) else create_new_session end end end |
#normalize_path(file_name) ⇒ Object
31 32 33 |
# File 'lib/llm_gateway/agents/file_session_manager.rb', line 31 def normalize_path(file_name) File.(file_name) end |
#session_id ⇒ Object
21 22 23 24 |
# File 'lib/llm_gateway/agents/file_session_manager.rb', line 21 def session_id events @session_id end |
#session_start ⇒ Object
26 27 28 29 |
# File 'lib/llm_gateway/agents/file_session_manager.rb', line 26 def session_start events @session_start end |