Skip to content
Snippets Groups Projects
Verified Commit e4ff8055 authored by Sean Arnold's avatar Sean Arnold :one: Committed by GitLab
Browse files

Merge branch '498627-support-work-item-in-duo-chat-api' into 'master'

Support work items in Duo Chat API

See merge request !170424



Merged-by: default avatarSean Arnold <sarnold@gitlab.com>
Approved-by: default avatarLesley Razzaghian <lrazzaghian@gitlab.com>
Approved-by: default avatarSean Arnold <sarnold@gitlab.com>
Co-authored-by: default avatarEva Kadlecová <ekadlecova@gitlab.com>
parents 0b1aac7a 798a0ea0
No related branches found
No related tags found
2 merge requests!171309Draft: Fetch issues / MRs / epics count in the sidebar with GraphQL,!170424Support work items in Duo Chat API
Pipeline #1522821150 passed
......@@ -8,7 +8,7 @@ class Chat < ::API::Base
allow_access_with_scope :ai_features
AVAILABLE_RESOURCES = %w[issue epic group project merge_request commit build].freeze
AVAILABLE_RESOURCES = %w[issue epic group project merge_request commit build work_item].freeze
RESOURCE_TYPE_MAPPING = { 'build' => 'Ci::Build' }.freeze
before do
......
......@@ -301,6 +301,27 @@
end
end
context 'with a work item' do
let_it_be(:work_item) { create(:work_item, :epic, project: project) }
let!(:resource) { work_item }
let(:params) do
{ content: content, resource_type: "work_item", resource_id: resource.id }
end
before_all do
project.add_developer(authorized_user)
end
it 'sends resource to the chat' do
expect(chat_message).to receive(:save!)
expect(Gitlab::Llm::ChatMessage).to receive(:new).with(chat_message_params).and_return(chat_message)
expect(Llm::Internal::CompletionService).to receive(:new).with(chat_message, options).and_return(chat)
expect(chat).to receive(:execute)
post_api
end
end
context 'without resource' do
let(:params) { { content: content } }
let(:resource) { current_user }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment