Skip to content
Snippets Groups Projects

fix: conditionally include partials of current page context

Merged Tetiana Chupryna requested to merge brytannia-render-context-on-aigw into main
All threads resolved!

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=>":airplane: Work Items - Migrate Epics to Work Items"} <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 ':airplane: Work Items - Migrate Epics to Work Items'.\n"} <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.
Edited by Tetiana Chupryna

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • requested review from @eduardobonet

    • Resolved by Tan Le

      @eduardobonet :wave: 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:

      1. Move current page resource text to AIGW
      2. For Merge Request page add different message if user has Enterprise addon.
  • Tetiana Chupryna changed milestone to %17.7

    changed milestone to %17.7

  • added 1 commit

    • a43b4c78 - refactor: update merge request context template

    Compare with previous version

  • Tetiana Chupryna
  • added 1 commit

    • aca08eed - refactor: extract current page context to a separate file

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 5b3d708f - refactor: improve context prompt partial

    Compare with previous version

  • Eduardo Bonet requested changes

    requested changes

  • Tetiana Chupryna added 269 commits

    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

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • 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 profile link current availability (UTC+0, 1 hour behind author) @eduardobonet profile link current availability (UTC+1, same timezone as author)

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

    Edited by ****
  • added 1 commit

    Compare with previous version

  • Tetiana Chupryna changed milestone to %17.9

    changed milestone to %17.9

  • Tetiana Chupryna added 2 commits

    added 2 commits

    • 2d4db32b - chore: reformat touched files
    • 6880e786 - chore: create a parent class for new page contexts

    Compare with previous version

  • added 1 commit

    • 46e393cc - chore: use union of context model classes

    Compare with previous version

  • Tetiana Chupryna added 181 commits

    added 181 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Tetiana Chupryna changed the description

    changed the description

  • added 1 commit

    • c13f8534 - chore: format the prompt for issue

    Compare with previous version

  • Tetiana Chupryna marked this merge request as ready

    marked this merge request as ready

  • Tetiana Chupryna marked the checklist item Tests added for new functionality. If not, please raise an issue to follow up. as completed

    marked the checklist item Tests added for new functionality. If not, please raise an issue to follow up. as completed

    • 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 of context params that would be automatically recognised as an object of specific context resource. Inheriting from Context creates an issue as Context object could be the same type as "new" contexts. Inheriting from a one new class and not BaseModel 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. :bow:

  • requested review from @eduardobonet

  • Eduardo Bonet requested review from @tle_gitlab

    requested review from @tle_gitlab

  • Tan Le
  • Tan Le
  • Eduardo Bonet
  • added 1 commit

    Compare with previous version

  • requested review from @tle_gitlab

  • Tan Le approved this merge request

    approved this merge request

  • Tan Le resolved all threads

    resolved all threads

  • Tan Le changed title from fix: conditianaly include partials of current page context to fix: conditionally include partials of current page context

    changed title from fix: conditianaly include partials of current page context to fix: conditionally include partials of current page context

  • Eduardo Bonet approved this merge request

    approved this merge request

  • Tan Le
  • Tan Le resolved all threads

    resolved all threads

  • Tan Le mentioned in issue #787

    mentioned in issue #787

  • merged

  • Tan Le mentioned in commit 71adac90

    mentioned in commit 71adac90

  • Please register or sign in to reply
    Loading