chore: use separate feature flags for JS expressions and SQL query AI (#24498)

## Description
CE changes to support
https://github.com/appsmithorg/appsmith-ee/pull/1644
>
> Links to Notion, Figma or any other documents that might be relevant
to the PR
>
>
#### PR fixes following issue(s)
Fixes # (issue number)
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
arunvjn 2023-06-16 07:30:22 +05:30 committed by GitHub
parent 58960760f2
commit 2363a5011d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 18 deletions

View File

@ -1,6 +1,8 @@
export const askAIEnabled = false;
export const APPSMITH_AI = "Ask AI";
import type { TEditorModes } from "components/editorComponents/CodeEditor/EditorConfig";
import type FeatureFlags from "entities/FeatureFlags";
export const APPSMITH_AI = "AI";
export function GPTTrigger() {
return null;
/* eslint-disable-next-line */
export function isAIEnabled(ff: FeatureFlags, mode: TEditorModes) {
return false;
}

View File

@ -147,7 +147,7 @@ import { AIWindow } from "@appsmith/components/editorComponents/GPT";
import classNames from "classnames";
import {
APPSMITH_AI,
askAIEnabled,
isAIEnabled,
} from "@appsmith/components/editorComponents/GPT/trigger";
import {
getAllDatasourceTableKeys,
@ -157,13 +157,10 @@ import { debug } from "loglevel";
import { PeekOverlayExpressionIdentifier, SourceType } from "@shared/ast";
import type { MultiplexingModeConfig } from "components/editorComponents/CodeEditor/modes";
import { MULTIPLEXING_MODE_CONFIGS } from "components/editorComponents/CodeEditor/modes";
import { getAppsmithConfigs } from "@appsmith/configs";
type ReduxStateProps = ReturnType<typeof mapStateToProps>;
type ReduxDispatchProps = ReturnType<typeof mapDispatchToProps>;
const { cloudHosting } = getAppsmithConfigs();
export type CodeEditorExpected = {
type: string;
example: ExpectedValueExample;
@ -317,6 +314,12 @@ class CodeEditor extends Component<Props, State> {
props.input.value,
);
this.multiplexConfig = MULTIPLEXING_MODE_CONFIGS[this.props.mode];
/**
* Decides if AI is enabled by looking at repo, feature flags, props and environment
*/
this.AIEnabled =
isAIEnabled(this.props.featureFlags, this.props.mode) &&
Boolean(this.props.AIAssisted);
}
componentDidMount(): void {
@ -1475,16 +1478,6 @@ class CodeEditor extends Component<Props, State> {
}
const entityInformation = this.getEntityInformation();
/**
* Decides if AI is enabled by looking at repo, feature flags, props and environment
*/
this.AIEnabled = Boolean(
askAIEnabled &&
this.props.featureFlags.ask_ai &&
this.props.AIAssisted &&
cloudHosting,
);
/**
* AI button is to be shown when following conditions are satisfied
* Enabled by feature flag and repo permissions

View File

@ -4,6 +4,8 @@ type FeatureFlags = {
AUTO_LAYOUT?: boolean;
ask_ai?: boolean;
APP_NAVIGATION_LOGO_UPLOAD?: boolean;
ask_ai_sql?: boolean;
ask_ai_js?: boolean;
};
export default FeatureFlags;