Skip to content
代码片段 群组 项目
未验证 提交 6ddb6754 编辑于 作者: Gary Holtz's avatar Gary Holtz 提交者: GitLab
浏览文件

Merge branch 'send-unavailable-resources-to-aigw' into 'master'

Set unavailable resources in AI Gateway request when MR feature flag is enabled

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/164133



Merged-by: default avatarGary Holtz <gholtz@gitlab.com>
Approved-by: default avatarNathan Weinshenker <nweinshenker@gitlab.com>
Approved-by: default avatarGary Holtz <gholtz@gitlab.com>
Co-authored-by: default avatarlesley <lrazzaghian@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -169,11 +169,17 @@ def request_body_chat_2(prompt:, options: {})
additional_context: options[:additional_context]
}.compact
{
response = {
prompt: prompt,
options: option_params,
model_metadata: options[:model_metadata]
}.compact
}
if Feature.enabled?(:ai_merge_request_reader_for_chat, user)
response[:unavailable_resources] = %w[Pipelines Vulnerabilities]
end
response.compact
end
def payload_params(options)
......
......@@ -8,6 +8,10 @@
subject(:instance) { described_class.new(user, tracking_context: tracking_context) }
before do
Feature.disable(:ai_merge_request_reader_for_chat)
end
describe 'initializer' do
it 'initializes the AI Gateway client' do
expect(instance.ai_client.class).to eq(::Gitlab::Llm::AiGateway::Client)
......@@ -244,6 +248,18 @@
end
it_behaves_like 'performing request to the AI Gateway'
context 'when `ai_merge_request_reader_for_chat` feature flag is enabled' do
before do
stub_feature_flags(ai_merge_request_reader_for_chat: true)
end
let(:body) do
super().merge(unavailable_resources: %w[Pipelines Vulnerabilities])
end
it_behaves_like 'performing request to the AI Gateway'
end
end
context 'when request is sent to chat tools implemented via agents' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册