Skip to content
代码片段 群组 项目
提交 72d85a10 编辑于 作者: George Koltsov's avatar George Koltsov
浏览文件

Merge branch 'jp-cache-fixes' into 'master'

无相关合并请求
......@@ -33,7 +33,7 @@ def add(payload)
role: payload[:role]
}
data[:content] = payload[:content][0, MAX_TEXT_LIMIT] if payload[:content]
data[:error] = payload[:errors].join(". ") if payload[:errors]
data[:error] = payload[:errors].join(". ") if payload[:errors].present?
cache_data(data)
end
......
......@@ -13,7 +13,7 @@ def execute(user, resource, options)
response = ::Gitlab::Llm::TanukiBot.execute(current_user: user, question: question)
response_modifier = Gitlab::Llm::OpenAi::ResponseModifiers::TanukiBot.new(response)
response_options = { request_id: options[:request_id] }
response_options = { request_id: params[:request_id] }
::Gitlab::Llm::GraphqlSubscriptionResponseService.new(
user, resource, response_modifier, options: response_options
......
......@@ -43,6 +43,15 @@
expect(last.timestamp).not_to be_nil
end
it 'does not set error when errors are empty' do
payload[:errors] = []
subject.add(payload)
last = subject.find_all.last
expect(last.errors).to eq([])
end
it 'raises an exception when role is missing' do
payload[:role] = nil
......
......@@ -6,7 +6,8 @@
let_it_be(:user) { create(:user) }
let(:question) { 'A question' }
let(:options) { { question: question, request_id: 'uuid' } }
let(:options) { { question: question } }
let(:params) { { request_id: 'uuid' } }
let(:template_class) { ::Gitlab::Llm::OpenAi::Templates::TanukiBot }
let(:ai_response) do
......@@ -19,7 +20,7 @@
}.to_json
end
subject(:tanuki_bot) { described_class.new(template_class).execute(user, user, options) }
subject(:tanuki_bot) { described_class.new(template_class, params).execute(user, user, options) }
describe '#execute' do
it 'makes a call to ::Gitlab::Llm::TanukiBot' do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册