2024-11-04 07:14:34 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module DiscourseAi
|
|
|
|
module Sentiment
|
|
|
|
class SentimentSiteSettingJsonSchema
|
|
|
|
def self.schema
|
|
|
|
@schema ||= {
|
|
|
|
type: "array",
|
|
|
|
items: {
|
|
|
|
type: "object",
|
|
|
|
format: "table",
|
|
|
|
title: "model",
|
|
|
|
properties: {
|
|
|
|
model_name: {
|
|
|
|
type: "string",
|
|
|
|
},
|
|
|
|
endpoint: {
|
|
|
|
type: "string",
|
|
|
|
},
|
|
|
|
api_key: {
|
|
|
|
type: "string",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
required: %w[model_name endpoint api_key],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.values
|
2024-12-03 08:27:03 -05:00
|
|
|
return {} if SiteSetting.ai_sentiment_model_configs.blank?
|
2024-11-04 07:14:34 -05:00
|
|
|
JSON.parse(SiteSetting.ai_sentiment_model_configs, object_class: OpenStruct)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|