feat(ai-context): Injected File Context in Duo Chat
What does this MR do?
@elwyn-gitlab 's MR !1918 (merged)
NOTE: This MR depends onThis 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
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.
- Added methods in
-
Integrated AIContextManager into GitLabChatController:
- Modified
GitLabChatController
to useAIContextManager
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.
- Modified
-
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.
- Modified
-
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.
- Modified
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
andGitLabChatRecord
to verify integration withAIContextManager
(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