@@ -65,29 +65,29 @@ def uploaded_file(path, type)
65
65
expect ( response . content ) . to be_present
66
66
end
67
67
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
91
91
end
92
92
93
93
describe 'attachment types' do
0 commit comments