diff --git a/app/client/packages/design-system/widgets/jest.config.js b/app/client/packages/design-system/widgets/jest.config.js index 08272cd0c57..3043cc94294 100644 --- a/app/client/packages/design-system/widgets/jest.config.js +++ b/app/client/packages/design-system/widgets/jest.config.js @@ -1,3 +1,5 @@ +const esModules = ["remark-gfm"].join("|"); + module.exports = { preset: "ts-jest", roots: ["/src"], @@ -6,6 +8,9 @@ module.exports = { moduleNameMapper: { "\\.(css)$": "../../../test/__mocks__/styleMock.js", }, + transformIgnorePatterns: [ + `[/\\\\]node_modules[/\\\\](?!${esModules}).+\\.(js|jsx|mjs|cjs|ts|tsx)$`, + ], globals: { "ts-jest": { useESM: true, diff --git a/app/client/packages/design-system/widgets/package.json b/app/client/packages/design-system/widgets/package.json index 12607a4be39..799d1e31679 100644 --- a/app/client/packages/design-system/widgets/package.json +++ b/app/client/packages/design-system/widgets/package.json @@ -28,7 +28,8 @@ "lodash": "*", "react-aria-components": "^1.2.1", "react-markdown": "^9.0.1", - "react-syntax-highlighter": "^15.5.0" + "react-syntax-highlighter": "^15.5.0", + "remark-gfm": "^4.0.0" }, "devDependencies": { "@types/fs-extra": "^11.0.4", diff --git a/app/client/packages/design-system/widgets/src/components/AIChat/src/AIChat.tsx b/app/client/packages/design-system/widgets/src/components/AIChat/src/AIChat.tsx index 4fbadd4aaad..f952bec2329 100644 --- a/app/client/packages/design-system/widgets/src/components/AIChat/src/AIChat.tsx +++ b/app/client/packages/design-system/widgets/src/components/AIChat/src/AIChat.tsx @@ -1,14 +1,11 @@ -import { Button, Flex, Text, TextArea } from "@appsmith/wds"; -import type { FormEvent, ForwardedRef, KeyboardEvent } from "react"; -import React, { forwardRef, useCallback } from "react"; -import { ChatDescriptionModal } from "./ChatDescriptionModal"; -import { ChatTitle } from "./ChatTitle"; -import styles from "./styles.module.css"; -import { ThreadMessage } from "./ThreadMessage"; -import type { AIChatProps, ChatMessage } from "./types"; -import { UserAvatar } from "./UserAvatar"; +import type { ForwardedRef } from "react"; +import React, { forwardRef } from "react"; -const MIN_PROMPT_LENGTH = 3; +import styles from "./styles.module.css"; +import { ChatHeader } from "./ChatHeader"; +import { ChatThread } from "./ChatThread"; +import type { AIChatProps } from "./types"; +import { ChatInputSection } from "./ChatInputSection"; const _AIChat = (props: AIChatProps, ref: ForwardedRef) => { const { @@ -25,81 +22,28 @@ const _AIChat = (props: AIChatProps, ref: ForwardedRef) => { username, ...rest } = props; - const [isChatDescriptionModalOpen, setIsChatDescriptionModalOpen] = - React.useState(false); - - const handleFormSubmit = useCallback( - (event: FormEvent) => { - event.preventDefault(); - onSubmit?.(); - }, - [onSubmit], - ); - - const handlePromptInputKeyDown = useCallback( - (event: KeyboardEvent) => { - if (event.key === "Enter" && event.shiftKey) { - event.preventDefault(); - onSubmit?.(); - } - }, - [onSubmit], - ); return (
- - setIsChatDescriptionModalOpen(!isChatDescriptionModalOpen) - } - > - {chatDescription} - - -
- - -
- -
    - {thread.map((message: ChatMessage) => ( - - ))} -
- -
-