@@ -65,29 +65,29 @@ def uploaded_file(path, type)
6565 expect ( response . content ) . to be_present
6666 end
6767
68- # it 'handles ActiveStorage::Attached::Many in ask method' do
69- # chat = Chat.create!(model: model)
70-
71- # document = Document.create!(title: 'Test Document')
72- # document.files.attach(
73- # io: File.open(image_path),
74- # filename: 'ruby.png',
75- # content_type: 'image/png'
76- # )
77- # document.files.attach(
78- # io: File.open(pdf_path),
79- # filename: 'sample.pdf',
80- # content_type: 'application/pdf'
81- # )
82-
83- # response = chat.ask('Analyze these', with: document.files)
84-
85- # user_message = chat.messages.find_by(role: 'user')
86- # expect(user_message.attachments.count).to eq(2)
87- # filenames = user_message.attachments.map { |a| a.filename.to_s }.sort
88- # expect(filenames).to eq(['ruby.png', 'sample.pdf'])
89- # expect(response.content).to be_present
90- # end
68+ it 'handles ActiveStorage::Attached::Many in ask method' do
69+ chat = Chat . create! ( model : model )
70+
71+ document = Document . create! ( title : 'Test Document' )
72+ document . files . attach (
73+ io : File . open ( image_path ) ,
74+ filename : 'ruby.png' ,
75+ content_type : 'image/png'
76+ )
77+ document . files . attach (
78+ io : File . open ( pdf_path ) ,
79+ filename : 'sample.pdf' ,
80+ content_type : 'application/pdf'
81+ )
82+
83+ response = chat . ask ( 'Analyze these' , with : document . files )
84+
85+ user_message = chat . messages . find_by ( role : 'user' )
86+ expect ( user_message . attachments . count ) . to eq ( 2 )
87+ filenames = user_message . attachments . map { |a | a . filename . to_s } . sort
88+ expect ( filenames ) . to eq ( [ 'ruby.png' , 'sample.pdf' ] )
89+ expect ( response . content ) . to be_present
90+ end
9191 end
9292
9393 describe 'attachment types' do
0 commit comments