diff --git a/kahuna/app/controllers/KahunaController.scala b/kahuna/app/controllers/KahunaController.scala index 7674168c42a..d77e6313653 100644 --- a/kahuna/app/controllers/KahunaController.scala +++ b/kahuna/app/controllers/KahunaController.scala @@ -3,7 +3,7 @@ package controllers import com.gu.mediaservice.lib.argo.ArgoHelpers import com.gu.mediaservice.lib.auth.Authentication.Principal import com.gu.mediaservice.lib.auth.{Authentication, Authorisation, BaseControllerWithLoginRedirects} -import lib.{EnableAISearch, ExampleSwitch, FeatureSwitches, KahunaConfig, UseCqlChips} +import lib.{EnableAISearch, EnableAISearchManualMode, ExampleSwitch, FeatureSwitches, KahunaConfig, UseCqlChips} import play.api.mvc.ControllerComponents import play.api.libs.json._ @@ -38,7 +38,7 @@ class KahunaController( val isIFramed = request.headers.get("Sec-Fetch-Dest").contains("iframe") val featureSwitches = new FeatureSwitches( - List(ExampleSwitch, UseCqlChips, EnableAISearch) + List(ExampleSwitch, UseCqlChips, EnableAISearch, EnableAISearchManualMode) ) val featureSwitchesWithClientValues = featureSwitches.getClientSwitchValues(featureSwitches.getFeatureSwitchCookies(request.cookies.get)) val featureSwitchesJson = Json.stringify(Json.toJson(featureSwitches.getFeatureSwitchesToStringify(featureSwitchesWithClientValues))) diff --git a/kahuna/app/lib/FeatureSwitch.scala b/kahuna/app/lib/FeatureSwitch.scala index 67e78114b86..a5c52148047 100644 --- a/kahuna/app/lib/FeatureSwitch.scala +++ b/kahuna/app/lib/FeatureSwitch.scala @@ -22,6 +22,12 @@ object EnableAISearch extends FeatureSwitch( default = false ) +object EnableAISearchManualMode extends FeatureSwitch( + key = "enable-ai-search-manual-mode", + title = "Expose the AI search manual/hybrid toggle (off = always hybrid)", + default = false +) + class FeatureSwitches(featureSwitches: List[FeatureSwitch]){ // Feature switches are defined here, but updated by setting a cookie following the pattern e.g. "feature-switch-my-key" // for a switch called "my-key". diff --git a/kahuna/public/js/components/gr-chips/gr-chips.js b/kahuna/public/js/components/gr-chips/gr-chips.js index 5911eee453e..6deb99e4b36 100644 --- a/kahuna/public/js/components/gr-chips/gr-chips.js +++ b/kahuna/public/js/components/gr-chips/gr-chips.js @@ -27,7 +27,6 @@ grChips.controller('grChipsCtrl', ['$scope', function($scope) { $grChipsCtrl.configureNgModel = function(ngModelCtrl, onChangeExpr, autoCompleteExpr, validKeysExpr, autofocus, placeholder) { $grChipsCtrl.defaultPlaceholder = placeholder || 'Search for images... (type + for advanced search)'; - $grChipsCtrl.aiSearchPlaceholder = 'Search for conceptual images using AI search... (no filters available)'; $grChipsCtrl.onChange = () => onChangeExpr($scope, {$chips: $grChipsCtrl.items}); @@ -63,9 +62,7 @@ grChips.controller('grChipsCtrl', ['$scope', function($scope) { }); $grChipsCtrl.getPlaceholder = function() { - return $grChipsCtrl.useAiSearch ? - $grChipsCtrl.aiSearchPlaceholder : - $grChipsCtrl.defaultPlaceholder; + return $grChipsCtrl.defaultPlaceholder; }; $grChipsCtrl.isEmpty = function() { @@ -179,9 +176,6 @@ grChips.directive('grChips', ['$parse', function($parse) { template: template, controller: 'grChipsCtrl', controllerAs: '$grChipsCtrl', - bindToController: { - useAiSearch: ' diff --git a/kahuna/public/js/search/index.js b/kahuna/public/js/search/index.js index 8897e6006ee..722e85cb930 100644 --- a/kahuna/public/js/search/index.js +++ b/kahuna/public/js/search/index.js @@ -179,6 +179,7 @@ search.config(['$stateProvider', '$urlMatcherFactoryProvider', 'until', 'orderBy', 'useAISearch', + 'aiQuery', 'vecWeight', 'dateField', 'takenSince', diff --git a/kahuna/public/js/search/query.html b/kahuna/public/js/search/query.html index 8cfde8b1157..2824af8c7e8 100644 --- a/kahuna/public/js/search/query.html +++ b/kahuna/public/js/search/query.html @@ -1,12 +1,13 @@