Skip to content

feat(ai-context): Injected File Context in Duo Chat

Angelo Rivera requested to merge angelo.rivera-Injected-Context-7 into main

What does this MR do?

NOTE: This MR depends on @elwyn-gitlab 's MR !1918 (merged)

This Merge Request implements the ChatController and AIContextManager for Injected Context, integrating AI Context Management into the GitLab Chat flow.

It adds functionality to manage AI Context Items—such as adding, removing, and querying context items—and integrates these features into the ChatController.

MR Pipeline

MR Number MR Link
1 chore: introduce Virtual File System Service - ... (gitlab-org/editor-extensions/gitlab-lsp!735 - merged)
2 chore: introduce the GitIgnore Implementation -... (gitlab-org/editor-extensions/gitlab-lsp!736 - merged)
3 chore: introduce the RepositoryService - Inject... (gitlab-org/editor-extensions/gitlab-lsp!765 - merged)
4 chore: add Tracked Files to RepositoryService (gitlab-org/editor-extensions/gitlab-lsp!799 - merged)
5 chore: RepositoryService/Git integration testin... (gitlab-org/editor-extensions/gitlab-lsp!800 - merged)
6 refactor: expose DuoProject from DuoProjectAcce... (gitlab-org/editor-extensions/gitlab-lsp!802 - merged)
7 refactor: expose types from AIContextManager an... (gitlab-org/editor-extensions/gitlab-lsp!803 - merged)
8 feat(ai-context): Introduce the LocalFilesProvi... (gitlab-org/editor-extensions/gitlab-lsp!804 - merged)
9 feat(ai-context): Injected File Context in Duo ... (!1952 - merged) <-- you are here

Key Changes

  • Implemented AIContextManager Methods:
    • Added methods in AIContextManager for querying, adding, removing, and retrieving AI context items (ai_context_manager.ts).
    • These methods facilitate communication with the language server to manage context items.
  • Integrated AIContextManager into GitLabChatController:
    • Modified GitLabChatController to use AIContextManager for handling context items within the chat interface (gitlab_chat_controller.ts).
    • Implemented methods to search, add, and remove context items based on user actions.
  • Updated GitLabChatRecord:
    • Modified GitLabChatRecord to include AI context items when building with context (gitlab_chat_record.ts).
    • Ensured that context items are included in AI action requests.
  • Updated GitLabChatApi:
    • Modified GitLabChatApi to handle additional context items when sending AI actions (gitlab_chat_api.ts).
    • Added support for new GraphQL queries and mutations that include additional context.

How does this fit into the larger feature set?

This MR is part of the ongoing effort to implement Injected File Context in Duo Chat for IDE.

This MR builds upon foundational work in previous MRs, such as introducing LocalFilesProvider and refactoring AI context management types. By integrating the AIContextManager into the ChatController , this MR enables users to manage and inject additional context directly into the chat interface.

Testing

Unit Tests:

  • Added unit tests for AIContextManager to verify its methods (ai_context_manager.test.ts).
  • Added unit tests for GitLabChatController and GitLabChatRecord to verify integration with AIContextManager (gitlab_chat_controller.test.ts, gitlab_chat_record.test.ts).
  • Tests cover adding, removing, querying, and retrieving context items.

Manual Testing:

  • Manually tested the chat interface to add, search, and remove context items.
  • Verified that AI assistant responses include the injected context when expected.
  • Tested error scenarios, such as handling missing or invalid context items.
Edited by Angelo Rivera

Merge request reports

Loading