## This is feature branch for Open AI integration. This Plugin supports two commands: - Chat - Open AI responds back with a list of messages. - Embeddings - Open AI responds back with list of embeddings. ### Chat Interface: In chat interface the user can select a model from GPT 3.5, GPT 4, and there fine-tuned versions. <img width="914" alt="Chat-screen" src="https://github.com/appsmithorg/appsmith/assets/107841575/30c3a095-4560-456b-9747-43b70a48cc0a"> ### Chat Response: <img width="865" alt="chat-response" src="https://github.com/appsmithorg/appsmith/assets/107841575/bad5269e-5bf5-4814-853a-65045423642e"> ### Embedding interface: <img width="914" alt="Embedding screen" src="https://github.com/appsmithorg/appsmith/assets/107841575/7c1dfa9f-caca-4dba-b4fe-10d25773f604"> ### Strategy: Added Factory classes for separating implementation of different commands, interface methods are: - getTriggerMethod() HTTP method to use for trigger call - getTriggerURI() url for trigger request - getExecutionMethod() HTTP method to user for Execution call - getExecutionURI () Url for executionRequest - makeRequestBody() for sending requests - isModelCompatible is model compatible for this command ? Fixes: https://github.com/appsmithorg/appsmith/issues/28269 --------- Co-authored-by: Diljit VJ <diljit@appsmith.com>
112 lines
2.9 KiB
TypeScript
112 lines
2.9 KiB
TypeScript
import { Component } from "react";
|
|
import type { ControlType } from "constants/PropertyControlConstants";
|
|
import type { InputType } from "components/constants";
|
|
import type { ConditonalObject } from "reducers/evaluationReducers/formEvaluationReducer";
|
|
import type { DropdownOption } from "design-system-old";
|
|
import type { ViewTypes } from "./utils";
|
|
import type { FeatureFlag } from "@appsmith/entities/FeatureFlag";
|
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
abstract class BaseControl<P extends ControlProps, S = {}> extends Component<
|
|
P,
|
|
S
|
|
> {
|
|
abstract getControlType(): ControlType;
|
|
}
|
|
|
|
export type ComparisonOperations =
|
|
| "EQUALS"
|
|
| "NOT_EQUALS"
|
|
| "LESSER"
|
|
| "GREATER"
|
|
| "IN"
|
|
| "NOT_IN"
|
|
| "FEATURE_FLAG"
|
|
| "VIEW_MODE";
|
|
|
|
export enum ComparisonOperationsEnum {
|
|
VIEW_MODE = "VIEW_MODE",
|
|
}
|
|
|
|
export type HiddenType = boolean | Condition | ConditionObject;
|
|
|
|
export interface ConditionObject {
|
|
conditionType: string;
|
|
conditions: Conditions;
|
|
}
|
|
|
|
export interface Condition {
|
|
path: string;
|
|
comparison: ComparisonOperations;
|
|
value: any;
|
|
flagValue: FeatureFlag;
|
|
}
|
|
|
|
export type Conditions = Array<Condition> | ConditionObject;
|
|
export interface ControlBuilder<T extends ControlProps> {
|
|
buildPropertyControl(controlProps: T): JSX.Element;
|
|
}
|
|
|
|
export interface ControlProps extends ControlData, ControlFunctions {
|
|
key?: string;
|
|
extraData?: ControlData[];
|
|
formName: string;
|
|
nestedFormControl?: boolean;
|
|
}
|
|
|
|
export interface ControlData {
|
|
id: string;
|
|
label: string;
|
|
alternateViewTypes?: ViewTypes[];
|
|
tooltipText?: string | Record<string, string>;
|
|
configProperty: string;
|
|
controlType: ControlType;
|
|
propertyValue?: any;
|
|
isValid: boolean;
|
|
validationMessage?: string;
|
|
validationRegex?: string;
|
|
dataType?: InputType;
|
|
initialValue?:
|
|
| string
|
|
| boolean
|
|
| number
|
|
| Record<string, string>
|
|
| Array<string>;
|
|
info?: string; //helper text
|
|
isRequired?: boolean;
|
|
conditionals?: ConditonalObject; // Object that contains the conditionals config
|
|
hidden?: HiddenType;
|
|
placeholderText?: string | Record<string, string>;
|
|
schema?: any;
|
|
errorText?: string;
|
|
showError?: boolean;
|
|
encrypted?: boolean;
|
|
subtitle?: string;
|
|
showLineNumbers?: boolean;
|
|
url?: string;
|
|
urlText?: string;
|
|
logicalTypes?: string[];
|
|
comparisonTypes?: string[];
|
|
nestedLevels?: number;
|
|
customStyles?: any;
|
|
propertyName?: string;
|
|
identifier?: string;
|
|
sectionName?: string;
|
|
disabled?: boolean;
|
|
staticDependencyPathList?: string[];
|
|
validator?: (value: string) => { isValid: boolean; message: string };
|
|
isSecretExistsPath?: string;
|
|
addMoreButtonLabel?: string;
|
|
}
|
|
export type FormConfigType = Omit<ControlData, "configProperty"> & {
|
|
configProperty?: string;
|
|
children?: FormConfigType[];
|
|
options?: DropdownOption[];
|
|
fetchOptionsConditionally?: boolean;
|
|
};
|
|
|
|
export interface ControlFunctions {
|
|
onPropertyChange?: (propertyName: string, propertyValue: string) => void;
|
|
}
|
|
|
|
export default BaseControl;
|