From baf8f20710b846acdb044ddae922b89dba06a9c3 Mon Sep 17 00:00:00 2001 From: Songkan Tang Date: Thu, 18 Jul 2024 14:10:09 +0800 Subject: [PATCH] Add feature flag to control query assistant like features Signed-off-by: Songkan Tang --- 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, };