diff --git a/src/app/change-log/page.tsx b/src/app/change-log/page.tsx index d49c6cc6e..2e6d2daed 100644 --- a/src/app/change-log/page.tsx +++ b/src/app/change-log/page.tsx @@ -1,4 +1,4 @@ -import { Markdown } from "@/components/chat/markdown"; +import { Markdown } from "@/components/markdown/markdown"; import { Card } from "@/components/ui/card"; import { VersionDisplay } from "@/features/change-log/version-display"; import { promises as fs } from "fs"; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index cb088fb55..4db4d7a07 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -21,7 +21,7 @@ export default function RootLayout({ children: React.ReactNode; }) { return ( - + diff --git a/src/components/chat/chat-row.tsx b/src/components/chat/chat-row.tsx index 2ffc7cfa6..0e1306d10 100644 --- a/src/components/chat/chat-row.tsx +++ b/src/components/chat/chat-row.tsx @@ -4,10 +4,10 @@ import { isNotNullOrEmpty } from "@/features/chat/chat-services/utils"; import { cn } from "@/lib/utils"; import { CheckIcon, ClipboardIcon, UserCircle } from "lucide-react"; import { FC, useState } from "react"; +import { Markdown } from "../markdown/markdown"; import Typography from "../typography"; import { Avatar, AvatarImage } from "../ui/avatar"; import { Button } from "../ui/button"; -import { Markdown } from "./markdown"; interface ChatRowProps { name: string; diff --git a/src/components/markdown/config.tsx b/src/components/markdown/config.tsx new file mode 100644 index 000000000..a5bf9d06f --- /dev/null +++ b/src/components/markdown/config.tsx @@ -0,0 +1,12 @@ +import { citation } from "@/features/chat/chat-ui/markdown/citation"; +import { Config } from "@markdoc/markdoc"; +import { paragraph } from "./paragraph"; + +export const citationConfig: Config = { + nodes: { + paragraph: paragraph, + }, + tags: { + citation, + }, +}; diff --git a/src/components/chat/markdown.tsx b/src/components/markdown/markdown.tsx similarity index 63% rename from src/components/chat/markdown.tsx rename to src/components/markdown/markdown.tsx index cc89dfc6e..4a36f564e 100644 --- a/src/components/chat/markdown.tsx +++ b/src/components/markdown/markdown.tsx @@ -1,9 +1,8 @@ import Markdoc from "@markdoc/markdoc"; import React, { FC } from "react"; -import { - Citation, - citationConfig, -} from "../../features/chat/chat-ui/markdown/citation"; +import { Citation } from "../../features/chat/chat-ui/markdown/citation"; +import { citationConfig } from "./config"; +import { Paragraph } from "./paragraph"; interface Props { content: string; @@ -15,7 +14,8 @@ export const Markdown: FC = (props) => { const content = Markdoc.transform(ast, { ...citationConfig, }); + return Markdoc.renderers.react(content, React, { - components: { Citation }, + components: { Citation, Paragraph }, }); }; diff --git a/src/components/markdown/paragraph.tsx b/src/components/markdown/paragraph.tsx new file mode 100644 index 000000000..d4904caf6 --- /dev/null +++ b/src/components/markdown/paragraph.tsx @@ -0,0 +1,7 @@ +export const Paragraph = ({ children, className }: any) => { + return
{children}
; +}; + +export const paragraph = { + render: "Paragraph", +}; diff --git a/src/features/chat/chat-ui/chat-file/chat-file-slider.tsx b/src/features/chat/chat-ui/chat-file/chat-file-slider.tsx index ddb26723e..3bd0f67ba 100644 --- a/src/features/chat/chat-ui/chat-file/chat-file-slider.tsx +++ b/src/features/chat/chat-ui/chat-file/chat-file-slider.tsx @@ -2,7 +2,6 @@ import { Button } from "@/components/ui/button"; import { Sheet, SheetContent, - SheetDescription, SheetHeader, SheetTitle, SheetTrigger, @@ -14,7 +13,7 @@ export const ChatFileSlider = () => { return (
- + @@ -22,10 +21,10 @@ export const ChatFileSlider = () => { Upload File - - - +
+ +
diff --git a/src/features/chat/chat-ui/chat-input/chat-input.tsx b/src/features/chat/chat-ui/chat-input/chat-input.tsx index 1e4e76492..09bbf86c9 100644 --- a/src/features/chat/chat-ui/chat-input/chat-input.tsx +++ b/src/features/chat/chat-ui/chat-input/chat-input.tsx @@ -39,7 +39,7 @@ const ChatInput: FC = (props) => { onSubmit={submit} className="absolute bottom-0 w-full flex items-center" > -
+
{fileCHatVisible && }