Class: LlmMemory::FileLoader

Inherits:
Object
  • Object
show all
Includes:
Loader
Defined in:
lib/llm_memory/loaders/file_loader.rb

Instance Method Summary collapse

Methods included from Loader

included

Instance Method Details

#load(directory_path) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/llm_memory/loaders/file_loader.rb', line 10

def load(directory_path)
  files_array = []
  Find.find(directory_path) do |file_path|
    next if File.directory?(file_path)

    file_name = File.basename(file_path)
    file_content = File.read(file_path)
    ctime = File.ctime(file_path)

    files_array << {
      content: file_content,
      metadata: {
        file_name: file_name,
        timestamp: ctime.strftime("%Y%m%d%H%M%S") # YYMMDDHHmmss
      }
    }
  end

  files_array
end