ui and be for toggles

This commit is contained in:
aakashb95
2025-12-18 16:51:29 +05:30
parent 0a0f96ea0a
commit 4ac6c19c19
5 changed files with 75 additions and 19 deletions
@@ -5,7 +5,23 @@ class Api::V1::Accounts::Captain::ConfigController < Api::V1::Accounts::BaseCont
render json: {
providers: Llm::ConfigService.providers,
models: Llm::ConfigService.models,
features: Llm::ConfigService.all_features_config
features: features_with_account_preferences
}
end
private
def features_with_account_preferences
preferences = Current.account.captain_preferences
account_features = preferences[:features] || {}
account_models = preferences[:models] || {}
Llm::ConfigService.all_features_config.transform_keys(&:to_s).to_h do |feature_key, feature_config|
selected_model = account_models[feature_key] || feature_config[:default]
[feature_key, feature_config.merge(
enabled: account_features[feature_key] == true,
selected: selected_model
)]
end
end
end