Skip to content
代码片段 群组 项目
未验证 提交 8d3638da 编辑于 作者: Michael Thomas's avatar Michael Thomas 提交者: GitLab
浏览文件

Remove OpenAI workhorse and API key references

上级 001186be
No related branches found
No related tags found
无相关合并请求
......@@ -68,7 +68,6 @@ def visible_attributes
:product_analytics_configurator_connection_string,
:cube_api_base_url,
:cube_api_key,
:openai_api_key,
:security_policy_global_group_approvers_enabled,
:security_approval_policies_limit,
:anthropic_api_key,
......
......@@ -62,7 +62,6 @@ module SettingsHelpers
optional :git_rate_limit_users_allowlist, type: Array[String], coerce_with: ::API::Validations::Types::CommaSeparatedToArray.coerce, desc: 'List of usernames excluded from Git anti-abuse rate limits'
optional :git_rate_limit_users_alertlist, type: Array[Integer], desc: 'List of user ids who will be emailed when Git abuse rate limit is exceeded'
optional :auto_ban_user_on_excessive_projects_download, type: Grape::API::Boolean, desc: 'Ban users from the application when they exceed maximum number of unique projects download in the specified time period'
optional :openai_api_key, type: String, desc: "OpenAI API key"
optional :anthropic_api_key, type: String, desc: "Anthropic API key"
optional :make_profile_private, type: Grape::API::Boolean, desc: 'Flag indicating if users are permitted to make their profiles private'
optional :service_access_tokens_expiration_enforced, type: Grape::API::Boolean, desc: "To enforce token expiration for Service accounts users"
......
# frozen_string_literal: true
module Gitlab
module Llm
module OpenAi
class Workhorse
OPEN_AI_API_URL = "https://api.openai.com/v1"
CHAT_URL = "#{OPEN_AI_API_URL}/chat/completions".freeze
class << self
def default_headers
{
'Authorization' => ["Bearer #{::Gitlab::CurrentSettings.openai_api_key}"],
'Content-Type' => ['application/json']
}
end
def chat_response(options:)
Gitlab::Workhorse.send_url(CHAT_URL,
body: options.to_json, headers: default_headers, method: "POST")
end
end
end
end
end
end
......@@ -8,10 +8,6 @@
expect(visible_attributes).to include(*%i[max_personal_access_token_lifetime])
end
it 'contains openai_api_key value' do
expect(visible_attributes).to include(*%i[openai_api_key])
end
it 'contains anthropic_api_key value' do
expect(visible_attributes).to include(*%i[anthropic_api_key])
end
......
......@@ -168,15 +168,6 @@
end
end
context 'openai api key setting' do
it 'updates openai_api_key' do
put api('/application/settings', admin, admin_mode: true), params: { openai_api_key: 'OPENAI_API_KEY' }
expect(response).to have_gitlab_http_status(:ok)
expect(json_response['openai_api_key']).to eq('OPENAI_API_KEY')
end
end
context 'anthropic api key setting' do
it 'updates anthropic_api_key' do
put api('/application/settings', admin, admin_mode: true), params: { anthropic_api_key: 'ANTHROPIC_API_KEY' }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册