Use selected text in base prompt if present
What does this MR do and why?
When user selects some code, it makes sense to include this in the prompt (and prefer over blob from referrer).
Related to #431359 (closed)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- In rails console enable code_tasks
Feature.enable(:code_tasks)
- Open gitlab duo chat UI
- In a separate browser tab open graphql-explorer and send message request below:
mutation {
aiAction(input: {chat: {content: "Refactor selected code", currentFile: {
fileName: "test.py",
selectedText: "
def extract
lines = content.to_s.lines
comment_block = []
trimmed_lines = 0
end
",
contentAboveCursor: "
module CodeSuggestions
class InstructionsExtractor
EMPTY_LINES_LIMIT = 1
MIN_LINES_OF_CODE = 5
",
}}}) {
clientMutationId
errors
}
}
- check in chat UI that an answer relevant to the selected text is returned
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Jan Provaznik