1
0
mirror of synced 2026-08-04 14:56:54 +00:00

FIX: Misconfigured OpenAI API for embeddings shouldn't spam logs (#440)

This commit is contained in:
Rafael dos Santos Silva
2024-01-24 15:57:18 -03:00
committed by GitHub
parent 04bc402aae
commit 16d666fe69
+7 -3
View File
@@ -20,14 +20,18 @@ module ::DiscourseAi
{ model: model, input: content }.to_json,
headers,
)
if response.status != 200
case response.status
when 200
JSON.parse(response.body, symbolize_names: true)
when 429
# TODO add a AdminDashboard Problem?
else
Rails.logger.warn(
"OpenAI Embeddings failed with status: #{response.status} body: #{response.body}",
)
raise Net::HTTPBadResponse
end
JSON.parse(response.body, symbolize_names: true)
end
end
end