Skip to content
Snippets Groups Projects
Unverified Commit cffe6ec9 authored by Tetiana Chupryna's avatar Tetiana Chupryna :sunflower:
Browse files

Cleanup current_page_sentence as unused

current_page_sentence was used in the past at some point of time this
method stopped being used in favour of current_page_short_description
parent 135de781
No related branches found
No related tags found
2 merge requests!171309Draft: Fetch issues / MRs / epics count in the sidebar with GraphQL,!171156Cleanup current_page_sentence as unused
Showing with 4 additions and 91 deletions
......@@ -20,14 +20,6 @@ def current_page_type
"build"
end
def current_page_sentence
return '' unless Feature.enabled?(:ai_build_reader_for_chat, current_user)
<<~SENTENCE
The user is currently on a page that displays a ci build which the user might refer to, for example, as 'current', 'this' or 'that'. The data is provided in <resource></resource> tags, and if it is sufficient in answering the question, utilize it instead of using the 'BuildReader' tool.
SENTENCE
end
def current_page_short_description
return '' unless Feature.enabled?(:ai_build_reader_for_chat, current_user)
......
......@@ -20,14 +20,6 @@ def current_page_type
"commit"
end
def current_page_sentence
return '' unless Feature.enabled?(:ai_commit_reader_for_chat, current_user)
<<~SENTENCE
The user is currently on a page that displays a commit with a description, comments, etc., which the user might refer to, for example, as 'current', 'this' or 'that'. The data is provided in <resource></resource> tags, and if it is sufficient in answering the question, utilize it instead of using the 'CommitReader' tool.
SENTENCE
end
def current_page_short_description
return '' unless Feature.enabled?(:ai_commit_reader_for_chat, current_user)
......
......@@ -19,12 +19,6 @@ def current_page_type
"epic"
end
def current_page_sentence
<<~SENTENCE
The user is currently on a page that displays an epic with a description, comments, etc., which the user might refer to, for example, as 'current', 'this' or 'that'. The data is provided in <resource></resource> tags, and if it is sufficient in answering the question, utilize it instead of using the 'EpicReader' tool.
SENTENCE
end
def current_page_short_description
<<~SENTENCE
The user is currently on a page that displays an epic with a description, comments, etc., which the user might refer to, for example, as 'current', 'this' or 'that'. The title of the epic is '#{resource.title}'.
......
......@@ -19,12 +19,6 @@ def current_page_type
"issue"
end
def current_page_sentence
<<~SENTENCE
The user is currently on a page that displays an issue with a description, comments, etc., which the user might refer to, for example, as 'current', 'this' or 'that'. The data is provided in <resource></resource> tags, and if it is sufficient in answering the question, utilize it instead of using the 'IssueReader' tool.
SENTENCE
end
def current_page_short_description
<<~SENTENCE
The user is currently on a page that displays an issue with a description, comments, etc., which the user might refer to, for example, as 'current', 'this' or 'that'. The title of the issue is '#{resource.title}'.
......
......@@ -19,12 +19,6 @@ def current_page_type
"merge_request"
end
def current_page_sentence
<<~SENTENCE
The user is currently on a page that displays a merge request with a description, comments, etc., which the user might refer to, for example, as 'current', 'this' or 'that'. The data is provided in <resource></resource> tags, and if it is sufficient in answering the question, utilize it instead of using the 'MergeRequestReader' tool.
SENTENCE
end
def current_page_short_description
<<~SENTENCE
The user is currently on a page that displays a merge request with a description, comments, etc., which the user might refer to, for example, as 'current', 'this' or 'that'. The title of the merge request is '#{resource.title}'. Remember to use the 'MergeRequestReader' tool if they ask a question about the Merge Request.
......
......@@ -7,7 +7,7 @@ class GitlabContext
attr_accessor :current_user, :container, :resource, :ai_request, :tools_used, :extra_resource, :request_id,
:current_file, :agent_version, :additional_context
delegate :current_page_type, :current_page_sentence, :current_page_short_description,
delegate :current_page_type, :current_page_short_description,
to: :authorized_resource, allow_nil: true
# rubocop:disable Metrics/ParameterLists -- we probably need to rethink this initializer
......
......@@ -113,7 +113,7 @@
let(:resource) { create(:issue) }
it 'returns nil' do
expect(context.current_page_sentence).to be_nil
expect(context.current_page_short_description).to be_nil
end
end
......@@ -121,7 +121,8 @@
let(:resource) { create(:issue, project: project) }
it 'returns sentence about the resource' do
expect(context.current_page_sentence).to include("The user is currently on a page that displays an issue")
expect(context.current_page_short_description)
.to include("The user is currently on a page that displays an issue")
end
end
end
......
......@@ -31,23 +31,6 @@
end
end
describe '#current_page_sentence' do
it 'returns prompt' do
expect(wrapped_build.current_page_sentence)
.to include("utilize it instead of using the 'BuildReader' tool.")
end
context 'with ai_build_reader_for_chat feature flag disabled' do
before do
stub_feature_flags(ai_build_reader_for_chat: false)
end
it 'returns empty string' do
expect(wrapped_build.current_page_sentence).to eq("")
end
end
end
describe '#current_page_short_description' do
it 'returns prompt' do
expect(wrapped_build.current_page_short_description)
......
......@@ -30,24 +30,6 @@
end
end
describe '#current_page_sentence' do
it 'returns prompt' do
expect(wrapped_commit.current_page_sentence)
.to include("utilize it instead of using the 'CommitReader' tool.")
end
context 'with mr for chat feature flag disabled' do
before do
stub_feature_flags(ai_commit_reader_for_chat: false)
end
it 'returns empty string' do
expect(wrapped_commit.current_page_sentence)
.to eq("")
end
end
end
describe '#current_page_short_description' do
it 'returns prompt' do
expect(wrapped_commit.current_page_short_description)
......
......@@ -23,12 +23,6 @@
end
end
describe '#current_page_sentence' do
it 'returns prompt' do
expect(wrapped_epic.current_page_sentence).to include("utilize it instead of using the 'EpicReader' tool")
end
end
describe '#current_page_short_description' do
it 'returns prompt' do
expect(wrapped_epic.current_page_short_description).to include("The title of the epic is '#{epic.title}'.")
......
......@@ -22,12 +22,6 @@
end
end
describe '#current_page_sentence' do
it 'returns prompt' do
expect(wrapped_issue.current_page_sentence).to include("utilize it instead of using the 'IssueReader' tool")
end
end
describe '#current_page_short_description' do
it 'returns prompt' do
expect(wrapped_issue.current_page_short_description).to include("The title of the issue is '#{issue.title}'.")
......
......@@ -29,13 +29,6 @@
end
end
describe '#current_page_sentence' do
it 'returns prompt' do
expect(wrapped_merge_request.current_page_sentence)
.to include("utilize it instead of using the 'MergeRequestReader' tool.")
end
end
describe '#current_page_short_description' do
it 'returns prompt' do
expect(wrapped_merge_request.current_page_short_description)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment