fix: conditionally include partials of current page context
What does this merge request do and why?
Solution for https://gitlab.com/gitlab-org/gitlab/-/issues/499675
We want to move test for current page context to AI GW so we can easier control it and modify it in case of addon discrepancies.
Tests
Context | flag | Sent params | Resulting prompt snippet |
---|---|---|---|
Issue | Enabled | {:messages=>[{:role=>"user", :content=>"summarize this issue", :context=>{:type=>"issue", :title=>"Update work item metadata with item type and icon"}... | <context>\n <type>issue</type>\n <content>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 'Update work item metadata with item type and icon'.</content>\n</context>\n\nsummarize this issue |
Issue | Disabled | {:messages=>[{:role=>"user", :content=>"summarize this issue", :context=>{:type=>"issue", :content=>"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 'Update work item metadata with item type and icon'.\n"}... | <context>\n<type>issue</type>\n<content>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 'Update work item metadata with item type and icon'.\n</content>\n</context>\n\nsummarize this issue |
Epic | Enabled | {:messages=>[{:role=>"user", :content=>"summarize this epic", :context=>{:type=>"epic", :title=>"![]() |
<context>\n <type>epic</type>\n <content>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 '✈️ Work Items - Migrate Epics to Work Items'.</content>\n</context>\n\nsummarize this epic |
Epic | Disabled | {:messages=>[{:role=>"user", :content=>"summarize this epic", :context=>{:type=>"epic", :content=>"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 '![]() |
<context>\n <type>epic</type>\n <content>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 '✈️ Work Items - Migrate Epics to Work Items'.\n</content>\n</context>\n\nsummarize this epic |
MergeRequest | Enabled | {:messages=>[{:role=>"user", :content=>"what does this mr do", :context=>{:type=>"merge_request", :title=>"Update file ruby.rb"} | <context>\n <type>merge_request</type>\n <content>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 'Update file ruby.rb'.</content>\n</context>\n\nwhat does this mr do |
MergeRequest | Disabled | {:messages=>[{:role=>"user", :content=>"what does this mr do", :context=>{:type=>"merge_request", :content=>"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 'Update file ruby.rb'.\n"} | <context>\n <type>merge_request</type>\n <content>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 'Update file ruby.rb'.\n</content>\n</context>\n\nwhat does this mr do |
Commit | Enabled | {:messages=>[{:role=>"user", :content=>"what does this commit do", :context=>{:type=>"commit", :title=>"Update .gitlab-ci.yml file"} | <context>\n <type>commit</type>\n <content>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 title of the commit is 'Update .gitlab-ci.yml file'.</content>\n</context>\n\nwhat does this commit do |
Commit | Disabled | {:messages=>[{:role=>"user", :content=>"what does this commit fix", :context=>{:type=>"commit", :content=>"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 title of the commit is 'Update .gitlab-ci.yml file'.\n"} | <context>\n <type>commit</type>\n <content>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 title of the commit is 'Update .gitlab-ci.yml file'.\n</content>\n</context>\n\nwhat does this commit fix |
Ci Build | Enabled | {:messages=>[{:role=>"user", :content=>"generate summary", :context=>{:type=>"build"} | <context>\n <type>build</type>\n <content>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'.</content>\n</context>\n\ngenerate summary |
Ci Build | Disabled | {:messages=>[{:role=>"user", :content=>"generate summary", :context=>{:type=>"build", :content=>"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'.\n"} | <context>\n <type>build</type>\n <content>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'.\n</content>\n</context>\n\ngenerate summary |
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed.
Merge request reports
Activity
assigned to @brytannia
Reviewer roulette
To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines.
Once you've decided who will review this merge request, mention them as you normally would! Danger does not automatically notify them for you.
Reviewer Maintainer @missy-gitlab
(UTC-5, 6 hours behind author)
@tle_gitlab
(UTC+10, 9 hours ahead of author)
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Danger- Resolved by Tetiana Chupryna
- Resolved by Tetiana Chupryna
requested review from @eduardobonet
- Resolved by 🤖 GitLab Bot 🤖
Proper labels assigned to this merge request. Please ignore me.
@brytannia
- please see the following guidance and update this merge request.1 Error Please add typebug typefeature, or typemaintenance label to this merge request. Edited by 🤖 GitLab Bot 🤖
- Resolved by Tan Le
@eduardobonet
could I ask you to check this MR while it still in draft? I just want to make sure that the direction I chosen makes sense. With this MR I want to achieve 2 things:- Move current page resource text to AIGW
- For Merge Request page add different message if user has Enterprise addon.
changed milestone to %17.7
added Category:Duo Chat bugavailability groupduo chat labels
added typebug label
added devopsai-powered sectiondata-science labels
added 1 commit
- a43b4c78 - refactor: update merge request context template
- Resolved by Tetiana Chupryna
added 1 commit
- aca08eed - refactor: extract current page context to a separate file
- Resolved by Eduardo Bonet
- Resolved by Tetiana Chupryna
- Resolved by Eduardo Bonet
- Resolved by Tetiana Chupryna
mentioned in issue gitlab-org/gitlab#508317 (closed)
added 269 commits
-
5b3d708f...ec2a381d - 262 commits from branch
main
- 3e1811d7 - fix: conditianaly include partials of current page context
- 53e4a955 - refactor: update merge request context template
- 3e7eba52 - refactor: extract current page context to a separate file
- 28685f62 - refactor: fix style issues
- 541fac41 - refactor: improve context prompt partial
- 4a55395a - feat: add missing context templates
- fe59f17b - chore: remove unused code
Toggle commit list-
5b3d708f...ec2a381d - 262 commits from branch
Reviewer roulette
To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines.
Once you've decided who will review this merge request, mention them as you normally would! Danger does not automatically notify them for you.
Reviewer Maintainer @shekharpatnaik
(UTC+0, 1 hour behind author)
@eduardobonet
(UTC+1, same timezone as author)
If needed, you can retry the
danger-review
job that generated this comment.Generated by
DangerEdited by ****changed milestone to %17.9
mentioned in merge request gitlab-org/gitlab!177622 (merged)
added 181 commits
-
46e393cc...f23f3204 - 168 commits from branch
main
- f23f3204...11f170cf - 3 earlier commits
- 457c2ddc - refactor: fix style issues
- 965211dc - refactor: improve context prompt partial
- 70da4974 - feat: add missing context templates
- 279ca519 - chore: remove unused code
- 12540392 - chore: add end line
- 7f9f483e - chore: fix linter issue
- 2f2d94c4 - chore: reformat touched files
- 20b7d0f2 - chore: create a parent class for new page contexts
- 9e885c7e - chore: use union of context model classes
- 7545f5c2 - chore: add additional test case
Toggle commit list-
46e393cc...f23f3204 - 168 commits from branch
- Resolved by Tan Le
@eduardobonet this MR is ready for your review again. I wasn't able to get away from type
Union
as it was only one way that worked for me to pass random set ofcontext
params that would be automatically recognised as an object of specific context resource. Inheriting fromContext
creates an issue asContext
object could be the same type as "new" contexts. Inheriting from a one new class and notBaseModel
lead to specific params not to be passed. In the same type this automatic typing is so useful, I'd like to keep it. Let me know what do you think and if the current approach has flaws and if you can consider a follow-up issue to improve it.
requested review from @eduardobonet
requested review from @tle_gitlab
added workflowin review label
- Resolved by Tan Le
- Resolved by Tan Le
- Resolved by Tan Le
Thank you for your work on this MR, @brytannia I have left some suggestions. Please let me what you think
- Resolved by Eduardo Bonet
requested review from @tle_gitlab
- Resolved by Tan Le
mentioned in issue #787
started a merge train
mentioned in commit 71adac90
mentioned in merge request gitlab-org/gitlab!180393 (merged)