From f644ada48bbf0caf607a99de7842668f1e76a058 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 15:23:53 +0800 Subject: [PATCH] Add feature flag to control query assistant like features (#219) (#220) (#225) (cherry picked from commit 3ab558e4bee55581b1aab674cb439b056881b3eb) (cherry picked from commit 7b2374f6962ce14d1d424052e8d1bcef1d267fb0) Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- common/types/config.ts | 3 +++ public/plugin.tsx | 1 + public/types.ts | 4 ++++ server/index.ts | 1 + 4 files changed, 9 insertions(+) diff --git a/common/types/config.ts b/common/types/config.ts index 78f31871..bf84a8da 100644 --- a/common/types/config.ts +++ b/common/types/config.ts @@ -14,6 +14,9 @@ export const configSchema = schema.object({ incontextInsight: schema.object({ enabled: schema.boolean({ defaultValue: true }), }), + next: schema.object({ + enabled: schema.boolean({ defaultValue: false }), + }), }); export type ConfigSchema = TypeOf; diff --git a/public/plugin.tsx b/public/plugin.tsx index 89c4f545..7585e0e5 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -147,6 +147,7 @@ export class AssistantPlugin actionExecutors[actionType] = execute; }, chatEnabled: () => this.config.chat.enabled, + nextEnabled: () => this.config.next.enabled, assistantActions, registerIncontextInsight: this.incontextInsightRegistry.register.bind( this.incontextInsightRegistry diff --git a/public/types.ts b/public/types.ts index 4b05b4ad..c9417680 100644 --- a/public/types.ts +++ b/public/types.ts @@ -46,6 +46,10 @@ export interface AssistantSetup { * Returns true if chat UI is enabled. */ chatEnabled: () => boolean; + /** + * Returns true if contextual assistant is enabled. + */ + nextEnabled: () => boolean; assistantActions: Omit; registerIncontextInsight: IncontextInsightRegistry['register']; renderIncontextInsight: (component: React.ReactNode) => React.ReactNode; diff --git a/server/index.ts b/server/index.ts index 74696c1a..4a0d1bab 100644 --- a/server/index.ts +++ b/server/index.ts @@ -11,6 +11,7 @@ export const config: PluginConfigDescriptor = { exposeToBrowser: { chat: true, incontextInsight: true, + next: true, }, schema: configSchema, };