Module: Clacky::Channel::Adapters::Feishu::FileProcessor
- Defined in:
- lib/clacky/server/channel/adapters/feishu/file_processor.rb
Overview
Processes file attachments downloaded from Feishu messages. Delegates to the unified Clacky::Utils::FileProcessor pipeline:
- saves original file to disk
- generates structured Markdown preview for Office/ZIP files
- returns a formatted prompt snippet describing both paths
Constant Summary collapse
- MAX_FILE_BYTES =
Clacky::Utils::FileProcessor::MAX_FILE_BYTES
Class Method Summary collapse
-
.process(body, file_name) ⇒ String
Process a downloaded file and return a text snippet for the agent prompt.
Class Method Details
.process(body, file_name) ⇒ String
Process a downloaded file and return a text snippet for the agent prompt.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/clacky/server/channel/adapters/feishu/file_processor.rb', line 21 def self.process(body, file_name) if body.bytesize > MAX_FILE_BYTES return "[Attachment: #{file_name}]\nFile too large " \ "(#{body.bytesize / 1024 / 1024}MB, max #{MAX_FILE_BYTES / 1024 / 1024}MB)." end ref = Clacky::Utils::FileProcessor.process(body: body, filename: file_name) ref.to_prompt rescue => e "[Attachment: #{file_name}]\n(Processing failed: #{e.})" end |