fix lint
This commit is contained in:
parent
6cf411ec90
commit
f572a7cc2c
|
@ -25,7 +25,7 @@ module ::DiscourseAI
|
|||
"#{SiteSetting.ai_sentiment_inference_service_api_endpoint}/api/v1/classify",
|
||||
model,
|
||||
content,
|
||||
SiteSetting.ai_sentiment_inference_service_api_key
|
||||
SiteSetting.ai_sentiment_inference_service_api_key,
|
||||
)
|
||||
|
||||
store_classification(model, classification)
|
||||
|
|
|
@ -26,7 +26,7 @@ module ::DiscourseAI
|
|||
"#{SiteSetting.ai_toxicity_inference_service_api_endpoint}/api/v1/classify",
|
||||
SiteSetting.ai_toxicity_inference_service_api_model,
|
||||
content,
|
||||
SiteSetting.ai_toxicity_inference_service_api_key
|
||||
SiteSetting.ai_toxicity_inference_service_api_key,
|
||||
)
|
||||
store_classification
|
||||
consider_flagging
|
||||
|
|
|
@ -3,22 +3,11 @@
|
|||
module ::DiscourseAI
|
||||
class InferenceManager
|
||||
def self.perform!(endpoint, model, content, api_key)
|
||||
headers = { "Referer" => Discourse.base_url, "Content-Type" => "application/json" }
|
||||
|
||||
headers = {
|
||||
"Referer" => Discourse.base_url,
|
||||
"Content-Type" => "application/json",
|
||||
}
|
||||
headers["X-API-KEY"] = api_key if api_key.present?
|
||||
|
||||
if api_key.present?
|
||||
headers["X-API-KEY"] = api_key
|
||||
end
|
||||
|
||||
response =
|
||||
Faraday.post(
|
||||
endpoint,
|
||||
{ model: model, content: content }.to_json,
|
||||
headers,
|
||||
)
|
||||
response = Faraday.post(endpoint, { model: model, content: content }.to_json, headers)
|
||||
|
||||
raise Net::HTTPBadResponse unless response.status == 200
|
||||
|
||||
|
|
Loading…
Reference in New Issue