Skip to content
Snippets Groups Projects

New resource reader capabilities

Merged Gosia Ksionek requested to merge mk-new-resource-reader into master
1 file
+ 24
2
Compare changes
  • Side-by-side
  • Inline
@@ -10,12 +10,34 @@ def serialize(issue:, user:)
issue: {
data: ::IssueSerializer.new(current_user: user,
project: issue.project).represent(issue),
notes: []
notes:
}
}
end
def notes(issue:, user:); end
def notes(issue:, user:)
notes = NotesFinder.new(context.current_user, target: resource).execute.by_humans
content = if notes.exists?
notes_content = notes_to_summarize(notes) # rubocop: disable CodeReuse/ActiveRecord
options[:notes_content] = notes_content
options[:num] = Random.rand(100..999)
end
end
def notes_to_summarize(notes)
notes_content = +""
notes.each_batch do |batch|
batch.pluck(:id, :note).each do |note| # rubocop: disable CodeReuse/ActiveRecord
input_content_limit = provider_prompt_class::INPUT_CONTENT_LIMIT
break notes_content if notes_content.size + note[1].size >= input_content_limit
notes_content << note[1]
end
end
notes_content
end
end
end
end
Loading