Skip to content

Commit

Permalink
init AI chat widget
Browse files Browse the repository at this point in the history
  • Loading branch information
znamenskii-ilia committed Sep 30, 2024
1 parent 3484a7b commit 21e769b
Show file tree
Hide file tree
Showing 15 changed files with 516 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"nanoid": "^2.0.4",
"node-forge": "^1.3.0",
"object-hash": "^3.0.0",
"openai": "^4.64.0",
"path-to-regexp": "^6.3.0",
"popper.js": "^1.15.0",
"prismjs": "^1.27.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import WDSAIChatWidget from "./widget";

export { WDSAIChatWidget };
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type { AnvilConfig } from "WidgetProvider/constants";

export const anvilConfig: AnvilConfig = {
isLargeWidget: false,
widgetSize: {
minWidth: {
base: "100%",
"180px": "sizing-30",
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { DefaultAutocompleteDefinitions } from "widgets/WidgetUtils";

export const autocompleteConfig = {
isVisible: DefaultAutocompleteDefinitions.isVisible,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ResponsiveBehavior } from "layoutSystems/common/utils/constants";
import type { WidgetDefaultProps } from "WidgetProvider/constants";

export const defaultsConfig = {
isVisible: true,
widgetName: "AI Chat",
widgetType: "AI_CHAT",
version: 1,
responsiveBehavior: ResponsiveBehavior.Fill,
} as unknown as WidgetDefaultProps;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { anvilConfig } from "./anvilConfig";
import { metaConfig } from "./metaConfig";
import { defaultsConfig } from "./defaultConfig";
import { propertyPaneContent } from "./propertyPaneContent";
import { propertyPaneStyle } from "./propertyPaneStyle";
import { methodsConfig } from "./methodsConfig";
import { autocompleteConfig } from "./autocompleteConfig";

export {
anvilConfig,
metaConfig,
defaultsConfig,
propertyPaneContent,
propertyPaneStyle,
methodsConfig,
autocompleteConfig,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { WIDGET_TAGS } from "constants/WidgetConstants";
import type { WidgetBaseConfiguration } from "WidgetProvider/constants";

export const metaConfig: WidgetBaseConfiguration = {
name: "AI Chat",
tags: [WIDGET_TAGS.CONTENT],
needsMeta: true,
searchTags: ["chat"],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ZoneIcon, ZoneThumbnail } from "appsmith-icons";

export const methodsConfig = {
IconCmp: ZoneIcon,
ThumbnailCmp: ZoneThumbnail,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ValidationTypes } from "constants/WidgetValidation";

export const propertyPaneContent = [
{
sectionName: "General",
children: [
{
helpText: "Controls the visibility of the widget",
propertyName: "isVisible",
label: "Visible",
controlType: "SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.BOOLEAN },
defaultValue: true,
},
],
},
{
sectionName: "Events",
children: [
{
helpText: "when the message is sent",
propertyName: "onMessageSent",
label: "onMessageSent",
controlType: "ACTION_SELECTOR",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: true,
},
],
},
];
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const propertyPaneStyle = [];
Loading

0 comments on commit 21e769b

Please sign in to comment.