Skip to content

Commit

Permalink
Add feature flag to control query assistant like features
Browse files Browse the repository at this point in the history
Signed-off-by: Songkan Tang <[email protected]>
  • Loading branch information
songkant-aws committed Jul 18, 2024
1 parent 2421ad3 commit baf8f20
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions common/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof configSchema>;
1 change: 1 addition & 0 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AssistantActions, 'executeAction'>;
registerIncontextInsight: IncontextInsightRegistry['register'];
renderIncontextInsight: (component: React.ReactNode) => React.ReactNode;
Expand Down
1 change: 1 addition & 0 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
exposeToBrowser: {
chat: true,
incontextInsight: true,
next: true,
},
schema: configSchema,
};
Expand Down

0 comments on commit baf8f20

Please sign in to comment.