Compare commits

...
Author SHA1 Message Date
Shivam Mishra 22169f0915 feat: use captain key for HC embedding 2026-05-21 20:15:32 +05:30
@@ -65,7 +65,8 @@ module Enterprise::Concerns::Article
{ role: 'system', content: article_to_search_terms_prompt },
{ role: 'user', content: "title: #{title} \n description: #{description} \n content: #{content}" }
]
headers = { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{ENV.fetch('OPENAI_API_KEY', nil)}" }
headers = { 'Content-Type' => 'application/json',
'Authorization' => "Bearer #{InstallationConfig.find_by(name: 'CAPTAIN_OPEN_AI_API_KEY')&.value}" }
body = { model: 'gpt-4o', messages: messages, response_format: { type: 'json_object' } }.to_json
Rails.logger.info "Requesting Chat GPT with body: #{body}"
response = HTTParty.post(openai_api_url, headers: headers, body: body)