From decf1bb49d737ea15308400f22f89d1d1e71d13d Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 16 Oct 2024 15:57:36 -0300 Subject: [PATCH] FIX: api key header error (#839) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: api key header error * FIX: remove unnecessary headers * FIX: a error * FEATURE: Add both headers --------- Co-authored-by: 耗子 --- lib/inference/hugging_face_text_embeddings.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/inference/hugging_face_text_embeddings.rb b/lib/inference/hugging_face_text_embeddings.rb index 1daab50b..e30ce57f 100644 --- a/lib/inference/hugging_face_text_embeddings.rb +++ b/lib/inference/hugging_face_text_embeddings.rb @@ -18,6 +18,7 @@ module ::DiscourseAi if SiteSetting.ai_hugging_face_tei_api_key.present? headers["X-API-KEY"] = SiteSetting.ai_hugging_face_tei_api_key + headers["Authorization"] = "Bearer #{SiteSetting.ai_hugging_face_tei_api_key}" end conn = Faraday.new { |f| f.adapter FinalDestination::FaradayAdapter } @@ -44,6 +45,7 @@ module ::DiscourseAi if SiteSetting.ai_hugging_face_tei_reranker_api_key.present? headers["X-API-KEY"] = SiteSetting.ai_hugging_face_tei_reranker_api_key + headers["Authorization"] = "Bearer #{SiteSetting.ai_hugging_face_tei_reranker_api_key}" end conn = Faraday.new { |f| f.adapter FinalDestination::FaradayAdapter }