module AiModel
Constants
- DEFAULT
- KEY
Public Instance Methods
Source
# File lib/ai/model.rb, line 27 def configured?(network:, channel:, yaml_default: nil) db_value = BotOptions.get(network: network, channel: channel, key: KEY, default: nil) return true unless db_value.nil? || db_value.to_s.strip.empty? !yaml_default.to_s.strip.empty? end
Source
# File lib/ai/model.rb, line 16 def resolve(network:, channel:, yaml_default: nil, fallback: DEFAULT) db_value = BotOptions.get(network: network, channel: channel, key: KEY, default: nil) model = db_value.to_s.strip unless db_value.nil? return model unless model.nil? || model.empty? yaml = yaml_default.to_s.strip return yaml unless yaml.empty? fallback end